Class: Watir::WhenPresentAfterRefreshDecorator
- Inherits:
-
Object
- Object
- Watir::WhenPresentAfterRefreshDecorator
- Defined in:
- lib/watir/wait_with_refresh/element.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) ⇒ WhenPresentAfterRefreshDecorator
constructor
A new instance of WhenPresentAfterRefreshDecorator.
- #method_missing(m, *args, &block) ⇒ Object
- #respond_to?(*args) ⇒ Boolean
Constructor Details
#initialize(element, timeout, message = nil) ⇒ WhenPresentAfterRefreshDecorator
Returns a new instance of WhenPresentAfterRefreshDecorator.
72 73 74 75 76 |
# File 'lib/watir/wait_with_refresh/element.rb', line 72 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
82 83 84 85 86 87 88 89 90 |
# File 'lib/watir/wait_with_refresh/element.rb', line 82 def method_missing(m, *args, &block) unless @element.respond_to?(m) raise NoMethodError, "undefined method `#{m}' for #{@element.inspect}:#{@element.class}" end Watir::WaitWithRefresh.refresh_until(@element.browser, @timeout, @message) { @element.present? } @element.__send__(m, *args, &block) end |
Instance Method Details
#respond_to?(*args) ⇒ Boolean
78 79 80 |
# File 'lib/watir/wait_with_refresh/element.rb', line 78 def respond_to?(*args) @element.respond_to?(*args) end |