require 'watir' # the watir controller require 'timeout' include Watir # set a variable test_site = 'https://www.google.com/accounts/ServiceLoginBox?continue=https%3A%2F%2Fwww.orkut.com%2FRedirLogin.aspx%3Fmsg%3D0%26page%3Dhttp%253A%252F%252Fwww.orkut.com%252F&followup=https%3A%2F%2Fwww.orkut.com%2FGLogin.aspx&service=orkut&nui=2&uilel=1&skipvpage=true&hl=en-US' # open the IE browser ie = Watir::IE.new # print some comments puts "## Beginning of test: Orkut Scraps" puts " " #Login puts "Step 1: go to the test site: " + test_site ie.goto(test_site) puts "Step 2: Enter the username" ie.text_field(:name, "Email").set("talent.capture") #Login puts "Step 3: Enter the password" ie.text_field(:name, "Passwd").set("recruitment") #Password puts "Step 4: Clear remember me checkbox" ie.checkbox(:name, "PersistentCookie").clear #Clear Remember me on this computer #begin #status = Timeout::timeout(20) { puts "Step 5: Submit" ie.button(:value, "Sign in").click #Submit # } #rescue TimeoutError # puts "Looks like this is working ...I am on my way :-)\n" #end puts "Now on Home page" #ie = Watir::IE.attach(:url, "http://www.orkut.com/Home.aspx") while ! ie.contains_text("talent") do p "waiting for page to load" sleep 0.1; end a = ie.contains_text("talent.capture") if !a puts "Test failed! Page didn't contain text: Reached test verification point." else # begin #status = Timeout::timeout(20) { puts "Click on scrapbook" ie.link(:text, "scrapbook").click # } # rescue TimeoutError # puts "Looks like this is working ...I am on my way :-)\n" # end end exit