Class: Watir::Element
- Inherits:
-
Object
- Object
- Watir::Element
- Defined in:
- lib/watir/dom/elements/element.rb
Instance Method Summary collapse
-
#wait_until_dom_changed(opts = {}) ⇒ Object
Waits until DOM is changed within the element.
-
#when_dom_changed(opts = {}) ⇒ Object
Waits until DOM is changed within the element and returns/yields self.
Instance Method Details
#wait_until_dom_changed(opts = {}) ⇒ Object
Waits until DOM is changed within the element.
58 59 60 61 62 |
# File 'lib/watir/dom/elements/element.rb', line 58 def wait_until_dom_changed(opts = {}) when_dom_changed(opts) do # just trigger waiting end end |
#when_dom_changed(opts = {}) ⇒ Object
Waits until DOM is changed within the element and returns/yields self.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/watir/dom/elements/element.rb', line 30 def when_dom_changed(opts = {}) = "waiting for DOM subtree to finish modifying in #{selector_string}" opts[:timeout] ||= Dom::Wait.timeout opts[:interval] ||= Dom::Wait.interval opts[:delay] ||= Dom::Wait.delay if block_given? js = Dom::Wait::JAVASCRIPT.dup browser.execute_script js, self, opts[:interval], opts[:delay] Wait.until(opts[:timeout], ) { browser.execute_script(Dom::Wait::DOM_READY) == 0 } yield self else WhenDOMChangedDecorator.new(self, opts, ) end rescue Selenium::WebDriver::Error::StaleElementReferenceError locate end |