Skip to content

Instantly share code, notes, and snippets.

@jaysonrowe
Created November 15, 2012 03:22
Show Gist options
  • Save jaysonrowe/4076446 to your computer and use it in GitHub Desktop.
Save jaysonrowe/4076446 to your computer and use it in GitHub Desktop.
Checking Gmail with Selenium Webdriver in Ruby
require 'rubygems'
require 'selenium-webdriver'
require 'test-unit'
class GmailLoginTest < Test::Unit::TestCase
def setup
@driver = Selenium::WebDriver.for :firefox
@driver.get "http://www.gmail.com"
end
def test_page_title
assert_equal @driver.title, "Gmail: Email from Google"
end
def test_login
loginBox = @driver.find_element(:id, "Email")
loginBox.send_keys("[email protected]")
pwBox = @driver.find_element(:id, "Passwd")
pwBox.send_keys("!SuperSecretpassw0rd")
signinBtn = @driver.find_element(:id, "signIn")
signinBtn.click()
end
def teardown
@driver.quit
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment