Module: Vapir::Waiter::WaitUntil

Included in:
Vapir, Vapir, Browser, Browser, Vapir::Waiter, Vapir::Waiter
Defined in:
lib/vapir-common/waiter.rb

Instance Method Summary collapse

Instance Method Details

#wait_until(timeout = ::Vapir::Waiter.send(:class_variable_get, '@@default_timeout'), polling_interval = ::Vapir::Waiter.send(:class_variable_get, '@@default_polling_interval'), &block) ⇒ Object

Execute the provided block until either (1) it returns true, or (2) the timeout (in seconds) has been reached. If the timeout is reached, a TimeOutException will be raised. The block will always execute at least once.

waiter = Waiter.new(5) waiter.wait_until ‘hello’

This code will print out “hello” for five seconds, and then raise a Vapir::TimeOutException.



32
33
34
# File 'lib/vapir-common/waiter.rb', line 32

def wait_until(timeout=::Vapir::Waiter.send(:class_variable_get, '@@default_timeout'), polling_interval=::Vapir::Waiter.send(:class_variable_get, '@@default_polling_interval'), &block)
  ::Waiter.try_for(timeout, :interval => polling_interval, &block)
end