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 ?
Elements are located by creating a Selector Hash, which Watir translates into the potentially complicated information the driver needs to know to identify the element. The special cases will be highlighted below, but Watir Locators: Accept String values for exact matching. Accept RegExp values for partial matching.
The value of the selected element can be found by using the value property on the selected element that defines the list. This property returns a string representing the value attribute of the <option> element in the list. If no option is selected then nothing will be returned.
Definition: Watir, pronounced as water, is a group of Ruby libraries for automated web browsers. It allows writing the tests which are easy to read and maintain. In other words, it is a simple and flexible tool.
Watir (Web Application Testing in Ruby), pronounced as "Water" is an open source tool developed using Ruby which helps in automating web application no matter which language the application is written. The browsers supported are Internet Explorer, Firefox, Chrome, Safari, and Edge.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With