Class: Watir::WhenPresentDecorator
- Inherits:
-
Object
- Object
- Watir::WhenPresentDecorator
- Extended by:
- Forwardable
- Defined in:
- lib/watir-webdriver/wait.rb
Overview
Wraps an Element so that any subsequent method calls are put on hold until the element is present (exists and is visible) on the page.
Instance Method Summary collapse
-
#initialize(element, timeout, message = nil) ⇒ WhenPresentDecorator
constructor
A new instance of WhenPresentDecorator.
- #method_missing(m, *args, &block) ⇒ Object
- #respond_to?(*args) ⇒ Boolean
Constructor Details
#initialize(element, timeout, message = nil) ⇒ WhenPresentDecorator
Returns a new instance of WhenPresentDecorator.
104 105 106 107 108 |
# File 'lib/watir-webdriver/wait.rb', line 104 def initialize(element, timeout, = nil) @element = element @timeout = timeout @message = end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
114 115 116 117 118 119 120 121 122 |
# File 'lib/watir-webdriver/wait.rb', line 114 def method_missing(m, *args, &block) unless @element.respond_to?(m) raise NoMethodError, "undefined method `#{m}' for #{@element.inspect}:#{@element.class}" end Watir::Wait.until(@timeout, @message) { @element.present? } @element.__send__(m, *args, &block) end |
Instance Method Details
#respond_to?(*args) ⇒ Boolean
110 111 112 |
# File 'lib/watir-webdriver/wait.rb', line 110 def respond_to?(*args) @element.respond_to?(*args) end |