Using Selenium WebDriver

Mike Pack edited this page Apr 21, 2015 · 13 revisions

Teaspoon allows using Selenium when running specs from the rake task or command line interface. This allows you to test on a broader spectrum of browsers, but is slower and is a little more complex to setup on CI.

This page is dedicated to how to get setup and running.


You'll need to include the selenium-webdriver gem in your Gemfile.

gem "selenium-webdriver"

Configure Teaspoon to use the selenium driver. You can also pass some options along to Selenium using the driver_options directive.


Teaspoon.configure do |config|
  config.driver = :selenium
  # config.driver_options = {client_driver: :firefox}

Now when you run rake teaspoon it should be using Firefox to run your specs. You can also override the driver using rake teaspoon DRIVER=selenium or bundle exec teaspoon --driver=selenium.

Travis CI

To get this running on Travis CI, you'll need to add a .travis.yml file that contains the following:


  - 'sh -e /etc/init.d/xvfb start'
  - DISPLAY=":99.0"