Skip to content

Instantly share code, notes, and snippets.

@DylanLacey
Last active August 29, 2015 14:25
Show Gist options
  • Save DylanLacey/bc0d8ff4b54aae7078e6 to your computer and use it in GitHub Desktop.
Save DylanLacey/bc0d8ff4b54aae7078e6 to your computer and use it in GitHub Desktop.
Simple Selenium with Ruby and Sauce
require "selenium/webdriver"
sauce_endpoint = "http://USERNAME:[email protected]:80/wd/hub"
caps = {
:platform => "Mac OS X 10.9",
:browserName => "Chrome",
:version => "31"
}
driver = Selenium::WebDriver.for :remote, :url => sauce_endpoint, :desired_capabilities => caps
driver.manage.timeouts.implicit_wait = 10
driver.navigate.to "http://www.google.com"
raise SystemError("Unable to load Google.") unless driver.title.include? "Google"
query = driver.find_element :name, "q"
query.send_keys "Sauce Labs"
query.submit
puts driver.title
driver.quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment