Selenium RC Firefox 3.0 support on Ubuntu Hardy

If you've upgraded Selenium RC to the latest build you may be disappointed to find that while it supports Firefox 3 now, it can't start Firefox 3 “out of the box” on Ubuntu Hardy. Easy to fix:

The new launcher code, which is much improved over the old code, looks in these paths:

private static final String[] USUAL_UNIX_LAUNCHER_LOCATIONS = {
        "/Applications/Firefox-3.app/Contents/MacOS",
        "/Applications/Firefox.app/Contents/MacOS",
        "/usr/lib/firefox-3.0", /* Ubuntu 8.x default location */
};

private static final String[] USUAL_WINDOWS_LAUNCHER_LOCATIONS = {
        WindowsUtils.getProgramFilesPath() + "\\Firefox-3",
        WindowsUtils.getProgramFilesPath() + "\\Mozilla Firefox",
        WindowsUtils.getProgramFilesPath() + "\\Firefox",
};

for one of these files:

protected String[] standardlauncherFilenames() {
    if (WindowsUtils.thisIsWindows()) {
        return new String[]{"firefox.exe"};
    } else {
        return new String[]{"firefox-bin", "firefox"};
    }
}

(After which it will look in your PATH.)

Unfortunately, Ubuntu's Firefox 3 lib directory changes as they upgrade to point releases (note that most things use the scripts in /usr/bin, which don't change name – it's only because Selenium RC wants the ultimate binary file instead that we have this issue.)

So whereas Selenium RC looks in /usr/lib/firefox-3.0, at time of writing Hardy has 3.0.1, which it puts in /usr/lib/firefox-3.0.1.

At this point in time I think it's best just to work around this by symlinking the directory.

Recipe

sudo ln -s /usr/lib/firefox-3.0.1 /usr/lib/firefox-3.0

As at July 2008. Once Hardy upgrades to the next version of Firefox, you'll need to replace firefox-3.0.1 with firefox-3.0.2, etc.