Skip to end of metadata
Go to start of metadata

Set Access Credentials

To run a test on a remote service like Sauce Labs, all you need to change is your driver definition, and set your your Sauce USERNAME and ACCESSKEY.

Remote Ruby Test on Sauce Example
var webdriver = require('selenium-webdriver'),
    /* Change the username and accessKey to your credentials */
    username = "SAUCE_USERNAME",
    accessKey = "SAUCE_ACCESS_KEY",
    /* Base URL sets the target test application */
    baseUrl = "",
    /* driver instantiates via callback */

To find your Sauce Labs access key:

  1. Sign in to 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.

Set Desired Capabiliites and the Sauce Endpoint URL

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, as well as the endpoint for connecting to the Sauce Labs browser cloud.

 /* Instantiate a WebDriver and set browser capabilities */
        driver = new webdriver.Builder().withCapabilities({
            'browserName': 'safari',
            'platform': 'macOS 10.13',
            'version': '11.1',
            /* Pass Sauce User Name and Access Key */
            'username': username,
            'accessKey': accessKey,
            'name': this.test.title,
        }).usingServer("http://" + username + ":" + accessKey +

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

IP Ranges and Data Center Endpoints
Sauce Labs has data centers in both the US and EU. You can access Sauce Labs services from either location by providing the appropriate URL endpoints, and whitelisting their associated IP ranges. 

 Click here to view US Data Center Endpoints

Virtual Device Cloud

Sauce Connect Proxy (do not need to specify, Sauce Connect Proxy will use this by default)


  • for Signing/Encryption Certificate
  • for Entity AssertionConsumeURL


  • Virtual Devices and Desktops:
  • Real Devices:

IP Ranges: (this is equivalent to the range – (this is equivalent to the range -

 Click here to view EU Data Center endpoints

For more information, including framework configuration for the European data center, check out Sauce Labs European Data Center Configuration Information.

Virtual Device Cloud

Sauce Connect Proxy (specify with -x argument)


  • for Signing/Encryption Certificate
  • for Entity AssertionConsumeURL


IP Range: (this is equivalent to the range -

  • No labels