Hi,
I feel lucky to get a chance to work with Watir (Web Application Testing in Ruby).
Watir use for automating web testing , you can easily open browser and do all things as you do yourself with website like type,click,submit etc...
Its a very easy to use if you already know ruby. Yeah its not only for ruby people
its also available for .Net and java, For .Net its Watin and for java its Watij.
Installation:
- For windows :
gem install watir
- For linux :
1. sudo gem install firewatir
2. Install JSSH extension for firefox.
For more Details on watir Installation go to http://watir.com/installation/
I Do not want to give you whole explanation because its already given with its doc.
Here I Just want to show simple example which helpful you to start with watir.
Example For IE:
require 'rubygems'
require 'watir'
require 'watir/ie'
ie = Watir::IE.new
puts "open google.com\n"
ie.goto('google.com')
ie.text_field(:name,"q").set "hello world"
ie.button(:name,"btnG").click
if ie.text.include? "hello world"
puts " Yeah hello world Found"
else
puts " Sorry No Result Found !"
end
ie.close
Example for FireFox :
(need to install jssh extension)
require 'rubygems'
require 'firewatir'
ff = FireWatir::Firefox.new
puts "open google.com\n"
ff.goto('google.com')
ff.text_field(:name,"q").set "hello world"
ff.button(:name,"btnG").click
if ff.text.include? "hello world"
puts " Yeah hello world Found"
else
puts " Sorry No Result Found !"
end
ff.close
Hope this basic thing helpful to you.
For more watir example check http://watir.com/examples/
Thanks,
Priyank Shah