Skip to content

Instantly share code, notes, and snippets.

@santiycr
Created March 24, 2011 23:20
Show Gist options
  • Save santiycr/886089 to your computer and use it in GitHub Desktop.
Save santiycr/886089 to your computer and use it in GitHub Desktop.
require "test/unit"
require "rubygems"
gem "selenium-client"
require "selenium/client"
class test < Test::Unit::TestCase
def setup
@verification_errors = []
@selenium = Selenium::Client::Driver.new \
:host => "localhost",
:port => 4444,
:browser => "*chrome",
:url => "http://www.google.com/",
:timeout_in_second => 60
@selenium.start_new_browser_session
end
def teardown
@selenium.close_current_browser_session
assert_equal [], @verification_errors
end
def test_test
@selenium.open "/"
@selenium.wait_for_page_to_load "60000"
@selenium.type "name=q", ""
begin
assert @selenium.is_visible("id=hplogo")
rescue Test::Unit::AssertionFailedError
@verification_errors << $!
end
@selenium.type "name=q", "santi"
@selenium.key_press "name=q", "\\13"
@selenium.wait_for_page_to_load "60000"
@selenium.open "/"
@selenium.wait_for_page_to_load "60000"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment