Refer the article New Selenium IDE – Commands (Selenese), for the complete list of Selenium IDE commands and their practical demonstrations.
add selection is one of the commands in Selenium IDE.
The purpose of add selection command in Selenium IDE, is to select options from the Multi-selection box field.
Difference between dropdown and multi-selection box field
In the dropdown field, we can only select one option, but whereas in multi-selection box field, we can select more than one options.
Hence using add selection command in Selenium IDE, we can select more than one option in a Multi-selection box field.
In this article, I am going to practically demonstrate add selection command in Selenium IDE for selecting more than one options in a Multi-selection box fields as shown below:
Let’s get started.
New Selenium IDE – Using ‘add selection’ command for selecting multi-selection box field options
Follow the below steps for practicing add selection 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) While the second row is selected in step 2, enter the Selenium IDE command ‘add selection’ to the Command box field, enter the id locating strategy id=multiselect1 into the Target box field and enter ‘label=Volvo’ shown below:
Note: The locating strategy id=multiselect1 is for locating the multi-selection box field on the http://omayo.blogspot.com/ URL page (Shown at the beginning of the article).
And ‘label=Volvo’ needs to be entered to the ‘Value’ field in Selenium IDE, to select the ‘Volvo’ option in the above-stated Multi-selection box field.
4) Click on ‘Run current test’ option as shown below:
5) Observe that the add selection command in the Selenium IDE will be executed, and the ‘Volvo’ option in the multi-selection box field will be selected as shown below:
6) After the above execution, we can see that ‘Volvo’ option got selected.
As we can select multiple options in Multi-selection box field, we do the below.
Select third row in Selenium IDE, enter the Selenium IDE command ‘add selection’ to the Command box field, enter the id locating strategy id=multiselect1 into the Target box field and enter ‘label=Audi’ shown below:
Note: The locating strategy id=multiselect1 is for locating the multi-selection box field on the http://omayo.blogspot.com/ URL page (Shown at the beginning of the article).
And ‘label=Audi’ needs to be entered to the ‘Value’ field in Selenium IDE, to select the ‘Audi’ option in the above-stated Multi-selection box field.
7) Click on ‘Run current test’ option as shown below:
8) Observe that the add selection command in the Selenium IDE will be executed, and the ‘Volvo’ & ‘Audi’ options in the multi-selection box field will be selected as shown below:
Hence we have selected more than one option in Multi-selection box field using add selection command in Selenium IDE.
Here concludes the practical demonstration of add selection 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.