All IT Courses 50% Off
QA Tutorials

Watir Tutorial: Getting Started with Watir

Watir is well known net application software testing in Ruby where it’s mentioned as ‘water’ which is an open-source tool developed using Ruby which helps in automating web applications no matter which language the appliance software is written. The browsers are supported like  Firefox, Chrome, safari. Watir is available as ruby gems gem installation.

Features of Watir

Watir is rich in features

  1. Location of web elements- We have alternative routes where we may able to locate web elements rendered inside the browser. Mostly used are id, tag name, custom attributes and label.
  1. Taking screenshots- Watir allows us to induce the screenshot of testing once it’s finished as and when required. This assists to count of the intermediate testing.
  1. Page Performance- we are able to measure easily page performance using performance object which has which has properties like performance.navigation, performance.timing, performance.memory, performance.origin. These details are mainly aware to link to the browser.
  1. Page Objects- Page objects in Watir assists to use code again within the sort of classes. This feature, we get automatically our app without having to duplicate any code and also make it manageable.
  1. Downloads- With watir,  test file download for UI or website.
  1. Alerts- Watir will provide very easy to use APIs to verify alerts popup in your website.
  1. Headless testing- Using this various style of testing where the information are obtained within the command line interface without having to open the browser. This helps to execute UI test instructions in command line interface.

Advantages of Watir:

  1. Watir could even be open source tool and  easy to use.
  2. Watir  developed in ruby  and internet application that performs in exceedingly browser also be  very easily automated using watir.
  3. Main recent browsers are supported in watir making it easy for testing.
  4. This has internal libraries to track the performance, alerts, iframes test, browser windows, take  screenshots.

Disadvantages are

  • Watir assisted for Ruby test framework and it’ll not be used with other testing frameworks.
  • Mobile testing using watir isn’t helping desktop browsers rather are mimicked to behave like mobile browsers as of acting real time devices.

Watir is present as Rubygems, a gem for installation. When we use Watir webdriver we are able to use our websites and UI applications. Watir notices on the browser stuff, we use Watir together with other test frameworks like

  • Rspec
  • Cucumber

Testing code is written using the testing framework and by interacting with the browser to complete along with Watir.

All IT Courses 50% Off

The series test framework together with Watir is as shown


Rspec or cucumber includes in the test runner and test code. The information of website or UI testing are softened down into page object which is in a position with connection to Watir, also it’ll get the page locators used for testing. It supports connecting within the browser and doing out test automation. 

Installation of Watir:

It includes three process

  1. install ruby
  2. Install watir
  3. install ruby mine
  1. Install ruby- Goto rubyinstallers page. Click on most latest version with DEVKIT and download it.

once the download is completed right click run as administrator.

To verify the installation enter the command ruby-version in transmission that’s  prompted and so irb command it’s called as interactive ruby shell.

  1. Installation of Watir

Write gem install watir in ruby

  1. Install of ruby mine

Download navigate and click to next button


click installer and run as next and installation is complete

How to track the elements of Watir?

The important characteristic of Watir tools is multiple it allows users to find out the elements. The Watir location API is to be designed which is to be read easily and also understood by the users. The elements which tracks by forming the selector Hash, which the Watir will transform into potentially complicated information the driver will get to know and recognize the element.

Facebook Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Articles

Back to top button