About this gem:
This gem is developed for novice automation tester’s to write automation scripts fast as it is very easy to use.
Features:-
-
Freedom to choose the browser. Right now this gem is only tested with IE.
# ie = set_browser("ie")
-
Method name’s are simple and easy to remember. For e.g:
# require 'watir_helper' # ie1 = set_browser("ie") # goto_page(ie1, "http://www.google.com/") # close_browser(ie1) # ie2 = set_browser("ie") # goto_page(ie2, "http://rubygems.com/") # close_browser(ie2)
-
Data validations like email-id validation, date format(like mmddyyyy or ddmmyyyy) validation etc. are also incorporated.
-
For Pop-up handling, you have to just use one line named method’s of this gem. It’s that easy.
# click_ok_js_popup(“File Download”)
# click_save_saveas_popup(“Save As”, “C://Test_Data”)
-
You can add new features into this gem.
Prerequisites:
Install Ruby:
First you need to install Ruby using the one-click installer for Windows from
http://ruby-lang.org .
Install Watir:
Watir is packaged as a gem, a Ruby library that can be installed over the internet.
To install it, type this at command prompt:
gem install watir
Install rake :
gem install rake
Install IE Developer Toolbar from the site :
http://www.microsoft.com/en-in/download/details.aspx?id=18359
How To Use:
This only works on Windows. Requires Internet Explorer 5.5 or newer.
Typical Usage :
# Include the gem 'watir_helper'
require 'watir_helper'
# Set browser
ie = set_browser("ie")
# Supply Google url to goto_page
goto_page(ie, "http://www.google.com/")
# Display title of the current browser page
puts get_title(ie)
# Display url of the current browser page
puts get_url(ie)
# Flash the Google logo on the home page
flash_image(ie, "id", "logo")
# Check whether Google logo image exists or not
puts exists_image?(ie, "id", "logo")
# Set the search field to Ruby
set_textfield(ie, "name", "q", "Ruby")
# Highlight the Google Search button
flash_button(ie, "value", "Google Search")
# Click the Google Search button
click_button(ie, "value", "Google Search")
Contacts:
The mailing list: http://groups.google.com/forum/#!forum/watir_helper
E-mail :- [email protected]
Contributors:
Ankur Gera