第一次下拉:
<select id="MainContent_drpVehicleType" style="width:175px;" name="ctl00$MainContent$drpVehicleType">
<option value="">- SELECT -</option>
<option value="1" title="AUTO">AUTO</option>
<option value="2" title="HD">HD</option>
<option value="3" title="MARINE">MARINE</option>
</select>
Run Code Online (Sandbox Code Playgroud)
第二次下拉:
<select id="MainContent_drpMake" style="width:175px;" name="ctl00$MainContent$drpVehicleType">
<option value="1" title="ACURA">ACURA</option>
<option value="2" title="ALFA ROMEO">ALFA ROMEO</option>
<option value="74" title="ALLIS CHALMERS LIFT TRUCK">ALLIS CHALMERS LIFT TRUCK</option>
<option value="75" title="ALLIS CHALMERS TRACTOR">ALLIS CHALMERS TRACTOR</option>
<option value="4" title="AMERICAN MOTORS">AMERICAN MOTORS</option
</select>
Run Code Online (Sandbox Code Playgroud)
b.select_list(:id, "MainContent_drpVehicleType").select("AUTO")
b.select_list(:id, "MainContent_drpMake").select("ACURA")
Run Code Online (Sandbox Code Playgroud)
并尝试过
`b.select_list(:id, "MainContent_drpMake").wait_until_present.option(:text, 'ACURA')`
Run Code Online (Sandbox Code Playgroud)
**我的问题是从第一次下拉菜单中选择"自动"并且无法从第二次下拉菜单中选择"ACURA"
C:/Ruby193/menu.rb:23:in `<main>':
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.2/lib/watir-webdriver/el
ements/select.rb:218:in `no_value_found': "ACURA" not found in select list (Wati
r::Exception::NoValueFoundException)
from …Run Code Online (Sandbox Code Playgroud)