Monday, July 20, 2009

Error using cucumber, selenium and firefox 3

Cucumber and Webrat works great for Behaviour Driven Development (BDD). In certain situations it's better to couple Cucumber with Selenium especially when we need to test javascript or have a look at the test visually.

When I first started Cucumber and Selenium on my Ubuntu. Selenium-server throws up saying that firefox 3 path isn't defined. Thankfully a blog article by Tze Yang presents a solution.However I still get the annoying error every now and then when firefox 3.0 was upgraded. This is because of the firefox executable is a symlink to a shell script.



ls -l /usr/bin/ | grep firefox

lrwxrwxrwx 1 root root 11 2009-06-13 13:32 abrowser -> firefox-3.0
lrwxrwxrwx 1 root root 11 2009-06-13 13:32 abrowser-3.0 -> firefox-3.0
lrwxrwxrwx 1 root root 33 2009-07-21 00:34 firefox -> firefox-3.0
lrwxrwxrwx 1 root root 32 2009-06-13 13:32 firefox-3.0 -> ../lib/firefox-3.0.11/firefox.sh

lrwxrwxrwx 1 root root 31 2009-07-01 00:42 firefox-3.5 -> /home/jasonong/.firefox/firefox


The trick then is to change the firefox symlink to the actual firefox 3 executable.


sudo rm /usr/bin/firefox
sudo ln -s /usr/lib/firefox-3.0.11/firefox-3.0 firefox


That should get you some nice cucumber + selenium action.

No comments:

Blog Archive