Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
73 lines (43 sloc) 1.89 KB

Watir Classic

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 and Safari on Mac.

Project Home

Source Code




You have to install Ruby and RubyGems first.

gem update --system
gem install watir-classic

Detailed installation instructions are at


Some examples from

Loading Watir gem to drive Internet Explorer on Windows

require 'watir-classic'

Starting a new browser & and going to our site

browser =

Setting a text field

browser.text_field(:name => "entry.0.single").set "Watir"

Setting a multi-line text box

browser.text_field(:name => "entry.1.single").set "I come here from Australia. \n The weather is great here."

Setting and clearing a radio button => "Watir").set => "Watir").clear

Setting and clearing check boxes

browser.checkbox(:value => "Ruby").set
browser.checkbox(:value => "Python").set
browser.checkbox(:value => "Python").clear

Clicking a button

browser.button(:name => "logon").click

Clearing, getting and selecting selection list values

browser.select_list(:name => "entry.6.single").clear
puts browser.select_list(:name => "entry.6.single").options
browser.select_list(:name => "entry.6.single").select "Chrome"

Clicking a button

browser.button(:name => "submit").click

Checking for text in a page

puts browser.text.include?("Your response has been recorded.")

Checking the title of a page

puts browser.title == "Thanks!"
Jump to Line
Something went wrong with that request. Please try again.