NOTE: These instructions are pretty old!! The “Quick Start” instructions are a better way to get started.
Watir (Web Automation Testing In Ruby) is an open-source library that automates Internet Explorer browser actions on Windows. Watir drives browsers the same way people do. It clicks links, fills in forms, presses buttons. Watir also checks results, such as whether expected text appears on the page.
Watir is built on the Ruby scripting language. Like other programming languages, Ruby gives you the power to connect to databases, read data files, export XML and structure your code into reusable libraries.
The Three Essentials are :
- Get Ruby.
The current installer for Windows is ruby186-26.exe, available from rubyforge.org (24 MB download, as at November 2008). Install it to the default location, C:\ruby.
- Get Watir.
The package watir_156.msi installs Watir with its required dependencies (8 MB download from justaddwatir.com).
Note: there are other methods of installing Watir (via Ruby commands) but this is the simplest solution.
- Get the IE Developer Toolbar.
The package IEDevToolBarSetup.msi installs the Internet Explorer developer toolbar (0.6 MB download from microsoft.com).
Note: You must have local administrator privileges to install Ruby and Watir. After installing, log off Windows or restart, to ensure Ruby is added to your environment correctly.
Now you’re set up: to become a Watir guru, some time must be spent becoming proficient with :
- Ruby syntax – learning curve is OK if you’re familiar with scripting or development
- Watir syntax – an uncomplicated library that enables Ruby to drive IE directly via OLE
- SciTE editor – a lightweight IDE that’s included with Ruby (alternatively the Eclipse IDE is excellent but complex)