问题
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