Method: Watir::Wait.until

Defined in:
lib/watir/wait.rb

.until(timeout: nil, message: nil, interval: nil, object: nil) ⇒ Object

Waits until the block evaluates to true or times out.

Examples:

Watir::Wait.until { browser.text_field(name: "new_user_first_name").visible? }

Parameters:

  • timeout (Integer) (defaults to: nil)

    How long to wait in seconds

  • message (String) (defaults to: nil)

    Message to raise if timeout is exceeded

  • object (Object, NilClass) (defaults to: nil)

    Object to evaluate block against

Raises:



37
38
39
40
41
42
43
44
# File 'lib/watir/wait.rb', line 37

def until(timeout: nil, message: nil, interval: nil, object: nil)
  timeout ||= Watir.default_timeout
  run_with_timer(timeout, interval) do
    result = yield(object)
    return result if result
  end
  raise TimeoutError, message_for(timeout, object, message)
end