Installation
Watir is a family of drivers for different browsers running on several operating systems. This page provides an overview of how to install the leading drivers on several operating systems, and also how to install a HTML Inspector.
Tip: While updating RubyGems, you can use
gem update --system --no-rdoc --no-ri
instead of
gem update --system.
It will be much faster, but you will not install RDoc and ri.
Windows
Install Ruby
Install Ruby using the one-click installer for Windows. We recommend using Ruby 1.8.6-26 with Watir 1.6. More details.
Install RubyGems
Make sure you have latest rubygems version 1.3.5 or above. Type the following command at command prompt
gem -v
If the version is less than 1.3.5, install the latest version from RubyForge
Watir drivers are packaged as gems, Ruby libraries that can be installed over the internet.
Install Watir
Type these commands at a command prompt:
gem update --system
gem install watir
If you are using Windows 7 or Vista, make sure you run the above commands with Administrator privileges.
This installs drivers for both IE and Firefox (FireWatir).
Watir’s support for Firefox also requires a plugin.
- Windows plugin for Firefox 2
- Windows plugin for Firefox 3
- Windows plugin for Firefox 3.5
- Windows plugin for Firefox 3.6
If you run into trouble or are installing from behind a firewall, please see additional notes.
Mac
You can Watir on a Mac by using either FireWatir, or SafariWatir, but not Watir itself because it has IE requirements.
Check you have Ruby
Ruby is probably already installed on your machine. You can verify which version of Ruby is install by typing this command in a terminal window:
ruby -v
We recommend using Ruby 1.8.6 on all platforms.
Install Watir
To prepare Ruby for Watir installation, type this command at a command prompt:
sudo gem update --system
To install the Firefox driver:
sudo gem install firewatir
Watir’s support for Firefox also requires a plugin.
- Mac plugin for Firefox 2
- Mac plugin for Firefox 3
- Mac plugin for Firefox 3.5
- Mac plugin for Firefox 3.6
To install Safari driver, install Xcode for Mac-only Development. It is 751.1 MB and you have to be registered as an Apple Developer, but the registration is free.
Type this command at a command prompt:
sudo gem install rb-appscript
sudo gem install safariwatir
If you run into trouble or are installing from behind a firewall, please see additional notes.
Linux
Check you have Ruby & RubyGems
Ruby is probably already installed on your machine. You can verify which version of Ruby is install by typing this command in a terminal window:
ruby -v
gem -v
We recommend using Ruby 1.8.6 on all platforms. If any of above command results in error, please install ruby and ruby gems using the following commands:
sudo apt-get install ruby
sudo apt-get install rubygems
Install Watir
Type these commands at a command prompt:
sudo gem update --system
sudo gem install firewatir
Watir’s support for Firefox also requires a plugin.
- Linux plugin for Firefox 2
- Linux plugin for Firefox 3
- Linux plugin for Firefox 3.5
- Linux plugin for Firefox 3.6
If you run into trouble or are installing from behind a firewall, please see additional notes.
Install an HTML inspector
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.
- On Firefox, use Firebug
- On Internet Explorer, use the IE Developer Toolbar
TroubleShooting
Visit the following links for having trouble with installation:
Trackbacks
- Watir Powered LoadRunner Scripts « Altentee | Performance & Test Automation Specialists
- Unit testing in Watir – marthijn.
- Using WATIR for Browser Based Testing « Rails, etc.
- Creative QA
- Tweets that mention Installation « Watir -- Topsy.com
- WTANZ 07 – Web page automation with Ruby / Watir « RamsThoughts
- WTANZ07: Watir basics « testkeis









