Module: Watir::ElementExtensions
Overview
This module adds some helper methods for asynchronous testing.
Instance Method Summary collapse
-
#present? ⇒ Boolean
True when element exists and is visible, false otherwise.
-
#wait_until_present(timeout = 60) ⇒ Object
Wait until element is present before continuing.
-
#wait_while_present(timeout = 60) ⇒ Object
Wait while element is present before continuing.
-
#when_present(timeout = 60) ⇒ Object
Waits until the element is present before calling its methods.
Instance Method Details
#present? ⇒ Boolean
Returns true when element exists and is visible, false otherwise.
31 32 33 |
# File 'lib/watir-classic/element_extensions.rb', line 31 def present? exists? && visible? rescue false end |
#wait_until_present(timeout = 60) ⇒ Object
Wait until element is present before continuing.
62 63 64 |
# File 'lib/watir-classic/element_extensions.rb', line 62 def wait_until_present(timeout = 60) Watir::Wait.until(timeout) { self.present? } end |
#wait_while_present(timeout = 60) ⇒ Object
Wait while element is present before continuing.
70 71 72 |
# File 'lib/watir-classic/element_extensions.rb', line 70 def wait_while_present(timeout = 60) Watir::Wait.while(timeout) { self.present? } end |
#when_present(timeout = 60) ⇒ Object
Waits until the element is present before calling its methods.
49 50 51 52 53 54 55 56 |
# File 'lib/watir-classic/element_extensions.rb', line 49 def when_present(timeout = 60) if block_given? Watir::Wait.until(timeout) { self.present? } yield self else return WhenPresentDecorator.new(self, timeout) end end |