Skip to content

Instantly share code, notes, and snippets.

Created July 18, 2012 13:06
Show Gist options
  • Select an option

  • Save anonymous/3136113 to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/3136113 to your computer and use it in GitHub Desktop.
Hej
require "watir-webdriver"
require "watir-webdriver/wait"
def wait_while_loaded
timeout = 10
browser = Watir::Browser.new :ff
browser.goto "http://test.se/CampaignControll"
browser.text_field(:name => 'j_username').set 'xxxx'
browser.text_field(:name => 'j_password').set 'xxxx'
browser.send_keys :enter
l = browser.div :class => 'loadingMask'
start_time = Time.now
l.wait_while_present(timeout)
l.wait_while_present(timeout)
l.wait_while_present(timeout)
if (Time.now - start_time)> timeout
puts "Det blev ett timeoutError"
else browser.screenshot.save("testScreenshot2.png")
end
end
wait_while_loaded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment