Skip to content

SwitchTo

SwitchTo command is used to switch to the specified window and iframe.

For switching to an iframe, select SWITCHTO command from the action drop down, select desired Screen name and Element (here element could be any element of the iframe) and leave the parameter section blank as shown below:

 

Here, frame_username (in the above snapshot) is an element inside the iframe to which we want to switch the control. After completing this step, step will look as below:

 

Similarly, if there are multiple frames and user has to switch to specific frame then user can use specific index of that frame e.g. 1, 2, 3 etc. as shown below:

 

 

 

For switching to another window, User has to select SWITCHTO command from the action drop down, leave Screen blank, type ” child “ in the Element key and leave the parameter section blank as shown below:

 

The above step will switch the control from main window to child window. Now in order to switch the control back to main window, user has to use “main” keyword in the element key as shown below:

 

 

 

Note: In case of iframe, if there are multiple frames on the screen and we need to work on them so after switching the control to first iframe and performing some actions on the web element inside the first iframe we need to switch the control back to the main window (Using SWITCHTO main) and then we can switch to second (another) iframe and perform some actions on the web element present inside second(another) iframe. Similarly every time we need to switch to different frames, firstly we need to some back to main window and then switch to another iframe.

 

Back To Top