Selenium WebDriver on Travis

Selenium on Travis may seem impossible because Travis has no window manager, instead it’s possible thank to xvfb and even easy to setup.

First of all, ensure to setup your app to use selenium for integration tests. Then push your stuff. Travis tests will fail (because it doesn’t know about selenium).

Now, let Travis meet Selenium!

We have to enable the virtual framebuffer on travis. You can do this appending the following to your .travis.yml:

- "sh -e /etc/init.d/xvfb start"
- "export DISPLAY=99:0"

We also need to download and execute selenium. To do this add the following (always inside before_script):

- "wget"
- "java -jar selenium-server-standalone-2.43.1.jar > /dev/null &"

Commit your .travis.yml changes and push. Travis tests will NOW pass 🙂

Leave a Reply

Please Login to comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.