Echographia

making things better, making better things

Wednesday, December 23, 2009

setting up browser automation with FireWatir

Ruby-based testing will only get you so far in the web development world – sooner or later you need to make sure your code works in a real browser. So for the last few years I’ve been occasionally trying to get a browser-based test automation tool running – often something in the Selenium family. It usually takes a full day for me to give up, usually because I just can’t get the tool to actually drive the browser.

Today I got FireWatir working! It wasn’t that hard, but I had to consult a few different web pages, so here it is all in one place.

  1. Via FireWatir Installation, install the gem:
    sudo gem install firewatir

    and the JSSh Firefox extension (Mac FF 3.5 version) to make Firefox steerable.

  2. Set up a Firefox profile, so you can run tests without all your weird extensions in play, and without messing with your personal browser session and history. Mine is called “tester”.
  3. Start up Firefox with JSSh and your new profile (you can do this while Firefox is running):
    /Applications/Firefox.app/Contents/MacOS/firefox -jssh -P "tester"
  4. In an irb session, try some stuff – for example, on a new Spree instance:
    ff = FireWatir::Firefox.new
    ff.goto 'http://localhost:3000/'
    ff.link(:text, 'Clothing').click

Voila! Now I want to try Cucumber and Watir.

posted by erik at 12:14 pm  

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress