Last active
August 29, 2015 14:25
-
-
Save DylanLacey/bc0d8ff4b54aae7078e6 to your computer and use it in GitHub Desktop.
Simple Selenium with Ruby and Sauce
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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