Windows Automation with Watir and Ruby 1.9.1

We love automation at Spiffy Stores, so with this in mind, I thought I’d alert anyone who uses Ruby under Windows using the Ruby Installer that there are some small bugs that you should be aware of when using Watir.

First off, if you want to interact with dialog boxes, then you will run into problems using Ruby 1.8.7. There is a bug in DL under the mingw32 code that is used to build this version of ruby and this is what Watir uses. It causes a segmentation fault.

So, finding no solution to this problem, I tried to run Watir under ruby 1.9.1, and this is where the fun starts.

If you try to run a Watir script you may get a popup saying that ‘msvcrt-ruby18.dll’ can’t be found. Strange, I thought we were running 1.9.1.

It turns out the the default gem installation of win32-api comes preconfigured for Ruby 1.8, hence the popup.

The way around this problem is to install the gem manually and specify the platform as ruby and force the gem to be rebuilt when it’s installed. You’ll need the Ruby Installer DevKit installed to do this.

gem install win32-api –platform ruby

Just one of those little quirks that keep us scratching our heads.