Docs Code Examples

Documentation for:

Getting Started

You'll need …

Install Selenium 2 ruby bindings

From a terminal:

gem install selenium-webdriver


require 'rubygems'
require "test/unit"
require 'selenium-webdriver'

class ExampleTest < Test::Unit::TestCase
    def setup
        caps = Selenium::WebDriver::Remote::Capabilities.firefox
        caps.version = "5"
        caps.platform = :XP
        caps[:name] = "Testing Selenium 2 with Ruby on Sauce"

        @driver = Selenium::WebDriver.for(
          :url => "",
          :desired_capabilities => caps)

    def test_sauce ""
        assert @driver.title.include?("I am a page title - Sauce Labs")

    def teardown

Run your first test

  1. Copy the above code into a file named basic-example.rb
  2. Run the test:
    ruby basic-example.rb

  3. The test should now appear in your account page.

Get saucy

  1. Your first test just ran! Check out the results on your Account Page.
  2. Visit our Available Browsers page!
  3. Visit our resources page, and see all the available Sauce integrations.