Skip to content
Watir extension providing with DOM-based waiting
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
spec
.gitignore
.travis.yml
Gemfile
LICENSE.txt
README.md
Rakefile
watir-dom-wait.gemspec

README.md

watir-dom-wait Build Status Gem Version

Watir extension which provides with method to check for DOM changes.

Installation

Add this line to your application's Gemfile:

gem 'watir-dom-wait'

And then execute:

$ bundle

Or install it yourself as:

$ gem install watir-dom-wait

Usage

Require to monkey patch Watir::Element instance:

require 'watir-dom-wait'

There is only one method added:

browser.div(class: 'test').dom_changed?

which returns true if DOM is changed inside element or false if DOM is currently changing.

Default delay of waiting until DOM starts changing is 1.1 seconds, but can be changed:

browser.div(class: 'test').dom_changed?(delay: 2.5)

You probably don't want to use the method directly. Instead, you can combine usage of the method with built-in Watir waiting mechanism:

browser.div(class: 'test').wait_until(&:dom_changed?)

How it works

Using MutationObserver.

Contributors

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
You can’t perform that action at this time.