Web App Testing In Ruby using RUBY

Hi folks, Today I’m going to explain how to test the web apps using the testing frame work WATIR in Ruby. WATIR is a free open source tool , WATIR pronounced water, is an open-source (BSD) family of Ruby libraries for automating web browsers. It supports your app no matter what technology it is developed in. They support Internet Explorer on Windows, Firefox and Chrome on Windows, Mac and Linux.fOR MORE INFO VISIT http://watir.com/

Currently supported drivers are:

Below are the steps for installing & getting started for WATIR.

  • Add it into your Gemfile
    gem "watir"

    Or install it manually with the following command:

    gem install watir

    Then in your test file:

    require "watir"
    browser = Watir::Browser.new
  • To know path of web elements , we need to install HTML Inspector
  • On Firefox, use Firebug
    • On Internet Explorer, use the IE Developer Toolbar
      To use Watir effectively, you’ll need to be able to browse through the structure of your application’s HTML pages. These tools help you do that.
  • Now open a text file and add the below code
  •  Now save the file with an extension of .rb , now go to the terminal and go to the file path. Type ruby Filename.rb and press enter.Now web browser is initiated and opens the google web page.




Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s