Example: In order to select a value in the drop down field, we need to use the 'select' command in Selenium IDE, locator strategy of the drop down field and provide the label text of the option to be selected as explained in the below screen-shot:
Prerequisites:
In order to implement select command in Selenium IDE, we have to first install 'Selenium IDE' firefox add-on in firefox browser. If you don't have Selenium IDE add-on installed in your firefox browser, follow the below posts first:
And also refer to the below post for opening the Application URL in the Firefox Browser using Selenium IDE:
Implementing 'select' selenese command in Selenium IDE for selecting an option in the drop down field:
Lets follow the below steps for implementing the select selenese command for selecting an option in the drop-down field:
1. Open Firefox browser and select 'Tools' Menu > 'Selenium IDE' option as shown below:
2. A 'Selenium IDE' window will be displayed as shown below:
3. Select the first row in the 'Table' pane as shown below:
4. While the first row is selected, type the letter 'o' into the 'Command' box field and observe that the 'open' command will be provided by the Selenium IDE as an auto suggestion as shown below:
5. Select 'open' from the auto suggestion and observe that 'open' text got entered into the 'Command' field as shown below:
6. Now enter any application URL say 'http://www.omayo.blogspot.com' into the 'Target' box field as shown below:
7. Now, select the second row in the 'Table' pane as shown below:
8. Enter the command text 'select' into the 'Command' field as shown below:
9. Now lets aim for selecting an option say 'doc 3' in a drop-down field on the Application page. In order to select an option in the drop-down field, we need to create the locator strategy for locating the drop-down field and provide the label of the option to be selected. Luckily Selenium IDE can automatically generate the locator strategy using the 'Select' button. Click on 'Select' button on 'Selenium IDE' and select drop down field as shown below:
10. After performing as specified in the above screen-shot, observe that the locator strategy for the drop-down field will be auto generated and displayed in the 'Target' field as shown below:
8. Enter the command text 'select' into the 'Command' field as shown below:
9. Now lets aim for selecting an option say 'doc 3' in a drop-down field on the Application page. In order to select an option in the drop-down field, we need to create the locator strategy for locating the drop-down field and provide the label of the option to be selected. Luckily Selenium IDE can automatically generate the locator strategy using the 'Select' button. Click on 'Select' button on 'Selenium IDE' and select drop down field as shown below:
10. After performing as specified in the above screen-shot, observe that the locator strategy for the drop-down field will be auto generated and displayed in the 'Target' field as shown below:
11. Till now we have provided the 'select' command to automate the selection of an option in the drop-down field and also we have auto generated the locator strategy for drop-down field in which we want to select any option. But, we have to now figure out the drop-down field option to be selected. Lets say, we want to select the option 'doc 3' into the drop-down field, we need to enter the label text of the option to be selected into the 'Value' field in Selenium IDE a shown below:
12. The purpose of second step in the Selenium IDE is to select an option in the drop-down field on the Application page. After providing the select command , locator strategy for locating the drop-down field and the text label of the option to be selected, the Selenium IDE window will look as below:
13. Click on 'Play current test case' option as shown below:
14. Observe that the application URL provided in the Selenium IDE will be opened as part of first step and the option having label text 'doc 3' will get selected in the drop-down field on the application page as part of second step. Also observe that the executed test case in Selenium IDE will be displayed as passed as shown below:
Conclusion
select command in Selenium IDE is one of the selenese commands. The purpose of this command is to select the option having the provided label text in the drop-down field.
No comments:
Post a Comment