Monday, October 15, 2007

buildout recipe for installing Selenium RC

This weekend at the Plone Naples Sprint one of the things I worked on was a buildout to download and install Selenium RC. It is now available from PYPI under the name collective.recipe.seleniumrc For some reason the Selenium RC distribution zip file contains version numbers on each subdirectory so this meant I couldn't just use one of the existing download scripts. But I didn't want to re-invent the download recipe wheel, so I decided to base this recipe on a well-written existing download recipe, I asked on IRC if the author was present at the sprint and ironically enough he was sitting in the same room as me only two rows away ;) With some simple changes to his recipe I was able to derive collective.recipe.seleniumrc from it and gain features like download caching and md5 file hash verification. Along the way I learned that if you want your buildout recipe to be derived by others you should make it a new-style Python class so that super() works. Also that it helps to factor your install() method into submethods for overriding. The changes I made to were cleaned up and integrated into a 1.1.0 release that we made yesterday, along with the 0.1 release of collective.recipe.seleniumrc If you want to try out the Selenium RC recipe just create a simple buildout.cfg:

After you are finished running this buildout you will get a nice wrapper script in your bin folder named by the part, in this case seleniumrc. Happy testing!


Kevin Dangoor said...


This is a useful recipe. I like the ease of getting the wrapper installed... but there's one thing missing:

ImportError: No module named selenium

It would be cool if this script also brought in the module... How have you been handling that module to date?

Thanks for the recipe!

hexsprite said...

Kevin - The project I developed this module for had module as an external in the svn repository.

I was kind of hoping selenium would be eggified at some point and that I could just declare it as a dependency.

Maybe there's another good way to solve it?

Kevin Dangoor said...

Yeah, I ended up downloading Selenium RC myself and just dropping into my source tree (ick).

I don't think there's any *clean* solution without selenium itself being available as an egg...

Santi said...

hi hexsprite,
I needed to run tests in firefox 3 (which is not supported by any selenium version previous to the nightly builds).
For this, I edited the download url of your package.
Do you want to do this update in pypi?