Watir - Introduction



Watir (Web Application Testing in Ruby) pronounced as “Water” is an open source tool developed using Ruby which helps in automating web application no matter which language the application is written. Watir comes with a rich set of APIs which helps us interact with the browser, locate page elements, take screenshots, work with alerts, file downloads, window.open popup windows, headless testing, etc.

The browsers supported are −

  • Internet Explorer
  • Firefox
  • Chrome
  • Safari
  • Edge

Note − Watir is available as Rubygems gem for installation.

Using Watir webdriver, you can test your websites and UI applications. As Watir fully focuses on the browser related stuff, you can use Watir along with other test framework such as −

  • RSpec
  • Cucumber

The main testing code will be written using the test framework and interacting with the browser will be done with the help of Watir.

The flow of test framework along with Watir is as shown below −

Rubygems

RSpec or Cucumber are involved in test runner and test code. The details about the website or UI testing can be broken down into page object which will have reference to Watir, wherein it will get the page locators to be used for testing. Watir, along with its webdriver, helps in connecting to the browser and carry out the test automation.

Advertisements