About this Utility:
This is a utility(watir_helper) developed for making Automation Testing faster, simpler and easier through WATIR.
Features:-
-
No need to create an IE Instance.
-
Just include this gem and use it’s parameterized functions some of which are given as follows:-
# goto_page("http://www.google.com") # set_texfield("name","q","Ruby") # click_button("name","btnG") # verify_text("Ruby") # close_browser()
Due to this feature Automation Testing task will be easier and faster because we have to just use the functions of this gem.
-
All the functions are available in the lib/watir_helper folder for different type of elements of a website.
-
Pop-up handling is easy using given parameterized functions in this gem.
-
To enable the Pop-up handling, execute the following steps on your command prompt :-
-
cd C:rubylibrubygems1.8gemswatir-1.6.2libwatir
-
regsvr32 AutoItX3.dll
-
You will get a pop-up of successful registration , press “OK” button on it.
Now, You can easily handle pop-up’s.
-
-
Can add functions into this gem as WATIR is an Open Source tool.
Prerequisites:
Install Ruby: ruby-lang.org
First you need to install Ruby using the one-click installer for Windows. We
recommend Ruby 1.8.6. (Even if you are using modal dialogs.)
Install Watir:
Watir is packaged as a gem, a Ruby library that can be installed over the
internet.
Note:
The latest version of Watir is 1.6.5 whose close function doesn't work fine if we handle pop-up's in our scripts.But close function of Watir 1.6.2 works fine with pop-up handling.Watir 1.6.2 was released in November 2009.
To install it, type this at command prompt:
gem install watir (for latest version)
gem install watir
-v 1.6.2 (for version 1.6.2)
Install rspec:
gem install rspec (This will download the latest version)
gem install rspec -v 1.1.3 (This version is also needed because of some compatibility issue)
Install rake:
gem install rake
Install IE Devleoper Toolbar from the site
http://www.microsoft.com/downloads/details.aspx?familyid=e59c3964-672d-4511-bb3e-2d5e1db91038&displaylang=en
How
To Use:
This only works on Windows.Requires Internet Explorer 5.5 or newer.
Typical Usage
# include my utility(watir_helper)
require 'watir_helper'
# include the module inside it
include WatirHelper
# Go to the Google home page
goto_page("http://www.google.com/")
# print Title
puts get_title
# print Url
puts get_url
# Flash the Google logo on the home page
flash_image("id","logo")
# Check whether Google logo image exists or not
puts exists_image("id","logo")
# Set the search field to Ruby
set_textfield("name","q","Ruby")
# Highlight the Google Search button
("value","Google Search")
# Click the Google Search button
("value","Google Search")
Pop Up’s Support
:-
Watir now optionally installs AutoIt - http://www.autoitscript.com/
This is the prefered method for dealing wth pop ups, file requesters etc.
To enable the same, execute the following steps on your command prompt :-
- cd C:\ruby\lib\ruby\gems\1.8\gems\watir-1.6.2\lib\watir
- regsvr32 AutoItX3.dll
- You will get a pop-up of successful registration , press "OK" button on it.
Now,You can easily handle pop-up's.
Note: The latest version of Watir is 1.6.5 whose close function doesn't work fine if we handle pop-up's in our scripts.But close function of Watir 1.6.2 works fine with pop-up handling.
Contacts:
The mailing list: http://groups.google.com/group/watir-general
E-mail :- [email protected]
[email protected]
Contributors:
Ankur Gera
Yashasree Barve
Thanks for your ideas and support .