Introducing WatirMaker - Recording for Ruby-based Watir
Well, my wife is out of town and as usual, I can't sleep at all. We've been married 5 years and we just can't sleep separate. This is both a good and a bad thing. Bad because it's 3:23am, good because I felt compelled to write some software.
I've been digging Watir lately and have introduced it around work. The question that everyone keeps asking is "ok, so how do I automatically record Watir scripts" and the answer has been, to the best of my knowledge, "um, you don't. Hopefully someone will do something soon."
I got tired of waiting. I started at 10pm and now it's 3:25 and Conan is being repeated. So, here's a screencast of my results after 5.5 hours. It's very rough but it supports text boxes, buttons, links, select lists (kinda), radios and checkboxes. It doesn't support frames, iframes, the back button, divs, tables, etc yet. It's also very sloppy code, so I think what I'm going to do is get a few volunteers in the Watir community who are also .NET savvy to help me out and I'll try to release it in a week or so.
There's some really crazy stuff going on in here with UCOMIConnectionPoint in order to get "IE on a string." Also, a lot of things are being caught on the onfocusout event. I also need to understand if HTMLDocumentEvents2 is the right object model to be watching.
If there's interest, we shall see. Interested? Here's the screencast of WatirMaker 0.1. I'm off to bed.
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
One question, (and completely offtopic) what the calendar on your desktop?
I sent 5.5 hours on it. Believe me, the code is ALL f'ed up, but it works to "sketch" a site.
BTW, Jason, I think the yellow flashing you talk about is Watir functionality.
This is great work! Your original Watir post got me thinking about how you could use Watir to drive the automation of IE, but perform your assertions in .NET.
My idea was to use Ruby simply as the automation engine – you’d call your scripts using a .NET wrapper, pass back the contents of the final HTML document via the process.StandardOutput, then use the HTML Agility Pack (see http:// blogs.msdn.com/smourier/archive/2003/06/04/8265.aspx and http:// smourier.blogspot.com/) to load the document and then perform XPath queries (built using a tool like http:// www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=4f976e6e-9474-4813-b1cd-5e565f3219f9) against the HTML DOM to validate that the HTML elements are in the correct state (using Assert.IsTrue etc) rather than having to write the assertions in Ruby then use regular expressions to parse the output.
Unfortunately I’m totally maxed out working on a Scrum Methodology plug-in for Team System and have absolutely zero time to get this working…
How come few of ur icons(shorcuts) showing Firefox's ICON in ur desktop???/
Gotta extend it... I hope there is no restriction on modifying the code for non-commercial reasons to speed up writing scripts process?
Comments are closed.
Your post 'Integrating Ruby and Watir with NUnit' is what put me onto Watir (thanks by the way): In a weird confluence of events, your post came out, I got involved as a reviewer for a scripting for testers book (I didn’t know initially but the book features Ruby as the scripting language), and I was also watching the Rails media wave. This trinity got me to play with Watir – and got hooked – as well as Rails. Ruby quite rocks.
At that time I had Selenium running our GUI tests but found some shortcomings on that tool specific to the way my company required us to work.
We're in mid-switch on a major release, running old tests with selenium and writing new ones with Watir and converting the old ones when they break. This type of recording feature would make a solid option even better.
Definitely hope to see this come to pass.