Module: Watir::Wait
- Defined in:
- lib/watir/wait.rb,
lib/watir/wait/timer.rb
Defined Under Namespace
Classes: TimeoutError, Timer
Constant Summary collapse
- INTERVAL =
0.1
Class Attribute Summary collapse
-
.timer ⇒ #wait
Access Watir timer implementation in use.
Class Method Summary collapse
-
.until(timeout: nil, message: nil, interval: nil, object: nil) ⇒ Object
Waits until the block evaluates to true or times out.
-
.while(timeout: nil, message: nil, interval: nil, object: nil) ⇒ Object
Wait while the block evaluates to true or times out.
Class Attribute Details
.timer ⇒ #wait
Access Watir timer implementation in use.
19 |
# File 'lib/watir/wait.rb', line 19 attr_writer :timer |
Class Method Details
.until(timeout: nil, message: nil, interval: nil, object: nil) ⇒ Object
Waits until the block evaluates to true or times out.
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, (timeout, object, ) end |
.while(timeout: nil, message: nil, interval: nil, object: nil) ⇒ Object
Wait while the block evaluates to true or times out.
58 59 60 61 62 |
# File 'lib/watir/wait.rb', line 58 def while(timeout: nil, message: nil, interval: nil, object: nil) timeout ||= Watir.default_timeout run_with_timer(timeout, interval) { return unless yield(object) } raise TimeoutError, (timeout, object, ) end |