Refer the article New Selenium IDE – Commands (Selenese), for the complete list of Selenium IDE commands and their practical demonstrations.
select frame is one of the commands in Selenium IDE.
The purpose of select frame command in Selenium IDE, is to select the required frame before performing any UI element inside it.
In this article, I am going to practically demonstrate select frame command in Selenium IDE for selecting the required frame before clicking a link inside frame as shown below:
Let’s get started.
New Selenium IDE – Using ‘select frame’ command
Follow the below steps for practicing select frame command in Selenium IDE along with me:
1) Execute the open command in Selenium IDE as explained in the previous article: Selenium IDE – open command
2) Now click on the second row in the Selenium IDE’s Test Script Editor Box as shown below:
3) First, let’s try to click on the ‘Hotel’ link without switching/selecting the frame in which it is available:
While the second row is selected in step 2, enter the Selenium IDE command ‘click’ to the Command box field and the XPath locating strategy //a[text()=’Hotels’] into the Target field as shown below:
Click on ‘Run current test’ option as shown below:
Observe that we will get an error as the ‘Hotels’ link is inside the iframe as shown below:
4) In the above step, the test got failed as the ‘Hotels’ link was not located even after providing a valid location.
In this situation, we have to find out whether the ‘Hotels’ link is inside any frame. Right-click near the area where ‘Hotels’ link is available and check if you are getting any frame options as shown below:
Hence as the frame options are getting displayed as shown in the above screen, we can confirm that ‘Hotels’ link is inside the frame.
And also, we can inspect the ‘Hotels’ link and double confirm from the HTML code whether this link is inside the iframe as shown below:
5) In order to click on the ‘Hotels’ link, we need to first switch to the frame.
Right-click on the second step and select ‘Insert new command’ option as shown below:
Select the newly inserted row as shown below:
While the newly insert row is selected, enter ‘select frame‘ command into the Command field and index=0 (which locates the first out of the available frames on the page) as shown below:
Note: We have to increase the index value say 1,2,3,4 etc. if the required frame is not identified.
Click on ‘Run current test’ option and observe that the test got executed and the ‘Hotels’ links inside the frame got clicked as shown below:
Here concludes the practical demonstration of select frame command in Selenium IDE.
In the next article, I will practically demonstrate another Selenium IDE command.
Next Steps:
- > To learn more about Selenium, continue to the next post (Click on Next Post link below)
- > Check complete Selenium Tutorial Contents here (Click here)
Please leave your questions/comments/feedback below.
Happy Learning ?
On a mission to contribute to the Software Testing Community in all possible ways.
Refer the article New Selenium IDE – Commands (Selenese), for the complete list of Selenium IDE commands and their practical demonstrations.