Select browsers and devices
Learn about the capabilities that you can use to run tests on a particular browser / OS.
Following are a list of capabilities which can you can use to specify which browser / OS / device combination you want to run your test on:
Capability | Description | Expected values |
---|---|---|
browserName |
Browser you want to test on |
Chrome , Firefox , IE , Safari , Edge , Opera
|
browserVersion |
Browser version you want to test | By default, we run tests on latest stable version of specified browser. View the list of supported browser versions. You can also use latest-beta , latest , latest - 1 , latest - 2 , etc., to test on the current beta release or latest n versions of the specified browser as you specify. |
os |
OS you want to test on |
Windows , OS X
|
osVersion |
Version of the OS to test on |
Windows: XP , 7 , 8 , 8.1 , 10 and 11 OS X: Snow Leopard , Lion , Mountain Lion , Mavericks , Yosemite , El Capitan , Sierra , High Sierra , Mojave , Catalina , Big Sur , Monterey , Ventura , Sonoma and Sequoia
|
deviceName |
Mobile or tablet to test on | The device you want to test on. View the list of devices we support. |
You can use these capabilities as shown in the following example:
BrowserStack SDK is a plug-n-play solution that takes care of all the integration steps for you. Using the BrowserStack SDK is the recommended integration method for your project. To know more, visit the SDK core concepts page.
Following are a list of capabilities which can you can use to specify which browser / os / device combination you want to run your test on.
BrowserStack-specific capabilities (Desktop)
Here is the list of custom capabilities offered by BrowserStack to easily specify the required browser and OS on desktop.
Capability | Description | Expected values |
---|---|---|
browserName |
Browser you want to test on |
Chrome , Firefox , IE , Safari , Edge , Opera
|
browserVersion |
Browser version you want to test | By default, we run tests on latest stable version of specified browser. View the list of supported browser versions. You can also use latest-beta , latest , latest - 1 , latest - 2 , etc., to test on the current beta release or latest n versions of the specified browser as you specify. |
os |
OS you want to test on |
Windows , OS X
|
osVersion |
Version of the OS to test on |
Windows: XP , 7 , 8 , 8.1 , 10 and 11 OS X: Snow Leopard , Lion , Mountain Lion , Mavericks , Yosemite , El Capitan , Sierra , High Sierra , Mojave , Catalina , Big Sur , Monterey , Ventura , Sonoma and Sequoia
|
Sample script showing capability declarations for desktop browsers
Capability | Description | Expected values |
---|---|---|
browser |
Browser you want to test on |
Chrome , Firefox , IE , Safari , Edge , Opera
|
browser_version |
Browser version you want to test | By default, we run tests on latest stable version of specified browser. View the list of supported browser versions. You can also use latest-beta , latest , latest - 1 , latest - 2 , etc., to test on the current beta release or latest n versions of the specified browser as you specify. |
os |
OS you want to test on |
Windows , OS X
|
os_version |
Version of the OS to test on |
Windows: XP , 7 , 8 , 8.1 , 10 and 11 OS X: Snow Leopard , Lion , Mountain Lion , Mavericks , Yosemite , El Capitan , Sierra , High Sierra , Mojave , Catalina , Big Sur , Monterey , Ventura , Sonoma and Sequoia
|
Sample script showing capability declarations for desktop browsers
BrowserStack-specific capabilities (Mobile)
Here is the list of custom capabilities offered by BrowserStack to easily specify the required device and OS version in mobile. Note that you will need to be on the Automate Mobile plan to be able to run tests on mobile and tablet devices.
Capability | Description | Expected values |
---|---|---|
deviceName |
Mobile or tablet to test on | The device you want to test on. View the list of devices we support. |
osVersion |
Version of the OS to test on | Check the OS versions available for the specified device |
Sample script showing capability declarations for mobile devices
MutableCapabilities capabilities = new MutableCapabilities();
HashMap<String, Object> browserstackOptions = new HashMap<String, Object>();
browserstackOptions.put("osVersion", "14");
browserstackOptions.put("deviceName", "iPhone 12");
browserstackOptions.put("realMobile", "true");
capabilities.setCapability("bstack:options", browserstackOptions);
var capabilities = {
'bstack:options' : {
"osVersion" : "14",
"deviceName" : "iPhone 12",
"realMobile" : "true",
},
"browserName" : "safari",
}
// for android
ChromeOptions capabilities = new ChromeOptions();
Dictionary<string, object> browserstackOptions = new Dictionary<string, object>();
browserstackOptions.Add("osVersion", "10.0");
browserstackOptions.Add("deviceName", "Samsung Galaxy S20");
browserstackOptions.Add("realMobile", "true");
capabilities.AddAdditionalOption("bstack:options", browserstackOptions);
// for iPhone
SafariOptions capabilities = new SafariOptions();
Dictionary<string, object> browserstackOptions = new Dictionary<string, object>();
browserstackOptions.Add("osVersion", "14");
browserstackOptions.Add("deviceName", "iPhone 12");
browserstackOptions.Add("realMobile", "true");
capabilities.AddAdditionalOption("bstack:options", browserstackOptions);
$caps = array(
'bstack:options' => array(
"osVersion" => "14",
"deviceName" => "iPhone 12",
"realMobile" => "true",
),
)
desired_cap = {
'bstack:options' : {
"osVersion" : "14",
"deviceName" : "iPhone 12",
"realMobile" : "true",
},
}
capabilities = {
'bstack:options' => {
"osVersion" => "14",
"deviceName" => "iPhone 12",
"realMobile" => "true",
},
}
Capability | Description | Expected values |
---|---|---|
device |
Mobile or tablet to test on | The device you want to test on. View the list of devices we support. |
os_version |
Version of the OS to test on | Check the OS versions available for the specified device |
Sample script showing capability declarations for mobile devices
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("os_version", "11.0"); // select "14" for iOS 14
caps.setCapability("device", "Samsung Galaxy S20"); // choose "iPhone 12 Pro" etc.
caps.setCapability("real_mobile", "true");
var capabilities = {
"os_version" : "11.0", // select "14" for iOS 14
"device" : "Samsung Galaxy S20", // choose "iPhone 12 Pro" etc.
"real_mobile" : "true",
"browserName" : "Android"
}
// for android
ChromeOptions capability = new ChromeOptions();
capability.AddAdditionalCapability("os_version", "11.0", true);
capability.AddAdditionalCapability("device", "Samsung Galaxy S20", true);
capability.AddAdditionalCapability("real_mobile", "true", true);
// for iPhone
SafariOptions capability = new SafariOptions();
capability.AddAdditionalCapability("os_version", "14");
capability.AddAdditionalCapability("device", "iPhone 12 Pro Max");
capability.AddAdditionalCapability("real_mobile", "true");
$caps = array(
"os_version" => "11.0", // select "14" for iOS 14
"device" => "Samsung Galaxy S20", // choose "iPhone 12 Pro" etc.
"real_mobile" => "true"
)
desired_cap = {
"os_version" : "11.0", # select "14" for iOS 14
"device" : "Samsung Galaxy S20", # choose "iPhone 12 Pro" etc.
"real_mobile" : "true"
}
caps = Selenium::WebDriver::Remote::Capabilities.new
caps["os_version"] = "11.0" # select "14" for iOS 14
caps["device"] = "Samsung Galaxy S20" # choose "iPhone 12 Pro" etc.
caps["real_mobile"] = "true"
For testing on the Chromium browser on an iOS device running iOS 14 or higher, please refer this page.
Capability rules
The following set of rules are defined to help you overcome the capabilities conflicts while specifing which browser / OS / device combination you want to run your tests on.
-
os_version
can only be defined whenos
has been defined. - The value
ANY
if given to any capability that supports that value is same as the capability preference not specified. - Default browser is
Chrome
on desktop when no browser is passed by the user or the selenium API (implicitly).
- If
browser
andbrowserName
are both defined,browser
has precedence (except ifbrowserName
is eitherandroid
,iphone
, oripad
, in which casebrowser
is ignored and the default browser on those devices is selected). - If
browser_version
andversion
are both defined,browser_version
has precedence. - If
os
andplatform
are both defined, os has precedence. -
os_version
can only be defined whenos
has been defined. -
platform
andos_version
cannot be defined together, ifos
has not been defined. - The value
ANY
if given to any capability that supports that value is same as the capability preference not specified. - Default browser is
Chrome
on desktop when no browser is passed by the user or the selenium API (implicitly).
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!