selectFrame - Selenium IDE
selectFrame (frame identifier) - Selenium IDE command
You need to use the selectFrame command in selenium when your page contains iframes and you have to perform some action on element inside iframe. You need to provide name or id attribute of iframe element into target column. Exactly the same command also works for frames, in exactly the same way.
SelectFrame values:
- relative=top - go back to the top frame (= outside all frames)
- index=0,1,2,3,... - go inside the n-th frame
See also: How to click on elements inside an iFrame?
Note: Do not confuse selectFrame with selectWindow, which is used to select browser tabs.
selectFrame Example
This macro clicks inside an iframe. The first selectFrame relative=top is not really needed, as we are already still in the top frame. We would need it once we are inside a frame and want to get out again.
Command | Target | Pattern/Text |
---|---|---|
open | https://ui.vision/demo/iframes | |
selectFrame | relative=top | |
selectFrame | index=0 | |
click | css=button.ytp-large-play-button.ytp-button |
Works in
Ui.Vision RPA for Chrome Selenium IDE, Ui.Vision RPA for Firefox Selenium IDE, Firefox IDE Classic
Related Demo Macros
DemoIFrame, DemoFrame
The ready-to-import-and-run source code of all demo macros can be found in the Open-Source RPA software Github repository.
See also
selectWindow, Web Automation Extension User Manual, Selenium IDE commands, Classic Firefox Selenium IDE.
Anything wrong or missing on this page? Suggestions?
...then please contact us.