/watir

Watir Powered By Selenium

Primary LanguageRubyMIT LicenseMIT

watir

Watir Powered By Selenium!

Gem Version Travis Status AppVeyor status Code Climate Dependency Status Coverage Status

Example

require 'watir'

browser = Watir::Browser.new
browser.goto 'google.com'
browser.text_field(title: 'Search').set 'Hello World!'
browser.button(type: 'submit').click

puts browser.title
# => 'Hello World! - Google Search'
browser.close

Description

The majority of element methods Watir provides with is autogenerated from specifications. This is done by extracting the IDL parts from the spec and processing them with the WebIDL gem (link below). Currently supported specifications are:

  • HTML (lib/watir/elements/html_generated.rb)
  • SVG (lib/watir/elements/svg_generated.rb)

Specs

WatirSpec

Watir uses WatirSpec for testing - an executable specification of Watir API.

Using In Other Gems

When developing Watir extension, you might want to make sure it's fully compatible with existing API. To achieve that, you can run WatirSpec against your own extension. Assuming your gem depends on Watir, you should do next:

First, add WatirSpec Rake tasks to your gem:

# Rakefile
require 'watirspec/rake_tasks'
WatirSpec::RakeTasks.new

Second, initialize WatirSpec for your gem:

$ bundle exec rake watirspec:init

After initialized, just follow the instructions to customize Watir implementation in use.

Watir-specific Specs

Specs specific to Watir are found in spec/*_spec.rb, with watirspec in spec/watirspec/.

Doctests

Watir uses yard-doctest for testing documentation examples.

rake yard:doctest

API Documentation

See Also

Dependencies

  • selenium-webdriver
  • rack (for watirspec)

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Commit, do not mess with Rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

Copyright

Copyright (c) 2009-2015 Jari Bakken Copyright (c) 2015-2017 Alex Rodionov, Titus Fortner See LICENSE for details