thank you it helps alot for me while learning watir…
fantastic tool for automation, i just loved it. thanks a lot
HI Aniket,
I am new to Watir tool, I need to implement for the upcoming project.
Please provide me some documentation to start with the tool.
Regards
Sunil Sharma
You are at the right place. Browse this site.
These commands require the command prompt to be run as Administrator in Windows 7:
gem update –system
gem install watir
Thanks. We’ve updated the instructions.
A small adjustement to install process :
With Ruby 1.8.6, you have ruby gems 0.9.4, so “gem update –system” doesn’t work, you have to type “gem update”.
Thanks. You should update to the latest version of rubygems to work with the latest version of Watir: http://tinyurl.com/yg6wgsf
By the way, my advice is not a good one : “gem update” doesn’t make any error, but it doesn’t update to the latest version of rubygems either…
It looks like manual update of RubyGems (manual download + “ruby setup”) is the only way to get Watir on Windows with this 1.8.26 OneClick version.
I was able to run
gem install rubygems-update
update_rubygems
from the command prompt. This was from the rubygems 1.3.7 readme.
To install devkit first, here is a reference, hope it helps
http://stackoverflow.com/questions/1718500/installing-hpricot-on-ruby-1-9-1-on-windows
If you get error while system update command..download the latest rubygems from http://rubyforge.org/frs/?group_id=126…and rerun the command..u wont get the error
Linux part need additional information. Not all Linux machines has ruby installed, and ruby -v will come with an error. Please ad the following two lines to Install Ruby and Rubygems:
sudo apt-get install ruby
sudo apt-get install rubygems
This will make this tutorial more complete and helpful.
Regards
Thabet
Thanks. We’ve added your suggestions to the install notes.
Why not put the Firefox 3.5+ plugin link on this page? It is listed on the openqa site here:
http://wiki.openqa.org/display/WTR/FireWatir+Installation#FireWatirInstallation-InstalltheJSSHFirefoxExtension
It would provide a cleaner installation for users getting introduced to your product and would not make it seem like the site is not maintained much, which is a red flag for open source projects being adopted by any professionals.
Good idea. We’ve added it to the page.
I did try to install WATIR with the recommended 1.8.6-26 windows one-click installer. But when I did:
> gem update –system
it threw an error:
————————————
ERROR: Error installing rubygems-update:
rubygems-update requires builder (>= 0)
————————————
I uninstalled and tried the 1.9.1 installer. That did not work either.
As a last option I tried 1.8.6-27 RC2 (http://rubyforge.org/frs/download.php/47082/ruby186-27_rc2.exe) and that worked fine. Atleast my WATIR installation appears to have gone through fine. I’m yet to create and run tests. Meanwhile I thought this could be useful for a few more folks who faced similar issues.
Good luck.
Cheers
Rajeev
Thank you for the last option link to install the Ruby. This worked fine with updates also. Couple of files failed to update (ruby-opengl – Error installing ruby-opengl – Failed to build gem native extension. Rest of installing files went well.
Thank you once again.
Please update instructions to reflect the fact that on GNU/Linux rubygems may not be installed, even if ruby is. On some GNU/Linux systems rubygems must be installed separately. If rubygems isn’t installed already then the stated commands will not work.
Good point. We’ve updated the instructions to reflect this.
Is there a mac plugin for Firefox 3.6?
Simon, thanks for the reminder, I have added link to Mac plugin for Firefox 3.6 to the page.
I cannot install JSSH on Firefox 3.6.
Is there a Linux plugin for Firefox 3.6?
Thanks!
Paolo.
I have added the link to Linux plugin for Firefox 3.6 to the page.
When I go to the X-Code page on the Apple Developer site, I’m only finding the X-Code for Snow Leopard. I have OS X 10.5 Anyone know where that version of X-Code is?
I would suggest that you post this question to an Apple forum, I think you will get a faster reply there.
Has anyone modified jssh to work with FF3.6 yet?? I keep getting a segmentation fault whenever I try.
Thanks!
Which platform? Linux and Windows have been done for FF3.6: http://wiki.openqa.org/display/WTR/FireWatir+Installation
Linux… and unfortunately no, its not for linux firefox 3.6. I cant find it anywhere. I modified the install.rdf and made it say version 3.6 but it just crashes with a segmentation fault when you try and connect to it. Downgrading to linux 3.5 worked for me though :-/
If you’re really keen, you can compile the JSSH for Firefox Linux yourself. It’s pretty heavy though. If you do, please upload it to the wiki.
Details are: http://www.daveliebreich.com/blog/?page_id=6 and https://developer.mozilla.org/en/Build_Documentation
watir-webdriver gem can also drive Firefox:
http://zeljkofilipin.com/2010/01/12/watir-on-webdriver/
We have Linux plugin for Firefox 3.6 now.
I followed the instructions to install ruby and gems, including getting the latest gems (1.3.7 at the time of this writing), but when I execute gem -v it says 0.9.4 and the instructions say it must be at least 1.3.5. Why does 1.3.7 gems say it is 0.9.4 gems?
Jim, this is the question for gemcutter group: http://groups.google.com/group/gemcutter
Section about installing Ruby Gems could use more detail in my opinion. Other than that, very helpful.
Find it slightly odd that such an old version of Ruby is still recommended, just me? Keep in mind I know nothing about Ruby.
Some Watir features require that specific Ruby version (support for some pop ups if I remembered it correctly). I am using newer version of Ruby and everything works fine for me.
Andrew, what should we add to rubygems?
Hi All,
I was facing Gem update problem with ruby186-26.exe installer, After lot of trail & error ruby186-27_rc2.exe is working fine for me. Pls update the same in the site.
Thanks every one for helping me.
Chethan