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.
Here is the list of custom capabilities offered by BrowserStack to easily specify the required browser and OS on desktop.
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 and 10 OS X: Snow Leopard , Lion , Mountain Lion , Mavericks , Yosemite , El Capitan , Sierra , High Sierra , Mojave , Catalina |
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" ...
}
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 |
---|---|---|
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 here |
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"
my $extraCaps = {
"os_version" => "11.0", # select "14" for iOS 14
"device" => "Samsung Galaxy S20", # choose "iPhone 12 Pro" etc.
"real_mobile" => "true"
}
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 |
---|---|---|
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. |
browser
and browserName
are both defined, browser
has precedence
(except if browserName
is either android
, iphone
, or ipad
, in which
case browser
is ignored and the default browser on those devices is selected).browser_version
and version
are both defined, browser_version
has precedence.os
and platform
are both defined, os has precedence.os_version
can only be defined when os
has been defined.platform
and os_version
cannot be defined together, if os
has not been defined.ANY
if given to any capability that supports that value is same as the capability preference not specified.Chrome
on desktop when no browser is passed by the user or the selenium API (implicitly).Contact our Support team for immediate help while we work on improving our docs.
Contact our Support team for immediate help while we work on improving our docs.
Thank you for your valuable feedback!