Stop Loading Page Watir-Webdriver

Stop loading page watir-webdriver

You can use the Timeout class to force it to give up after waiting a reasonable amount of time (and this is internally how Watir performs it's waits as well)

begin
Timeout::timeout(10) do
# perform actions that may hang here
end
rescue Timeout::Error => msg
put "Recovered from Timeout"
end

Watir Webdriver : How can I disable loading ads using watir

This isn't really watir-related, but you could set the ad-host URL to 127.0.0.0 in your hosts file. This would cause those ads to resolve instantly the host and the ads to never load.

Windows:

  • windows/system32/drivers/etc/hosts

OSX:

  • /private/etc/hosts

    ads.advertiserswebhost.com 127.0.0.0

How to deal with a page which fails to load and continue testing in Watir-Webdriver

I am not sure how would you test a page that did not load, but try something like this:

begin
browser.goto "http://www.mycounciltax.org.uk/results?postcode=WC1N1DF&search=Search"
rescue => e
puts "rescued #{e}"
end


Related Topics



Leave a reply



Submit