What Is Watir?

WATIR is an acronym for Web Application Testing In Ruby and is pronounced the same as the word ‘water’, it is a simple and flexible tool. It is an open-source family of Ruby libraries for automating web browser testing, and the Watir WebDriver (the modern version of the Selenium based Watir API), it drives/supports Internet Explorer, Firefox, Chrome, Opera and Safari browsers. It is a simple and flexible tool and facilitates the writing of automated tests which are easy to both read and maintain.

It interacts with a browser the same way a person or a manual tester would do, in effect it mimics a real person, it logs in, clicks on links, fills in forms, validates text and so on.

It also runs in headless mode (HTMLUnit).

What Is Watir Selenium?

The Watir testing an open-source web application testing framework and is designed to make writing Selenium tests simple and efficient. It is built on Selenium's Ruby language bindings and (as mentioned earlier) is designed to ‘drive the browser’ in the same way that a manual tester or a real user would. With all the features that Selenium has to offer, Watir Selenium can be described as awesome.

How to Set Watir Up?

If you are new to Watir, and you would like to set watir up from scratch, you have come to the right place:-

Install Selenium, next install a few necessary Selenium Libraries using Gem (gem install selenium-webdriver). Then install Watir (gem install watir-webdriver). Next install Rest-Client (gem install rest-client), then install Test-Unit, then finally use Test-Unit to carry out functional unit tests on the platform.

What Is the Difference Between Selenium vs Watir?

Selenium can be described as "Web Browser Automation"; it automates browsers. It is primarily for automating web applications for testing purposes, but will do other things as well, e.g. web-based administration tasks can be automated. In comparison, Watir is sometimes described as "Selenium abstraction in ruby". It is pronounced water, is an open-source (BSD- the name comes from Berkeley Software Distribution) and uses Ruby libraries to automate web browsers. Because of Ruby, tests are easy to write and they are easy to read and maintain.

A Brief History of Watir?

In 2001 Chris Morris wrote Ruby code to control Internet Explorer through its COM interface, the called it cliec. In 2003 Bret Pettichord and Brian Marick began using this code in a course they were teaching. Inspired by this course, Paul Rogers created his own library and called it Web Testing in Ruby

In 2004, Paul and Bret took the best parts of Web Testing In Ruby and cliec and created a cleaner API using TDD principles; this was WATIR.

What Is Watir-classic?

Watir-classic directly drives the browser through the Object Linking and Embedding (OLE) protocol which makes it a useful tool. It uses the fact that Ruby has built in (OLE) capabilities. Because of this it is possible to drive Internet Explorer programmatically.

Watir-classic operates differently than HTTP based test tools, and it directly drives the browser through the OLE protocol, which is implemented over the Component Object Model (COM) architecture.

Safeguard Your Brand With Outsourced Software Testing Services
An unhandled exception has occurred. See browser dev tools for details. Reload 🗙