Skip to content

Using Selenium WebDriver

jejacks0n edited this page Jan 9, 2013 · 15 revisions

Teabag 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.

Setup

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

gem "selenium-webdriver"

Configure Teabag to use the selenium driver.

teabag_env.rb

Teabag.setup do |config|
  config.driver = "selenium"
end

Now when you run rake teabag it should be using Firefox to run your specs (right now there's only support for Firefox.)

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

before_script:
  - 'sh -e /etc/init.d/xvfb start'

You can also override the driver using rake teabag DRIVER=selenium or bundle exec teabag --driver=selenium.