a little madness

A man needs a little madness, or else he never dares cut the rope and be free -Nikos Kazantzakis

Zutubi

Selenium on Ubuntu Hardy Heron

Ubuntu 8.04, the Hardy Heron, was released last week. I eagerly upgraded to see if my previous wireless networking issues had been resolved, and joy of joys they had! This allowed me to finally switch back to Ubuntu as my primary development environment.

Most of the switch went without a hitch, however I did encounter one problem. The acceptance tests for Pulse rely heavily on Selenium. When trying to launch Selenium on Hardy, Selenium RC always got stuck at:

Preparing Firefox profile…

The default version of Firefox installed with Hardy is Firefox 3 beta 5 – as opposed to Firefox 2 in previous releases. So it seems that Selenium and Firefox 3 don’t agree with each other – or at least not when using the current release of Selenium (1.0-b1). My best guess is that Selenium is trying to install extensions into Firefox but is failing as the compatible versions for the extensions don’t include Firefox 3. A better diagnostic would be nice!

In any case, the easiest resolution was to install Firefox 2, which can sit alongside Firefox 3 on Hardy. Just install the firefox-2 package:

$ sudo apt-get install firefox-2

Then make sure Selenium uses this version. One way to do this is to create a link named firefox-bin in your PATH that points to the Firefox 2 binary. However, I prefer to leave my system clean and make an exception just for Selenium. To allow this, our tests support an optional SELENIUM_BROWSER environment variable that specifies in Selenium format the browser to use (this comes in handy in other cases too). So before running tests, I ensure that SELENIUM_BROWSER is set:

export SELENIUM_BROWSER=”*firefox /usr/lib/firefox/firefox-2-bin”

To make this my default with no extra effort, I have actually just added it to my .bashrc.

Liked this post? Share it!

8 Responses to “Selenium on Ubuntu Hardy Heron”

  1. July 1st, 2008 at 9:39 pm

    naro says:

    Thanks! This blog entry solved exactly the same problem I had with Firefox 3 on Mac OS X. I copied Firefox.app to Firefox2.app before installing FF3 and solved Selenium problem with:

    export SELENIUM_BROWSER=’*firefox /Applications/Firefox2.app/Contents/MacOS/firefox-bin’

  2. July 16th, 2008 at 1:34 pm

    Paulo says:

    Hi, I had the same issue and found this website via google. I just tried the nightly build and it’s fixed. Selenium would get stuck waiting for the user to accept the EULA. You can see in the source code (LauncherUtils.java) that they put a workaround for this.

  3. July 22nd, 2008 at 12:40 am

    Radek says:

    Hi
    I have the same problem. I’ve tried your sollution, but when I install firefox 2 and try running firefox-2-bin I get:
    15:33:39.062 INFO – Preparing Firefox profile…
    /usr/lib/firefox/firefox-2-bin: error while loading shared libraries: libmozjs.so: cannot open shared object file: No such file or directory
    The library file IS in /usr/lib/firefox which is on the PATH environment.
    Any ideas how to pass this?

  4. September 2nd, 2008 at 3:40 pm

    Vinod Pandey says:

    view /etc/ld.so.conf
    add enty for library of firefox in .conf file listed in the above file
    for example add /usr/lib/firefox in
    /etc/ld.so.conf.d/libc.conf

    then sudo su –
    lddconfig

    or ldconfig

  5. September 3rd, 2008 at 1:06 am

    Larry Zoumas says:

    As we say in Sweden… ‘Tusen Tack!’ (one thousand thank yous!)

  6. November 24th, 2008 at 2:04 am

    Niels says:

    I could not get the above to work, but what I found here worked:
    http://willbryant.net/software/2008/05/26/selenium_rc_firefox_2_on_ubuntu_hardy

    sudo apt-get install firefox-2
    sudo ln -s /usr/lib/firefox/firefox-2-bin /usr/lib/firefox/firefox-bin

  7. January 4th, 2009 at 8:14 am

    chrispanda says:

    see
    http://rubythings.blogspot.com/
    for an alternative that might work – it worked for me on interpid ibex

  8. July 5th, 2011 at 12:18 am

    Ansuman says:

    For me, its showing the same problem as well. It gets stuck at ” Preparing Firefox profile…”.

    I am using Firefox 5.0.

    Do I need to install FF 2 for it ????

    need some urgent help guys !!!
    thanks

Leave a Reply