Module: Watir::EventuallyPresent
Overview
Convenience methods for things that eventually become present.
Includers should implement a public #present? and a (possibly private) #selector_string method.
Instance Method Summary collapse
-
#wait_until_present(timeout = 30) ⇒ Object
Waits until the element is present.
-
#wait_while_present(timeout = 30) ⇒ Object
Waits while the element is present.
-
#when_present(timeout = 30) ⇒ Object
Waits until the element is present.
Instance Method Details
#wait_until_present(timeout = 30) ⇒ Object
Waits until the element is present.
148 149 150 151 |
# File 'lib/watir-webdriver/wait.rb', line 148 def wait_until_present(timeout = 30) = "waiting for #{selector_string} to become present" Watir::Wait.until(timeout, ) { present? } end |
#wait_while_present(timeout = 30) ⇒ Object
Waits while the element is present.
165 166 167 168 169 170 |
# File 'lib/watir-webdriver/wait.rb', line 165 def wait_while_present(timeout = 30) = "waiting for #{selector_string} to disappear" Watir::Wait.while(timeout, ) { present? } rescue Selenium::WebDriver::Error::ObsoleteElementError # it's not present end |
#when_present(timeout = 30) ⇒ Object
Waits until the element is present.
125 126 127 128 129 130 131 132 133 134 |
# File 'lib/watir-webdriver/wait.rb', line 125 def when_present(timeout = 30) = "waiting for #{selector_string} to become present" if block_given? Watir::Wait.until(timeout, ) { present? } yield self else WhenPresentDecorator.new(self, timeout, ) end end |