如何选择ruby watir中的值下拉选项?

时间:2022-07-04 18:55:04

This is my drop down and i want to select it on its value option

这是我的下拉菜单,我想在其值选项中选择它

<select id ="">
<option value="01" title="  01 - Live animals">  01 - Live animals</option>
</select>

I know that how to select drop down on its content i.e.

我知道如何选择下载其内容,即

ie.select_list(:id, "DropDownList_Product").select("01 - Live animals")

actually I want to select drop down on its value 01,what should i have to do for that ?

实际上我想选择下拉它的值01,我该怎么办呢?

1 个解决方案

#1


14  

Something like this should work:

像这样的东西应该工作:

ie.select_list(:id, "DropDownList_Product").select_value("01")

More information at http://rdoc.info/gems/watir-webdriver/Watir/Select#select_value-instance_method

有关更多信息,请访问http://rdoc.info/gems/watir-webdriver/Watir/Select#select_value-instance_method

#1


14  

Something like this should work:

像这样的东西应该工作:

ie.select_list(:id, "DropDownList_Product").select_value("01")

More information at http://rdoc.info/gems/watir-webdriver/Watir/Select#select_value-instance_method

有关更多信息,请访问http://rdoc.info/gems/watir-webdriver/Watir/Select#select_value-instance_method