The Sauce Labs Cookbook

Sauce Headless

Front End Performance Testing

Insights

External Resources

More Info


Page tree
Skip to end of metadata
Go to start of metadata

Set Sauce URL and Access Credentials

If you wanted to run a Selenium test on Selenium locally, you would initiate a driver for the browser you want to test against like this.

Local Ruby Test Example
driver = Selenium::WebDriver.for :firefox 

To run a test on a remote service like Sauce Labs, all you need to change is your driver definition, and make sure that the sauce_endpoint variable includes your Sauce USERNAME and ACCESSKEY.

Remote Ruby Test on Sauce Example
driver = Selenium::WebDriver.for :remote, :url => sauce_endpoint, :desired_capabilities => caps
sauce_endpoint = "http://YOUR_SAUCE_USERNAME:YOUR_SAUCE_ACCESSKEY@ondemand.saucelabs.com:80/wd/hub"

To find your Sauce Labs access key:

  1. Sign in to https://saucelabs.com with the username you set up when you created your account. 
    You will use this same username in your test script. 
  2. To find your access key:
    1. Click your name in the Account Profile menu in the upper-right corner.
    2. Click User Settings.
    3. Scroll down to Access Key and click Show.
    4. Enter the password you use to sign in to Sauce Labs to view the access key.
    5. Click the Copy icon.

PAGE DEPRECATED: Updated content located here.

Set Desired Capabiliites

Once you have your tests set up to run in the Sauce cloud, you need to define the platform, browser, and version you want the test to run against, which is where :desired_capabilites and caps come into play. 

caps = { :platform => "Mac OS X 10.9", :browserName => "Chrome", :version => "31" }

You can manually enter the values you want for :platform:browsername, and :version, or you can use the handy Platform Configurator to generate the caps values for any combination of platform, browser, and browser version. 

  • No labels