Select an unknown option with Capybara

Updated . Posted . Visible to the public.

When you don't know which options are available, but need to have an option selected, use this step.

When /^I select the second option from "([^"]*)"$/ do |id|
  second_option = find(:xpath, "//*[@id='#{id}']/option[2]").text
  select(second_option, :from => id)
end
Profile picture of Dominik Schöler
Dominik Schöler
Last edit
Keywords
some, general
License
Source code in this card is licensed under the MIT License.
Posted by Dominik Schöler to makandra dev (2011-09-06 13:00)