这里我试图在选择列表中选择付款选项并在Firefox浏览器上工作。
<select id="IDITForm@claimReserveReasonVO@id" class="SelectInput" onclick="closeAfterUnload = false" onblur="releaseCurrentFocusField()" helptextinfo="" onfocus="onFocusFieldHandler(this)" onchange="closeAfterUnload = false" onkeypress="onComboKeyPress(this)" style="width: 328px; visibility: visible;" name="IDITForm@claimReserveReasonVO@id" tabindex="217" origvalue="-1" value="-1">
<option value="-1">Select</option>
<option value="11">Damage Closed</option>
<option value="10">Ex- gratia</option>
<option value="4">Invoice</option>
<option value="6">Medical information</option>
<option value="1">Open new damage</option>
<option value="7">Payment</option>
<option value="3">Proposal</option>
<option value="5">Report assessor</option>
<option value="12">Storno payment</option>
</select>
我尝试过使用以下代码,但没有成功
b.select_list(:id, 'IDITForm@claimReserveReasonVO@id').select "Payment"
b.select_list(:id, 'IDITForm@claimReserveReasonVO@id').option(:text,'Payment').select
b.select_list(:id, 'IDITForm@claimReserveReasonVO@id').option(:value,'7').select
但我已经编写了以下代码来打印选项,它工作正常,也就是说,它打印了所有选项。
b.select_list(:id, 'IDITForm@claimReserveReasonVO@id').options.each do |option|
puts option.text
end
注意:它在Chrome中完美运行,但在Firefox中无效。