I didn’t want to have to work through browser screens while I was debugging my controls, constantly searching for postcodes etc., so I’ve started using Watir (pronounced ‘Water’) to create and run browser automation scripts.
Watir installation is simple. Running a script is even easier:
An example script for your project might be:
browser = IE.new
browser.goto( 'http://localhost:3112/' )
browser.text_field( :id, /username$/ ).set( 'memberuser1' )
browser.text_field( :id, /password$/ ).set( 'password1' )
browser.button( :id, /submit$/ ).click
WatirMaker lets you easily record Watir scripts as you click through a session in the browser:
C:\>ruby WatirMaker.rb > myScript.rb
It provides you with a basic script quickly and easily and then you can modify it (the Watir cheatsheet is handy).
FireWatir is Watir for Firefox. Once you’ve installed the JSSh extension and started Firefox with the -jssh switch you can run your modified scripts. The only changes that should be required to your scripts are at the start:
browser = Firefox.new
Important tools for development time and you can port the scripts straight into your UAT environment, too.