Reputation: 121
I am unable to get Watir to select the correct option from a dropdown. I'm trying to select from this:
<select id="j_id0:theForm:ruleTypeSelector" onkeypress="return suppressEnter(event);" size="1" name="j_id0:theForm:ruleTypeSelector">
<option value="ExecutionOrder">Pricing Administration</option>
<option value="AccountSpecific">Account Specific Pricing</option>
<option value="AssociatedProduct">Associated Product Pricing</option>
<option value="MaintenanceProduct">Maintenance Product Pricing</option>
<option value="Tiered">Tiered Pricing</option>
<option value="Volume">Volume Pricing</option>
</select>
I need to select the second option, AccountSpecific, but it is not working.
I tried
option = browser.select_list(:id => /.*ruleTypeSelector.*/).select("AccountSpecific")
and
option = browser.select_list(:id => /.*ruleTypeSelector.*/).option(:value => "AccountSpecific")
browser.select_list(:id => /.*ruleTypeSelector.*/)
option.wait_until_present
option.select
browser.button(:value => "Go").click
but both times, it instead selects the first option, ExecutionOrder.
Why is this not working? What else can I try?
Upvotes: 0
Views: 1081
Reputation: 82
browser.select_list(:id => /.*ruleTypeSelector.*/).option(:text =>"Account Specific Pricing").when_present.select
Upvotes: 1