Class: Watir::WhenPresentDecorator
- Inherits:
-
Object
- Object
- Watir::WhenPresentDecorator
- 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)
-
- (WhenPresentDecorator) initialize(element, timeout, message = nil)
constructor
A new instance of WhenPresentDecorator.
- - (Object) method_missing(m, *args, &block)
- - (Boolean) respond_to?(*args)
Constructor Details
- (WhenPresentDecorator) initialize(element, timeout, message = nil)
A new instance of WhenPresentDecorator
69 70 71 72 73 |
# File 'lib/watir-webdriver/wait.rb', line 69 def initialize(element, timeout, = nil) @element = element @timeout = timeout @message = end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
- (Object) method_missing(m, *args, &block)
79 80 81 82 83 84 85 86 87 |
# File 'lib/watir-webdriver/wait.rb', line 79 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
- (Boolean) respond_to?(*args)
75 76 77 |
# File 'lib/watir-webdriver/wait.rb', line 75 def respond_to?(*args) @element.respond_to?(*args) end |