Hmmm, wasn't happy paying for SnagIt, and had some teething problems
with those recommended gems. So I've rolled my own solution ...
First thing I did was created a small app called snapit.exe which you
can download <a href='
http://90kts.com/blog/wp-content/uploads/2008/06/
snapit.exe' title='snapIt.exe by 90kts'>here</a>. If anyone is
interested in improving the code, you're welcome to get a copy of my
source code <a href='
http://90kts.com/blog/wp-content/uploads/2008/06/
snapit.zip' title='snapIt Source Code'>here</a>. In short, all this
app does is take a screenshot of the entire screen, and save it to a
default location (currently C:\snapit.png). Repeated use of the app
will increment the filename by 1 i.e. snapit1.png, snapit2.png ...
You can change the default file path by passing it a parameter at
runtime
e.g. D:\snapit.exe D:\images\testcase.png
Next thing to do is call it from your watir code. In Ruby, this is as
simple as:
cmd = 'D:\\snapit.exe'
puts %x{#{cmd}}
Putting it all together with some watir as an example:
require "watir"
test_site = "
http://www.90kts.com"
ie = Watir::IE.new
ie.goto test_site
ie.link(:text, "Contact").click
cmd = 'D:\\snapit.exe D:\\images\testsuite.png'
puts %x{#{cmd}}
Cheers,
Tim