How to work with frames/iframes?

In order to interact with a widget inside a frame/iframe in your application, you will have to define the locator that you want to interact with and then you will need to populate the Frame field by specifying an XPath that defines the frame/iframe. For example: //iframe[@id='my_frame_id'].

One frame/iframe

In the example below, there is only one iframe visible, so the XPath below should work:

//iframe

mceclip4.png

 

If there are multiple iframes, you can use numbering to identify which iframe is to be selected:

(//iframe)[1]
(//iframe)[2]
(//iframe)[3]

 

Nested Frames/Iframes

If your widget is in a nested frame (i.e. frame within frame), you can use the following inside the Frame field of the locator you are defining: //iframe[@id='outer_frame_id];//iframe[@id='inner_frame_id'].

 

In the example below, at the inner iframe, we have to generate an XPath for the outer iframe, followed by a semicolon followed by the XPath for the inner iframe.

//*[@id="iframeResult"];//iframe

mceclip3.png

 

Was this article helpful?
0 out of 1 found this helpful
Have more questions? Submit a request

Comments

Please sign in to leave a comment.