0

我无法让 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。

为什么这不起作用?我还能尝试什么?

4

1 回答 1

1
 browser.select_list(:id => /.*ruleTypeSelector.*/).option(:text =>"Account Specific Pricing").when_present.select
于 2013-04-02T08:35:02.973 回答