rubywatirwatir-webdriver

Making sure I have a timeout set while using watir to wait for page load


in watir I want to use browser.wait() to make sure I've waited until a page is loaded. But, what if the page is never going to load or is just taking a long time. I want to set a timeout. Do I do this with something like browser.wait(8), specifying the number of seconds for a timeout?


Solution

  • As an update, Watir now deprecates a timeout value in favor of a timeout keyword, like so:

    Watir::Wait.until(timeout: 60) { browser.text.include? 'Hello' }