Sunday, 15 June 2014

automation - watir-webdriver reload when page fails to load -



automation - watir-webdriver reload when page fails to load -

i'm automating process involves loading many pages , copying form field values pages other pages.

occasionally, page fail load initially, reload. there built-in mechanism getting watir-webdriver this?. note i'm not asking same question this: how deal page fails load , go on testing in watir-webdriver

in case, i'm not trying move on after failure. wrapping click actions in begin/rescue reload within rescue work, i'm wondering if there's built-in solution problem.

i don't think there built in mechanism this, this.

create retriable block method takes block. maybe like:

require 'timeout' def retriable(num_retries = 0, timeout = 5, &block) timeout.timeout(timeout) block.call end rescue timeout::error => e if num_retries <= 0 raise e else puts "request timed out. trying #{num_retries} more times" num_retries -= 1 retry end end

use in code:

retries = 3 timeout_before_retry = 10 # seconds retriable(retries, timeout_before_retry) browser.goto("http://google.com") end

automation watir-webdriver

No comments:

Post a Comment