Test Configuration Options
This page provides a reference for the valid test configuration options (capabilities) you can set to specify the variable settings for your automated tests running on Sauce Labs.
Try our Sauce Labs Platform Configurator! It provides a graphical user interface where you can specify your settings using option buttons and drop-down menus, then automatically generates the corresponding capabilities code based on your selections. For examples, see Examples of Test Configuration Options for Website Tests.
What You'll Need
- A Sauce Labs account (Log in or sign up for a free trial license)
Terminology
When setting up your test, you'll need to configure your script with settings called capabilities that align with your test environment (e.g., desktop browser, mobile web browser, mobile app). While each environment has its own set of capabilities, they can also be combined. Some are required for a test to run in a given environment, while some are optional.
You'll need to add these configurations to the capabilities or options classes.
- W3C WebDriver Capabilities: Required for any test using Selenium or Appium to communicate with the browser. W3C WebDriver capabilities are universal capabilities for any test, and are usually combined with additional capabilities. See the official W3C Recommendations website for more information.
- Sauce Labs Capabilities: Needed for running a test on the Sauce Labs Cloud, with different possible sets for different environments. Though there aren't any capabilities required, you will need to configure the endpoint URL and should pass the test name and status as capabilities to the remote webdriver.
- Appium Capabilities: Required for tests using Appium on mobile apps and Appium on mobile web browsers.
- Browser-Specific Capabilities: Optional, browser-specific Sauce Labs capabilities.
- Browser Vendor Capabilities: Each browser also has its own set of pre-defined options you can set to help you test. You can add these in regular capabilities or options, or use the browser-defined capabilities (browser options classes) to configure your browser tests:
W3C WebDriver Capabilities – Required
Sauce Labs determines W3C sessions with the presence of sauce:options
capabilities and generic W3C WebDriver-compliant capabilities in your code. See W3C Capabilities Support for more information.
Below are the W3C WebDriver primary test configuration settings for Sauce Labs desktop browser tests and mobile tests.
Use the latest version of the Selenium library in your code for the most up-to-date support.
browserName
| STRING |
Identifies the user agent. See the WebDriver W3C Specification for more information. This setting also applies to emulators, simulators and real devices when automating with a mobile browser. It must be set when App Name is not set.
- For Android v5 and below, the value needs to be
"Browser"
, v6 and above, it is"Chrome"
. - For iOS, the value needs to be
"Safari"
. - For mobile native or hybrid apps, the value needs to be an empty String.
"browserName": "firefox"
browserVersion
| STRING |
Identifies the version of the browser you want to use in your test. See the WebDriver W3C Specification for more information.
To use the latest stable version of Chrome or Firefox that we support, you can use "browserVersion": "latest"
. You can also use "browserVersion": "latest-1"
or "browserVersion": "latest-2"
, etc., to request the next most recent versions of a browser.
For example, if the latest stable version of Chrome is 73, you can request "latest-2"
to use Chrome 71.Note that the latest version for Safari browsers will depend on the chosen "platformName"
.
See the Sauce Labs Platform Configurator for valid options.
This setting cannot be used for mobile browsers, as your test will use the default browser installed for the given Appium version.
"browserVersion": "latest"
platformName
| STRING |
Identifies the name of the operating system the browser or mobile device should be running on. You can use this for dynamic device allocation. Values are not case-sensitive (i.e., "ios"
is the same as "iOS"
). See the WebDriver W3C Specification for more information.
"platformName": "macOS 10.13"
W3C WebDriver Browser Capabilities – Optional
Optional, Sauce-compatible W3C WebDriver specification capabilities you can add to your tests. To view their descriptions, see the W3C WebDriver Specification Capabilities.
acceptInsecureCerts
| BOOLEAN |
Indicates whether untrusted and self-signed TLS certificates are implicitly trusted on navigation for the duration of the session. The default value is false
. See the WebDriver W3C Specification for more information.
"acceptInsecureCerts": true
pageLoadStrategy
| STRING |
Defines the current session’s page load strategy. See the WebDriver W3C Specification for more information. For allowed values and their associated required document readiness state, see WebDriver W3C Specification Page Load Strategies Table.
"pageLoadStrategy": "eager"
proxy
| OBJECT |
Defines the current session’s proxy configuration. See the WebDriver W3C Specification for more information.
"proxy": {"proxyType": "manual",
"httpProxy": "myproxy.com:3128"}
timeouts
| OBJECT |
Describes the timeouts imposed on certain session operations. Applicable timeouts can be found on the WebDriver W3C Specification Timeouts Table. See the WebDriver W3C Specification for more information.
"timeouts": {"script": 20000,
"pageLoad": 400000,
"implicit": 1000}
strictFileInteractability
| BOOLEAN |
Defines the current session’s strict file interactability. This indicates that interactabilty checks will be applied to File type input elements. The default is false
. See the WebDriver W3C Specification for more information.
"strictFileInteractability": true
unhandledPromptBehavior
| STRING |
Describes the current session’s user prompt handler. The default value is "dismiss and notify"
. For a list of the allowed options, see WebDriver W3C Specification User Prompt Handler Table. See the WebDriver W3C Specification for more information.
"unhandledPromptBehavior": "ignore"
webSocketUrl
| BOOLEAN | Desktop Only | BETA |
Enables W3C WebDriver BiDi support. This allows Selenium 4 clients to use Bi-Directional functionality. It also enables BiDi for other test frameworks, like WebDriverIO. In particular, this capability exposes the WebSocket endpoint which is available under webSocketUrl
field in session startup response body. This endpoint can be used to issue WebDriver BiDi commands as described by the specification. The default value is false
.
The webSocketUrl
capability is not compatible with extendedDebugging
capability.
"webSocketUrl": true
Desktop Browser Capabilities: Sauce-Specific – Optional
Browser-specific optional capabilities you can add to the sauce:options
block of your test session creation code.
chromedriverVersion
| STRING |
Allows you to specify the ChromeDriver version you want to use for your tests. The default version of ChromeDriver when no value is specified depends on the version of Chrome used. As of Chrome 73, the major version of the driver and the browser must match.
For a list of ChromeDriver versions, see chromedriver versions list.
If you find a bug that you determine is driver related, you can specify the latest point release of the chrome driver that matches the browser version.
For example, Sauce Labs might default to "88.0.4324.27"
, but there is a bug fix in version "88.0.4324.96"
, so you can specify that in your test.
"chromedriverVersion": "88.0.4324.96"
edgedriverVersion
| STRING |
Specifies the Microsoft Edge driver version you want to use for your tests. For a list of edgedriver versions, see the Microsoft Edge Driver website.
Edge Driver is based on Chrome Driver, so the same caveats from chromedriverVersion apply to edgedriverVersion
.
"edgedriverVersion": "90.0.818.51"
geckodriverVersion
| STRING |
Specifies the Firefox GeckoDriver version. The default geckodriver version varies based on the version of Firefox specified. For a list of geckodriver versions and the Firefox versions they support, see geckodriver Supported Platforms.
With geckodriver version 0.31.0, Mozilla removed the capability --remote-debugging-port
, which was never officially supported. You can use the supported capability moz:debuggerAddress
. See this article on our blog for more information.
"geckodriverVersion": "0.27.0"
iedriverVersion
| STRING |
Specifies the Internet Explorer Driver version. If no version is specified, it defaults to 2.53.1. For a list of IE Driver versions, see Internet Explorer Driver Server CHANGELOG.
"iedriverVersion": "3.150.1"
seleniumVersion
| STRING |
Specifies the Selenium version you want to use for your test. Sauce Labs will default to different versions, depending on the age of the browser and platform, and whether or not you're initializing a session with valid W3C syntax.
Always use the latest Selenium version. The Selenium developers are very conscientious about backward compatibility support, so we recommend always using the latest available version unless you find a specific, known issue.
"seleniumVersion": "3.141.1"
avoidProxy
| BOOLEAN |
Allows the browser to communicate directly with servers without going through a proxy that is shipped with Selenium versions prior to v3. By default, Sauce routes traffic from Internet Explorer and Safari through an HTTP proxy server so that HTTPS connections with self-signed certificates will work. The proxy server can cause problems for some users, and this setting allows you to avoid it.
This configuration is only relevant for Selenium versions 2.x and older. Any test run with a Sauce Connect tunnel has to use the proxy and this flag will be ignored.
"avoidProxy": true
extendedDebugging
| BOOLEAN |
Enables Extended Debugging features. This applies to Firefox and Chrome only. It records HAR files and console logs for both of these browsers. In Chrome, it also enables network interception, network and cpu throttling as well as access to network logs during the session. It is required to be true for capturePerformance
. The default value is false
.
"extendedDebugging": true
capturePerformance
| BOOLEAN |
Enables Performance Capture feature. Sauce Performance Testing can be enabled by setting both extendedDebugging
and capturePerformance
to true
. Default value is false
. See Getting Started with Sauce Front-End Performance for more information.
"capturePerformance": true
screenResolution
| STRING |
Specifies the screen resolution to be used during your test session. Default screen resolution for Sauce tests is 1024x768
.
To specify the screen resolution on Windows, we recommend that you set the platformName
to Windows 8 or newer (e.g., Windows 10).
"screenResolution": "1280x1024"
commandTimeout
| INTEGER |
Sets command timeout in seconds. As a safety measure to prevent Selenium crashes from making your tests run indefinitely, we limit how long Selenium can take to run a command in our browsers. This is set to 300 seconds by default. The maximum command timeout value allowed is 600 seconds.
"commandTimeout": 300
idleTimeout
| OPTIONAL | DURATION | INTEGER | Desktop Only |
Sets idle test timeout in seconds. As a safety measure to prevent tests from running too long after something has gone wrong, we limit how long a browser can wait for a test to send a new command. This is set to 90 seconds by default and limited to a maximum value of 1000 seconds.
"idleTimeout": 90
devTools
| OPTIONAL | BOOLEAN | Desktop Only | BETA |
Enables Chrome DevTools Protocol support, which is disabled by default on Sauce Labs platform. This allows Selenium 4 clients to use Bi-Directional functionality. In particular, this capability exposes the WebSocket endpoint which is available under se:cdp
field in session startup response body. This endpoint can be used to issue Chrome DevTools Protocol commands as described by the specification. The default value is false
.
The devTools
capability is not compatible with extendedDebugging
capability.
"devTools": true
Mobile Appium Capabilities
As the W3C WebDriver Protocol is supported in Appium v1.6.5 and higher, and required for Appium v2.0, we encourage and support using it for your Appium mobile app tests instead of the JSON Wire Protocol (JWP). We'll continue to support JWP in all currently supported Appium 1.X versions, but please be aware that with Appium 2.0, JWP support will be fully deprecated in favor of W3C.
The capabilities defined here assume the W3C WebDriver Protocol. See Appium Real Device W3C Specification and Migrating Appium Real Device Tests to W3C for more information.
platformName
| MANDATORY for Virtual and Real Devices | STRING |
Identifies the name of the operating system the mobile device should be running on. Values are not case-sensitive (i.e., "ios"
is the same as "iOS"
). Valid values are Android
and iOS
. See the WebDriver W3C Specification for more information.
MutableCapabilities capabilities = new MutableCapabilities();
capabilities.setCapability("platformName", "Android");
appium:platformVersion
| MANDATORY for Virtual Devices | OPTIONAL for Real Devices | STRING |
Allows you to set the mobile OS platform version that you want to use in your test.
Android and iOS platform versions are based on Semantic Versioning, also known as SEMVER. This means that the versions will have the format MAJOR.MINOR.PATCH
.
Virtual Devices
This is mandatory for Android Emulators and iOS Simulators. You can find the available versions in our Platform Configurator.
iOS Simulators now support the values latest
, current_major
, or previous_major
as the appium:platformVersion
. These values will automatically use the latest, current major, or previous major version of iOS for your specified Simulator. See iOS Version Management for more information.
Real Devices
This is optional for Real Devices. There are three options you can use to determine which version you want to use for your automated Appium, Espresso, or XCUITest tests:
- Don't provide a
platformVersion
, this will result in any available Android or iOS device, no matter the version. - Provide a
platformVersion
that starts with your providedplatformVersion
string:12
: matches all minors and patches forplatformVersion: "12"
. For example12.1.0|12.1.1|12.2.0|...
12.1
: matches all patches forplatformVersion: "12.1"
. For example12.1.0|12.1.1
, it will not match12.2.x|12.3.x
and higher12.1.1
: matches all devices that have this exact platform version
- In/exclude a specific version and or a range of versions by using a regular expression (regex). You don't need to provide the forward slashes (
/{your-regex}/
) as you would normally do with regex. Keep in mind that the regex needs to match the formatMAJOR.MINOR.PATCH
. The possibilities are endless, but here are just a few examples:
The stricter the platformVersions
is, the smaller the pool of available devices will be and the longer you might need to wait for the available device. We recommend using only the major version or using the regex option to get the best results and an available device in the fastest way.
MutableCapabilities capabilities = new MutableCapabilities();
// For Android Emulators or iOS Simulators
// the platformVersion needs to match exactly
capabilities.setCapability("appium:platformVersion", "12.0");
// For Real Devices, dynamically finding an available device
// with at least major version 12
capabilities.setCapability("appium:platformVersion", "12");
// For Real Devices when you exactly know the version of
// the device you want to use
capabilities.setCapability("appium:platformVersion", "12.4.1");
// For Real Devices when you want to exclude version 15
capabilities.setCapability("appium:platformVersion", "^(?!15).*");
Using Appium 2? Prevent appium:
-prefix repetitiveness and start using appium:options
for Real Devices instead.
appium:deviceName
| MANDATORY for Virtual Devices | OPTIONAL for Real Devices | STRING |
Allows you to set the name of the simulator, emulator, or real device you want to use in the test.
For Real Devices:
You can use this to set up a test with either static or dynamic allocation for RDC, and run individual or parallel tests. Static allocation allows you to run your tests on a very specific device, while dynamic allocation allows you to specify a family of devices or any device with a certain OS so you can quickly run your test on the first available real device (RDC) device.
- Dynamic allocation example: for an Android RDC test, you can request a generic Samsung Galaxy device by using the option
"appium:deviceName":"Samsung Galaxy.*"
. - Static allocation example: if you want to use a Samsung Real Device, you need to specify the exact Samsung Galaxy device by using it's device ID or display name (e.g.,
"appium:deviceName":"Samsung_Galaxy_S20_real"
or"appium:deviceName":"Samsung Galaxy S20"
).
For Android Emulators
Each Android Emulator skin will have a different configuration depending on the phone or tablet that it emulates. For example, all the skins have different resolutions, screen dimensions, pixel densities, memory, etc. You can use our Platform Configurator to get a list of the available Android emulator skins for the various Android Emulator versions.
Examples
MutableCapabilities capabilities = new MutableCapabilities();
// For a real device
capabilities.setCapability("appium:deviceName", "Samsung Galaxy S20");
// For an Android Emulator
capabilities.setCapability("appium:deviceName", "Google Nexus 7 HD Emulator");
// For an iOS Simulator
capabilities.setCapability("appium:deviceName", "iPhone XS Simulator");
Using Appium 2? Prevent appium:
-prefix repetitiveness and start using appium:options
for Real Devices instead.
appium:automationName
| OPTIONAL for Appium 1.x (JWP) | MANDATORY for Appium 2.0 (W3C) | STRING |
Allows you to set the automation engine that will be used. Possible values are:
Emulators / Simulators:
- Android:
UiAutomator2
,Espresso
,Flutter
- iOS:
XCUITest
,Flutter
Real Devices:
- Android:
UiAutomator2
- iOS:
XCUITest
MutableCapabilities capabilities = new MutableCapabilities();
capabilities.setCapability("appium:automationName", "UiAutomator2");
Using Appium 2? Prevent appium:
-prefix repetitiveness and start using appium:options
for Real Devices instead.
browserName
| OPTIONAL | STRING | Virtual and Real Devices |
Identifies the browser to be used when automating with a mobile browser. See the WebDriver W3C Specification for more information. This capability is case-insensitive
- For Android the value needs to be
"Chrome"
. - For iOS, the value needs to be
"Safari"
.
- If this capability is not provided for a virtual device, the
appium:app
capability needs to be set. If none is set the test will throw an error. - This capability can be omitted for virtual devices if the
appium:app
capability is set. - If this capability is not provided for a real device session and also the:
appium:app
- or
appium:bundleId
(iOS) - or
appium:appPackage
andappium:appActivity
(Android) capability is not provided, then a real device session will automatically fall back to the default browser. This will be Chrome for Android and Safari for iOS.
MutableCapabilities capabilities = new MutableCapabilities();
capabilities.setCapability("browserName", "chrome");
appium:app
| OPTIONAL | STRING | Virtual and Real Devices |
Allows you to set a path to an .ipa
, .apk
, .aab
or .zip
file containing the mobile app you want to test. This could be the location of your app in App Storage (e.g., storage:filename=myapp.zip
) or the URL to a remote location where your app is located (e.g., http://myappurl.zip
). The remote location needs to be accessible from the web, Sauce Connect can not access your internal file system where apps are hosted.
-
If this capability is not provided for a virtual device, the
browserName
capability needs to be set. If none is set the test will throw an error. -
This capability can be omitted for virtual devices if the
browserName
capability is set. -
If this capability is not provided for a real device session and also the:
browserName
capability- or
appium:app
- or
appium:bundleId
(iOS) - or
appium:appPackage
andappium:appActivity
(Android)
capability is not provided, then a real device session will automatically fall back to the default browser. This will be Chrome for Android and Safari for iOS
MutableCapabilities capabilities = new MutableCapabilities();
capabilities.setCapability("appium:app", "storage:filename=my_app.zip");
If your app has been uploaded to Sauce storage, you can set the app
capability to "storage:xxxxxxxxx-xxxxxxx-xxx"
and enter the FILE ID for your app. This allows you to set which specific version you uploaded. Otherwise, if you use the file name it will select the latest version uploaded with the exact same name.
Using Appium 2? Prevent appium:
-prefix repetitiveness and start using appium:options
for Real Devices instead.
appium:bundleId
| OPTIONAL | STRING | Real Devices Only | iOS Only |
Bundle identifier of the app under test, for example com.apple.calculator
. The capability value is calculated automatically if appium:app
is provided.
If neither appium:app
, browserName
, or appium:bundleId
capability is provided then by default Sauce Labs will start the Safari browser for iOS.
These two posts explain how you can get the bundleId
for iOS apps:
MutableCapabilities capabilities = new MutableCapabilities();
capabilities.setCapability("appium:bundleId", "com.apple.calculator");
Using Appium 2? Prevent appium:
-prefix repetitiveness and start using appium:options
for Real Devices instead.
appium:appPackage
| OPTIONAL | STRING | Real Devices Only | Android Only |
Application package identifier to be started, for example, com.google.android.youtube
. If not provided, then UiAutomator2 will try to detect it automatically from the package provided by the appium:app
capability. Read How To Troubleshoot Activities Startup for more details.
If neither appium:app
, browserName
, or appium:appPackage
plus appium:appActivity
capabilities are provided then by default Sauce Labs will start the Chrome browser for Android.
This post explains how you can get the appPackage
for Android apps.
MutableCapabilities capabilities = new MutableCapabilities();
capabilities.setCapability("appium:appPackage", "com.google.android.youtube");
Using Appium 2? Prevent appium:
-prefix repetitiveness and start using appium:options
for Real Devices instead.
appium:appActivity
| OPTIONAL | STRING | Real Devices Only | Android Only |
Main application activity identifier, for example, com.google.android.apps.youtube.app.watchwhile.WatchWhileActivity
. If not provided then UiAutomator2 will try to detect it automatically from the package provided by the appium:app
capability. Read How To Troubleshoot Activities Startup for more details.
If neither appium:app
, browserName
or appium:appActivity
plus appium:appPackage
capability are provided then by default Sauce Labs will start the Chrome browser for Android.
You can get the current activity by using the Appium currentActivity
command. This is the Appium 1 command, but will also work with Appium 2.
MutableCapabilities capabilities = new MutableCapabilities();
capabilities.setCapability("appium:appActivity", "com.google.android.apps.youtube.app.watchwhile.WatchWhileActivity");
Using Appium 2? Prevent appium:
-prefix repetitiveness and start using appium:options
for Real Devices instead.
appium:otherApps
| OPTIONAL | STRING or LIST | Real Devices Only |
A dependent app that has already been uploaded to App Storage will be pre-installed on the device during the testing of the main app. You can specify the app using its storage:<fileId>
or storage:filename=<filename>
reference.
Dependent apps inherit the configuration of the main app under test for Device Language
, Device Orientation
, and Proxy
, regardless of the settings may have been applied to the app at the time of upload, because the settings are specific to the device under test. For example, if the dependent app is intended to run in landscape orientation, but the main app is set to portrait, the dependent app will run in portrait for the test, which may have unintended consequences.
Android-dependent apps will not be instrumented or modified. iOS-dependent apps will always be resigned/modified (even when resigning is disabled for the main app) because apps can't be installed on iOS devices without resigning them. If a dependent app cannot be resigned (such as a third party app), the test will not work as intended.
MutableCapabilities capabilities = new MutableCapabilities();
// Or for a single app by name
capabilities.setCapability("appium:otherApps", "storage:filename=app0.apk");
// Or for a single app by fileId
capabilities.setCapability("appium:otherApps", "storage:7435ab52-1eaa-4387-a67b-4d8e265f85");
// Or for multiple apps by name
capabilities.setCapability("appium:otherApps", ["storage:filename=app0.apk", "storage:filename=app1.apk"]);
// Or for multiple apps by fileId
capabilities.setCapability("appium:otherApps", ["storage:7435ab52-1eaa-4387-a67b-4d8e265f8509","storage:9035342-f8ea-7687-a67b-4dd4365f8588"]);
Using Appium 2? Prevent appium:
-prefix repetitiveness and start using appium:options
for Real Devices instead.
appium:orientation
| OPTIONAL | STRING | Virtual and Real Devices |
Specifies the orientation of the screen during the test. Valid values are PORTRAIT
and LANDSCAPE
.
This capability is an Appium capability that needs to be pre-fixed with appium:
so it becomes appium:orientation
. It can be used for virtual device mobile tests and real device tests. Theappium:orientation
capability will only flip the screen while the capability deviceOrientation
will flip the skin and the screen. See deviceOrientation
for more information.
MutableCapabilities capabilities = new MutableCapabilities();
capabilities.setCapability("appium:orientation", "LANDSCAPE");
Using Appium 2? Prevent appium:
-prefix repetitiveness and start using appium:options
for Real Devices instead.