Class: Watir::Element
- Inherits:
-
Object
- Object
- Watir::Element
- Defined in:
- lib/watir/dom/elements/element.rb
Constant Summary collapse
- DOM_WAIT_JS =
File.read("#{File.dirname(__FILE__)}/../extensions/js/waitForDom.js").freeze
Instance Method Summary collapse
-
#dom_changed?(delay: 1.1) ⇒ Boolean
Returns true if DOM is changed within the element.
Instance Method Details
#dom_changed?(delay: 1.1) ⇒ Boolean
Returns true if DOM is changed within the element.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/watir/dom/elements/element.rb', line 19 def dom_changed?(delay: 1.1) element_call do begin script_timeout = driver.manage.timeouts.script_timeout driver.manage.timeouts.script_timeout = delay + Watir::DOM::Wait.minimum_script_timeout driver.execute_async_script(DOM_WAIT_JS, wd, delay) rescue Selenium::WebDriver::Error::JavascriptError => error # sometimes we start script execution before new page is loaded and # in rare cases ChromeDriver throws this error, we just swallow it and retry retry if error..include?('document unloaded while waiting for result') raise ensure driver.manage.timeouts.script_timeout = script_timeout end end end |