Watir (Web Application Testing in Ruby)

Watir is by far my preferred tool for testing web applications.

From watir.com:

Watir is… An open source Ruby library for automating tests. Watir interacts with a browser the same way people do: clicking links, filling out forms and validating text.

From Wikipedia:

Watir-webdriver is a modern version of the Watir API based on Selenium. Selenium 2.0 (selenium-webdriver) aims to be the reference implementation of the WebDriver specification. In Ruby, Jari Bakken has implemented the Watir API as a wrapper around the Selenium 2.0 API. Not only is Watir-webdriver derived from Selenium 2.0, it is also built from the HTML specification, so Watir-webdriver should always be compatible with existing W3C specifications.

Watir is available as a Ruby gem.

And of course because it’s Ruby, it’s fun!

1 Like

I built my first web testing framework in WATiR Webdriver. I had to drop it when they dropped Firefox support, but I assume that’s back now. I always loved coding that framework.

1 Like

Watir:

The full form of Watir is “Web Application Testing in Ruby” and pronounced as "Water. It is an open source tool developed using Ruby which helps in automating web application no matter which language the application is written. Watir is available as Rubygems for installation. This also includes set of APIs which helps us interact with the browser, locate page elements, window.open popup windows, headless testing, take screenshots, work with alerts, file downloads etc.

The following browsers are supported −
Internet Explorer
Firefox
Chrome
Safari
Edge

Watir will connect to the browser given and follows up the instructions of opening the URL, clicking on the button, entering data inside a textbox just as any real person will do.
Watir webdriver is used as web application testing tool to test our websites and UI. As it is fully focuses on the browser related stuff, so we can use Watir along with other test framework such as −
RSpec
Cucumber

It helps to write the main testing code using the test framework and to interact with the browser.
The flow of test framework along with Watir is as shown below −
Test runner > Test code > Page object code > Watir library >Browser connection

Advantages of Using Watir:
Watir is an open source tool and very easy to use.
Watir is developed in Ruby and any web application that works in a browser can be easily automated using watir.
All the latest browsers are supported in Watir making it easy for testing.
Watir has inbuilt libraries to test page-performance, alerts, iframes test, browser windows, take screenshots etc.

Disadvantages of Watir:
Watir is supported only for Ruby test framework and it cannot be used with any other testing frameworks.
Mobile testing using Watir is not enhanced and desktop browsers are mimicked to behave like mobile browsers instead of acting as real time devices.

1 Like