我无法让Watir从下拉列表中选择正确的选项。我试图从中选择:
<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>
我需要选择第二个选项AccountSpecific,但它不起作用。
我试过
option = browser.select_list(:id => /.*ruleTypeSelector.*/).select("AccountSpecific")
和
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
但两次都改为选择第一个选项ExecutionOrder。
为什么这不起作用?我还能尝试什么?
答案 0 :(得分:1)
browser.select_list(:id => /.*ruleTypeSelector.*/).option(:text =>"Account Specific Pricing").when_present.select