class Capybara::RackTest::Form

def add_select_param(field, params)

def add_select_param(field, params)
  if field['multiple'] == 'multiple'
    field.xpath(".//option[@selected]").each do |option|
      merge_param!(params, field['name'].to_s, (option['value'] || option.text).to_s)
    end
  else
    option = field.xpath('.//option[@selected]').first || field.xpath('.//option').first
    merge_param!(params, field['name'].to_s, (option['value'] || option.text).to_s) if option
  end
end