Skip to main content

Capabilities In Selenium Tests

Basic Capabilities

Capabilities are a series of key/value pairs that can customize or configure a Device or Browser session for testing to Selenium or Appium WebDriver.

This section describes the available capabilities and examples of their usage.

You can start developing a new framework, or migrate your existing Selenium tests and execute them with higher performance and stability rates. 

See below for the list of basic Desired Capabilities.

KeyTypeDefault ValueDescriptionPossible Values
browserNamestringdefault:



* windows - Chrome

* mac - Safari
The browser type.* chrome

* safari

* firefox

* internet explorer

* MicrosoftEdge
browserVersionstringlatest versionThe browser version.* browser version

* "latest" : latest version of this browser type in the Cloud

* "latest-x" : where x is any number of versions before latest (e.g. if latest is 70 so latest-3 is 67)
platformNamestringrandomThe operating system type.



NOTE: can be a conflict with osName value.
* MAC

* WINDOWS
tip

For more basic capabilities, visit Selenium's support page.

Continuous Testing Capabilities

The following list describes Continuous Testing specific capabilities that can be set for browser testing:

KeyTypeDefault ValueDescriptionPossible Values
osNamestringOperating system to run the browser on. 



Case sensitive.



NOTE: can be a conflict with platformName value.
Mac OS X Catalina

Mac OS Big Sur

Mac OS Monterey

Windows 10

Windows 11
testNamestringSpecifies the test name. This name will appear in SeeTest Reporter and in the generated report.any string
generateReportbooleanTrueShould a report be generated for this test.true/false
takeScreenshotsbooleanTrueTake a screenshot for reports and for reflection in execution page in the Cloud.true/false
newCommandTimeoutinteger300Set the timeout in seconds for each command to be processed.any number
newSessionWaitTimeoutinteger300Set the timeout in seconds for creating a new driver.any number
seleniumScreenshotbooleanfalseIf set to true, will take screenshots using selenium grid and not native OS API. This means the test will take longer.



NOTE: add this capability in tests that handle multiple browser windows in order to get a correct report.
true/false
closePopupsstring

or

list of strings
Provide information on which native popups to close (and how).



More information below.
agentNameStringrandomThe name of the agent that the test will run on.any agent name
maxScreenshotIntervalinteger10The maximum time between consecutive screenshots.

This capability is used to force the test to take screenshot when there are is a long time between 2 consecutive steps that change the state of the browser.
any number
reportTypestringboth reportsThe type of the report that should be generated for the test.



NOTE: reportType with value "screenshot" will generate an empty video report, the HTML report will be found in the video report as an attachment
* "video" - for video report

* "screenshot" - for HTML report
useNVbooleanfalseEnable HAR recording for this test.



More information about HAR recording here.
true/false
ieModebooleanfalseEnable Internet Explorer compatibility mode in Edge.



NOTE: Works only with browserName "MicrosoftEdge".



This feature is currently limited to one concurrent session
true/false
info

Digitalai capabilities will have digitalai prefix

Handling native OS popups

If during a selenium web test, the browser or OS displays a native popup that the user wants to close, he can specify how to close this popup.

Using the capability closePopups the user can specify one or more expressions that specify which native popups to look for and if found which button to click.

The user can specify one expression or a list of expressions.

For Windows each expression is in the form <regex>::<button-name> where

  • regex - Find a popup with a title that contains the regex

  • button-name - Name of a button to click on the associated popup

Native popups handling code - Windows

dc.setCapability("closePopups", "Windows Security::OK"); // Close popup to confirm client-certificate selection for Edge
  or
dc.setCapability("closePopups", new String [] { "Windows Security::OK", "TitleRegex::Button" });

For macOS each expression should follow one of the following syntax formats

  • <text-to-find>::<button-name> - This will search for a popup with text-to-find in the browser's process and will press the button with button-name.

  • <text-to-find>@<process-name>::<button-name> - This will search for a popup with text-to-find in the process process-name and will press the button with button-name.

Native popups handling code - MacOS

// Example code to close popup from MacOS keychain security agent
dc.setCapability("closePopups", new String [] { "wants to sign using key@SecurityAgent::Always Allow" });

A test that has a valid closePopups capability will search for a popup every X seconds where X is 5 by default.
The default can changed by setting the property popup-monitor-interval-in-seconds in the config/application.properties file. 

Returned Capabilities

The following list describes Continuous Testing specific capabilities that returns with the driver.

KeyTypeDescription
reportUrlstringA link to view the test report in SeeTest Reporter (if the test is configured to generate a report).
sessionIdstringThe session ID of the test.
viewUrlstringA link to view the test's execution.
reportTestIdstringThe test ID in the reporter

Example

Below you can find an example written in Java specifying the capabilities above.

warning

Selenium- Grid Execution

DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability("username", "<cloudUsername>");
dc.setCapability("password", "<cloudPassword>");
dc.setCapability("projectName", "<cloudProject>"); //only required if your user has several projects assigned to it. Otherwise, exclude this capability.
//dc.setCapability("accessKey", "<accessKey>"); // can be use instead of username,password and project.
dc.setCapability("generateReport", true);
dc.setCapability("testName", "<testName>");
dc.setCapability(CapabilityType.PLATFORM, Platform.WIN10);
dc.setCapability(CapabilityType.BROWSER_VERSION, "93.0");
dc.setCapability(CapabilityType.BROWSER_NAME, BrowserType.FIREFOX);
dc.setCapability("newCommandTimeout", 500);
dc.setCapability("newSessionWaitTimeout", 500);
dc.setCapability("digitalai:agentName", "<agentName>");
dc.setCapability("maxScreenshotInterval", 10);
//dc.setCapability("seleniumScreenshot", true);
dc.setCapability("reportType", "video");

RemoteWebDriver driver = new RemoteWebDriver(new URL(cloudurl + "/wd/hub/"), dc);
String testReportUrl = driver.getCapabilities().getCapability("digitalai:reportUrl");
String testViewUrl = driver.getCapabilities().getCapability("digitalai:viewUrl");
String sessionId = driver.getCapabilities().getCapability("sessionId"); //will return the session id as String.
String reportTestId = driver.getCapabilities().getCapability("digitalai:reportTestId");