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.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg
  • DZone
  • Ma.gnolia
  • Reddit
  • Simpy
  • Slashdot
  • StumbleUpon
  • Technorati

5 Responses to “Selenium on Ubuntu Hardy Heron”

  1. 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. 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. 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. 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. Larry Zoumas Says:

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

Leave a Reply