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

旧时模样 提交于 2019-12-12 10:18:23

问题


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?


回答1:


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. :)



来源:https://stackoverflow.com/questions/6314330/use-select-command-in-selenium-ide-testing-tool-for-selecting-one-option-from-dr

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!