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

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://a9t9.com/kantu/demo/iframes
selectFrame relative=top
selectFrame index=0
click css=button.ytp-large-play-button.ytp-button

Works in

Kantu for Chrome Selenium IDE, Kantu 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 Github repository testmacros folder.

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.

Kantu Selenium IDE for Chrome and Firefox - Web Test Automation
Subscribe to the a9t9 automation software newsletter . We'll send you updates on new releases that we're working on.