4

如何在此下拉列表中选择第二个选项?

<select name="size" onchange="...js...">
  <option value="OPTION_CHOOSE">Please Select an Option</option>                            
  <option value="123">ABC</option>
  <option value="456">DFG</option>
  <option value="789">HIJ</option>
</select>

红宝石

require 'rubygems'
require 'mechanize'

url = "http://...."
agent = Mechanize.new
page = agent.get(url)

form = agent.page.forms.first

*select drop down*
4

1 回答 1

6
form.field_with(:name => 'size').options[1].click
于 2012-10-06T02:39:16.003 回答