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. You can create a unique combination from either the BrowserStack specific capabilities or Selenium capabilities.
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 , and Ventura
|
Sample script showing capability declarations for desktop browsers
MutableCapabilities capabilities = new MutableCapabilities();
capabilities.setCapability("browserName", "Chrome");
capabilities.setCapability("browserVersion", "102.0");
HashMap<String, Object> browserstackOptions = new HashMap<String, Object>();
browserstackOptions.put("platformName", "Windows");
browserstackOptions.put("osVersion", "11");
capabilities.setCapability("bstack:options", browserstackOptions);
var capabilities = {
'bstack:options' : {
"platformName" : "Windows",
"osVersion" : "11",
},
"browserName" : "Chrome",
"browserVersion" : "102.0",
}
// for chrome
ChromeOptions capabilities = new ChromeOptions();
capabilities.BrowserVersion = "102.0";
Dictionary<string, object> browserstackOptions = new Dictionary<string, object>();
browserstackOptions.Add("platformName", "Windows");
browserstackOptions.Add("osVersion", "11");
capabilities.AddAdditionalOption("bstack:options", browserstackOptions);
// for firefox
FirefoxOptions capabilities = new FirefoxOptions();
capabilities.BrowserVersion = "101.0";
Dictionary<string, object> browserstackOptions = new Dictionary<string, object>();
browserstackOptions.Add("platformName", "Windows");
browserstackOptions.Add("osVersion", "11");
capabilities.AddAdditionalOption("bstack:options", browserstackOptions);
// for edge
EdgeOptions capabilities = new EdgeOptions();
capabilities.BrowserVersion = "latest";
Dictionary<string, object> browserstackOptions = new Dictionary<string, object>();
browserstackOptions.Add("platformName", "Windows");
browserstackOptions.Add("osVersion", "11");
capabilities.AddAdditionalOption("bstack:options", browserstackOptions);
// for safari
SafariOptions capabilities = new SafariOptions();
capabilities.BrowserVersion = "15.0";
Dictionary<string, object> browserstackOptions = new Dictionary<string, object>();
browserstackOptions.Add("platformName", "OS X");
browserstackOptions.Add("osVersion", "Monterey");
capabilities.AddAdditionalOption("bstack:options", browserstackOptions);
$caps = array(
'bstack:options' => array(
"platformName" => "Windows",
"osVersion" => "11",
),
"browserName" => "Chrome",
"browserVersion" => "102.0",
)
desired_cap = {
'bstack:options' : {
"platformName" : "Windows",
"osVersion" : "11",
},
"browserName" : "Chrome",
"browserVersion" : "102.0",
}
capabilities = {
'bstack:options' => {
"platformName" => "Windows",
"osVersion" => "11",
},
"browserName" => "Chrome",
"browserVersion" => "102.0",
}
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 , and Ventura
|
Sample script showing capability declarations for desktop browsers
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("os", "Windows");
caps.setCapability("os_version", "10");
caps.setCapability("browser", "Chrome");
caps.setCapability("browser_version", "latest"); // can select "latest-beta", "latest-1", "latest-2" ...
var capabilities = {
"os" : "Windows",
"os_version" : "10",
"browserName" : "Chrome", // can select "IE", "Edge", "Firefox" , "Safari"
"browser_version" : "latest" // can select "latest-beta", "latest-1", "latest-2" ...
}
// for chrome
ChromeOptions capability = new ChromeOptions();
capability.AddAdditionalCapability("os", "Windows", true);
capability.AddAdditionalCapability("os_version", "10", true);
capability.AddAdditionalCapability("browser", "Chrome", true);
capability.AddAdditionalCapability("browser_version", "latest", true); // can select "latest-beta", "latest-1", "latest-2" ...
// for firefox
FirefoxOptions capability = new FirefoxOptions();
capability.AddAdditionalCapability("os", "Windows", true);
capability.AddAdditionalCapability("os_version", "10", true);
capability.AddAdditionalCapability("browser", "Firefox", true);
capability.AddAdditionalCapability("browser_version", "latest", true); // can select "latest-beta", "latest-1", "latest-2" ...
// for edge
EdgeOptions capability = new EdgeOptions();
capability.AddAdditionalCapability("os", "Windows");
capability.AddAdditionalCapability("os_version", "10");
capability.AddAdditionalCapability("browser", "Edge");
capability.AddAdditionalCapability("browser_version", "latest"); // can select "latest-beta", "latest-1", "latest-2" ...
// for safari
SafariOptions capability = new SafariOptions();
capability.AddAdditionalCapability("os", "OS X");
capability.AddAdditionalCapability("os_version", "Big Sur"); // can select "Catalina", "High Sierra", etc
capability.AddAdditionalCapability("browser", "Safari");
capability.AddAdditionalCapability("browser_version", "14.0");
$caps = array(
"os" => "Windows",
"os_version" => "10",
"browser" => "Chrome",
"browser_version" => "latest" // can select "latest-beta", "latest-1", "latest-2" ...
)
desired_cap = {
"os" : "Windows",
"os_version" : "10",
"browser" : "Chrome",
"browser_version" : "latest" # can select "latest-beta", "latest-1", "latest-2" ...
}
caps = Selenium::WebDriver::Remote::Capabilities.new
caps["os"] = "Windows"
caps["os_version"] = "10"
caps["browser"] = "Chrome"
caps["browser_version"] = "latest" # can select "latest-beta", "latest-1", "latest-2" ...
my $extraCaps = {
"os" => "Windows",
"os_version" => "10",
"browser" => "Chrome",
"browser_version" => "latest" # can select "latest-beta", "latest-1", "latest-2" ...
}
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"
Selenium capabilities
Here is a list of capabilities offered by Selenium to specify the browser and OS.
If you are writing your tests from scratch, we recommend you use the BrowserStack-specific capabilities as we will add new features (like specifying versions as latest
flags) there, but won’t change the behaviour of the default Selenium capabilities.
Capability | Description | Expected values |
---|---|---|
platformName |
OS you want to test | MAC, WIN8, XP, WINDOWS, ANY, ANDROID. Default: ANY |
browserName |
Browser you want to test | firefox, chrome, internet explorer, safari, opera, edge, iPad, iPhone, android Default: chrome |
browserVersion |
Browser version you want to test | View list of browser versions to update this field. Default: Latest stable version of browser selected. |
Capability | Description | Expected values |
---|---|---|
platform |
OS you want to test | MAC, WIN8, XP, WINDOWS, ANY, ANDROID. Default: ANY |
browserName |
Browser you want to test | firefox, chrome, internet explorer, safari, opera, edge, iPad, iPhone, android Default: chrome |
version |
Browser version you want to test | View list of browser versions to update this field. Default: Latest stable version of browser selected. |
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!