Skip to content

Instantly share code, notes, and snippets.

@jarib
Created June 29, 2011 10:01
Show Gist options
  • Save jarib/1053565 to your computer and use it in GitHub Desktop.
Save jarib/1053565 to your computer and use it in GitHub Desktop.
require 'selenium-webdriver'
wait = Selenium::WebDriver::Wait.new
driver = Selenium::WebDriver.for :firefox
driver.get "http://www.google.no/?as_qdr=all"
driver.find_element(:name => "q").send_keys("selenium")
suggestions = nil
wait.until {
suggestions = driver.find_elements(:class => "gsq_a").select { |e| e.displayed? }
suggestions.any?
}
suggestions.last.click
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment