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
- 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.
- 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.
- 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.
- 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.
- Downloads- With watir, test file download for UI or website.
- Alerts- Watir will provide very easy to use APIs to verify alerts popup in your website.
- 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:
- Watir could even be open source tool and easy to use.
- Watir developed in ruby and internet application that performs in exceedingly browser also be very easily automated using watir.
- Main recent browsers are supported in watir making it easy for testing.
- 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.
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
- install ruby
- Install watir
- install ruby mine
- 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.
- Installation of Watir
Write gem install watir in ruby
- Install of ruby mine
Download navigate and click to next button
click installer and run as administrator.click 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.