Make Tellurium / Selenium work with Firefox and Snow Leopard

TDL’s been playing around with Tellerium / Selenium for functional web-based tests for a little while now. Unfortunately everyone who’s been messing around with it has been running them on Ubuntu and the others of us on the team have OS X. When you run the Tellerium tests on a Mac with Snow Leopard they fail to start Firefox with the following output from the Selenium server:

Preparing Firefox profile...
dyld: Library not loaded: /usr/lib/libsqlite3.dylib
Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/
   Security
Reason: Incompatible library version: Security requires version 9.0.0 or 
   later, but libsqlite3.dylib provides version 1.0.0

What is Wrong?

The problem Firefox is complaining about is the version of libsqllite3.dylib found. Snow Leopard ships with a version of libsqllite in /usr/lib and Firefox also provides it’s own version of libsqllite3. Unfortunately there is a bug in Selenium 1.0.1 with how it calls Firefox that was patched in next version 1.0.2, however because of other bugs Tellerium is staying with 1.0.1 for now. You can read more about that decision in the mailing list thread:

http://www.mail-archive.com/tellurium-users@googlegroups.com/msg02149.html

The actual problem, at least from an outside view point, is dirt simple. When Selenium calls Firefox it sets up a set of environmental variables, one of which is:

DYLD_LIBRARY_PATH="null:/Applications/Firefox.app/Contents/MacOS"

As you can probably see there’s a problem with the path with the “null” that snuck in there. So somewhere in Selenium there’s some place where they forgot to check for a null value. When Firefox starts up it’s not able to find it’s local copy of libsqllight because of the invalid path arguments. But Firefox will happily guess a good set of paths if you forget to set the DYLD_LIBRARY_PATH, so a simple solution is to place a simple bash script in-between Selenium and Firefox that simple removes the corrupted path.

A Simple Solution

  1. Create simple Selenium 2 firefox shell script which removes the corrupted path variable. Here’s mine:

    #!/bin/bash
    
    unset DYLD_LIBRARY_PATH;
    /Applications/Firefox.app/Contents/MacOS/firefox-bin $@
    
  2. Change Selenium to call your bash script directly instead of Firefox. Inside the connector configuration for your project you’ll have a line configuring your scripts to use Firefox, after the designation “*firefox” you can provide a path to where to find the browser. Change that path to the shell script that you created in step 1.

    connectior {
         /** snip... **/
         browser = "*firefox /full/path/to/your/selenium2firefox.sh"
    

Conclusion

Beyond the basic hackish-nature of the working around the big downside is to using the approach is that Tellerium is not closing the old Firefox instances once it’s finished with them. That is at least a big improvement over the previous state of not able to run, so you can at least hobble along for a little while.


comments powered by Disqus