Page tree
Skip to end of metadata
Go to start of metadata

Basic Capabilities

Capabilities describes 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
browserNamestring

default:

  • windows - Chrome
  • mac - Safari

The browser type.

  • chrome
  • safari
  • firefox
  • internet explorer
  • MicrosoftEdge
browserVersionstringlatest version

The 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)
platformName

string

random

The operating system type.

NOTE: can be a conflict with osName value.

  • MAC
  • WINDOWS

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
osNamestring

Operating 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

testName

string
Specifies the test name. This name will appear in SeeTest Reporter and in the generated report.

any string

generateReport

booleanTrue

Should a report be generated for this test.

true/false

takeScreenshots

boolean

True

Take a screenshot for reports and for reflection in execution page in the Cloud.

true/false

newCommandTimeout

integer300

Set the timeout in seconds for each command to be processed.

any number

newSessionWaitTimeout

integer300Set the timeout in seconds for creating a new driver.any number

seleniumScreenshot

booleanfalse

If 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

closePopups

string
or
list of strings

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

More information below.


agentName

StringrandomThe name of the agent that the test will run on.any agent name

maxScreenshotInterval

integer10The 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

reportType

stringboth reports

The 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
useNVbooleanfalse

Enable HAR recording for this test.

More information about HAR recording here.

true/false
ieModebooleanfalse

Enable Internet Explorer compatibility mode in Edge.

NOTE: Works only with browserName "MicrosoftEdge".

This feature is currently limited to one concurrent session

true/false

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

reportUrl

string

A link to view the test report in SeeTest Reporter (if the test is configured to generate a report).

sessionId

string

The session ID of the test.

viewUrl

string

A link to view the test's execution.

Example

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

In order to be able to run the below code you will need

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("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("reportUrl");
String testViewUrl = driver.getCapabilities().getCapability("viewUrl");
String sessionId =  driver.getCapabilities().getCapability("sessionId"); //will return the session id as String.
  • No labels