watir-ng
Identify watir-webdriver elements with AngularJS ng directives.
Usage
When identifying elements, use the ng
directives like you would id
, class
, etc. Be sure to use underscores instead of dashes though!
As of version 2.1.0
, this gem requires Ruby >= 2.0.
# To find and click this HTML element:
# <button ng-click="foo">Submit</button>
submit_button = @browser.button(ng_click: "foo")
submit_button.click
To ensure your browser objects have access to the ng identifiers, run patch!
before instantiating.
require 'watir-ng'
WatirNg.patch!
@browser = Watir::Browser.new
You can identify elements with custom directives by registering them before patching the browser.
require 'watir-ng'
WatirNg.register(:ng_foo, :ng_bar).patch!
@browser = Watir::Browser.new
Installation
Add this line to your application's Gemfile:
gem 'watir-ng'
And then execute:
$ bundle
Or install it yourself with:
$ gem install watir-ng
Contributing
- Fork it ( http://github.com/jdenen/watir-ng/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Questions, Comments, Concerns
Find me on Twitter (@metaxjohnson), gitter (@jdenen), or write up an issue.