A functional testing tool for automating browser-based tests of web applications. It drives the Internet Explorer browser the same way people do. It clicks links, fills in forms, presses buttons. It also checks results, such as whether expected text appears on the page.
I did some simple website testing with it.
- aka Web Application Testing in Ruby.
- Pronounced "water".
- my Watir scripts
2005-10-19 - (version not recorded) ∞
I've known about Watir for some time now, but I haven't had a good excuse to care about it. Frankly, I still think that textual gaming via Vwmc would be a more thorough introduction to Ruby, but this is a good enough start I suppose.
I've already run into some pretty significant walls, most likely because Watir's documentation is basically absent. I'm tired of seeing bits and pieces of documentation scattered around. Some of Watir's online stuff is fantastic.. but when I look at it's wiki I want to strangle someone. Even its FAQ was awful. It really saddens me when the live documentation isn't kept updated. I guess there aren't very many people who love writing documentation as much as I do.
I'm still poking around for some decent resources.. I expect that in the next couple of weeks the main watir topic will be pretty decent. Seeing as this is a long-term thing, I'm looking for all sorts of peripheral resources too. I'll poke around the mailing list and archives for more stuff.
Get and install
gem for Windows, and install watir that way. I failed to install watir via a downloaded gem or via the gem windows installer. Go figure.
Running the included tests ∞
If Ruby is installed to
C:\ruby and watir was installed as a gem, then the unit tests are:
go to the console and enter into that directory, and do a
I have no idea how to interpret the results.
I can get logging to work via
foo = Watir::WatirLogger.new("test",$ie,100)
but it doesn't do anything.
Logging needs to check for a file, and do proper log rotation, with a nice naming scheme.
Outstanding questions ∞
What exceptions are thrown for what situations? I'd like to be able to rescue with some intelligence.
- Invalid URL (target page missing)
- IE window isn't open.
Change the methods to log things to a file as well as output to
stdout-- the existing logging functionality needs to be figured out.
- TODO - check out log4r - https://github.com/colbygk/log4r
Change the default way things work, so I don't have to use my methods..
- Or put the methods in another file to be included separately.
IRB is stupid ∞
- Ruby can do
require 'watir'but irb requires
Ruby can use tabs, but pasting into IRB makes it explode in colourful ways. Do
- Cucumber and H30 ("watir", "safariwatir", "firewatir")
- Brian Marick is writing Scripting for testers, which will focus on learning by examining and building examples, including working with Watir and possibly Selenium. The manuscript is due by the end of 2005.
$ie.send_keys(key_string)-- see https://www.autoitscript.com/autoit3/docs/appendix/SendKeys.htm
- Clearing the IE cache
- Watir Extension Toolkit
- As of 2019-09-29 it's been gone for some time.