I am trying to get familiar with the new ruby selenium-webdriver as it appears more intuitive mostly than the previous version of selenium and the ruby driver that went with
require "selenium-webdriver"
webdriver = Selenium::WebDriver.for :firefox
driver.navigate.to url
dropdown = webdriver.find_element(:id,dropdownid)
return nil if dropdown.nil?
selected = dropdown.find_elements(:tag_name,"option").detect { |option| option.attribute('text').eql? value}
if selected.nil? then
puts "Can't find value in dropdown list"
else
selected.click
end
In my case this is only one working sample.