Use select command in Selenium IDE testing tool for selecting one option from dropdown list

selenium-ide

We are using Selenium IDE testing tool in our web application. I am confused in using select command; I need to select one value from a drop down using select command.

In select ( selectLocator,optionLocator ) what can we give in place of selectLocator and optionLocator for selecting one option from dropdown list?

Best Answer

In the command select (selectLocator, optionLocator), 'selectLocator' is the Id of the drop down from which the value is being selected and the 'optionLocator' is the value being selected.

For eg: say a drop down having Id="//select[@id='type'" with values like 'TypeA, TypeB, TypeC,...'. If you are selecting 'TypeA' from the drop down, your command should go like this:

selenium.select("//select[@id='type']", "label=TypeA");

I hope this will solve your problem. :)

Related Topic