Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><em>Update</em>: This monkey patch has been merged into watir-webdriver and so will no longer be needed in watir-webdriver v0.6.5. You will be able to set the timeout using:</p> <pre><code>Watir.default_timeout = 90 </code></pre> <hr> <p>The <a href="https://github.com/watir/watir-webdriver/blob/master/lib/watir-webdriver/wait.rb">wait methods</a> are defined similar to:</p> <pre><code>def when_present(timeout = 30) message = "waiting for #{selector_string} to become present" if block_given? Watir::Wait.until(timeout, message) { present? } yield self else WhenPresentDecorator.new(self, timeout, message) end end </code></pre> <p>As you can see, the default timeout of 30 seconds is hard-coded. Therefore, there is no easy way to change it everywhere.</p> <p>However, you could monkey patch the wait methods to use a default time and set it to what you want. The following monkey patch will set the default timeout to 90 seconds.</p> <pre><code>require 'watir-webdriver' module Watir # Can be changed within a script with Watir.default_wait_time = 30 @default_wait_time = 90 class &lt;&lt; self attr_accessor :default_wait_time end module Wait class &lt;&lt; self alias old_until until def until(timeout = Watir.default_wait_time, message = nil, &amp;block) old_until(timeout, message, &amp;block) end alias old_while while def while(timeout = Watir.default_wait_time, message = nil, &amp;block) old_while(timeout, message, &amp;block) end end # self end # Wait module EventuallyPresent alias old_when_present when_present def when_present(timeout = Watir.default_wait_time, &amp;block) old_when_present(timeout, &amp;block) end alias old_wait_until_present wait_until_present def wait_until_present(timeout = Watir.default_wait_time) old_wait_until_present(timeout) end alias old_wait_while_present wait_while_present def wait_while_present(timeout = Watir.default_wait_time) old_wait_while_present(timeout) end end # EventuallyPresent end # Watir </code></pre> <p>Include the patch after the watir webdriver code is loaded.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload