LeanFT and Selenium capabilities

This topic defines the supported capabilities for running tests remotely in LeanFT and Selenium.

Define capabilities for browsers

The following examples illustrate how to use capabilities to define the browsers used in your web testing environment.

Tip: If you upload these tests to SRF, the browser definition in the code is ignored. For uploaded tests, select the browser directly in SRF's environment selection dialog box. For more details, see Environment.

LeanFT

In LeanFTJava, define your browser capabilities as follows:

BrowserDescription desc = new BrowserDescription ();

desc.set(<capability name>, <capability value>);

Or, use the builder syntax:

BrowserDescription desc = new BrowserDescription.builder().set(<capability name>, <capability value>).build();

In LeanFT C#, define your browser capabilities as follows:

var desc = new BrowserDescription ();

desc.Set(<capability name>, <capability value>);

var browser = SrfLab.LaunchBrowser(desc);

In LeanFT JavaScript, define your browser capabilities as follows:

LFT.SrfLab.launchBrowser({

<capability name>: <capability value>

}).then…;

Selenium

In Selenium Java, define your browser capabilities as follows:

static DesiredCapabilities capabilities = DesiredCapabilities.<browser type>();

 

@BeforeClass

public static void openBrowser() throws MalformedURLException{

capabilities.setVersion(<browser version);

capabilities.setCapability(<capability name>, <capability value>);

In Selenium C#, define your browser capabilities as follows:

DesiredCapabilities dc;

RemoteWebDriver driver;

[OneTimeSetUp]

public void Init()

{

dc = DesiredCapabilities.<browser type>();

dc.SetCapability(<capability name>, <capability value>);

driver = new RemoteWebDriver(new Uri("https://ftaas.saas.hpe.com/wd/hub/"), dc);

In Selenium JavaScript, define your browser capabilities as follows:

var capabilities = {

<capability name>: <capability value>

};

driver = new webdriver

.Builder()

.withCapabilities(capabilities)

.build();

In Selenium Ruby, define your browser capabilities as follows:

caps = Selenium::WebDriver::Remote::Capabilities.chrome(
 :<capability name> => "<capability value>"
)

For more details, see Browser capability reference.

Back to top

Define capabilities for devices

The following examples illustrate how to use capabilities to define the devices used in your mobile testing environment.

LeanFT

In LeanFTJava, define your device capabilities as follows:

DeviceDescription desc = new DeviceDescription ();

desc.set(<capability name>, <capability value>);

Or, use the builder syntax:

DeviceDescription desc = new DeviceDescription .builder().set(<capability name>, <capability value>).build();

In LeanFTC#, define your device capabilities as follows:

var desc = new DeviceDescription();

desc.Set(<capability name>, <capability value>);

var device = SrfLab.LockDevice(desc);

In LeanFTJavaScript, define your device capabilities as follows:

LFT.SrfLab.lockDevice({

<capability name>: <capability value>

}).then…;

For more details, see Device capability reference.

Back to top

Define capabilities for reporting

Reporting capabilities are supported for Selenium only.

See examples below for details on how to use reporting capabilities in Selenium tests. For more details, see Reporting capability reference.

JavaScript

The following example illustrates how to use capabilities to define reporting options for your Selenium tests.

var capabilities = {

browserName: browserType

, version: browserVersion

, platform: platform

, tags: ["examples"]

, testName: burstTestName

, SRF_CLIENT_ID: <client ID value>

, SRF_CLIENT_SECRET: <client secret value>

, reportingEnabled: <reportingEnabled value>

, saveSnapshots: <saveSnapshot value>

, saveVideo: <saveVideo value>

};

driver = new webdriver.Builder().withCapabilities(capabilities)

.usingServer("https://"+srfUrl+'/wd/hub')

.usingHttpAgent(new HttpsProxyAgent(proxy))

.build();

Java

The following example illustrates how to use capabilities to define reporting options for your Selenium tests.

static DesiredCapabilities capabilities = DesiredCapabilities.chrome();

capability.setCapability("reportingEnabled", <reportingEnabled value>);

capability.setCapability("saveSnapshots", : <saveSnapshot value>);

capability.setCapability("saveVideo", <saveVideo value>);

Back to top

Browser capability reference

Use the following capabilities to define the browser used to run your test.

osType / osVersion Operating system type and version

LeanFT only.

String (case insensitive).

For more details, see the LeanFT Product Availability Matrix.

platform Operating system type and version

Selenium only.

String, case insensitive.

One of the following:

  • Windows 7
  • Windows 8.1
  • Windows 10
  • Ubuntu 16.04
  • osx HighSierra

resolution

Browser resolution

String with the following syntax: <width>x<height>

Windows / Linux:

  • 800x600
  • 1024x768 (default if no value provided)
  • 1280x1024
  • 1366x768
  • 1600x900
  • 1920x1080

Mac:

  • 1024x768 (default if no value provided)
  • 1280 x 800
  • 1280 x 1024
  • 1366 x 768
  • 1440 x 900
  • 1600 x 900
  • 1600 x 1000
  • 1680 x 1050
  • 1920 x 1080
  • 1920 x 1200
type

Browser type

LeanFT only

enum: String, with the enum name (BrowserType)

string: Case insensitive, one of the following:

  • Chrome
  • Internet Explorer
  • Firefox
  • Safari
browserName

Browser type

Selenium only

string: Case insensitive, one of the following:

  • Chrome
  • Internet Explorer
  • Firefox
  • Safari
version Browser version

String (case insensitive). A number indicating the browser version, or latest to use the latest available version.

Available versions include:

  • Chrome: last 5 versions, beta, latest to use the latest available version.
  • Firefox: last 5 versions, beta, latest to use the latest available version.
  • Safari: 11.0
  • Internet Explorer: 11

For more details, see the LeanFT Product Availability Matrix.

Back to top

Device capability reference

Use the following capabilities to define the device used to run your test.

id Mobile Center device ID String (case insensitive)
manufacturer Device manufacturer String (case insensitive)
model Device model String (case insensitive)
name Mobile Center device name String (case insensitive)

For details about supported devices, see the Mobile Center Help.

Back to top

Reporting capability reference

Selenium only.

Use the following capabilities to define reporting options for your test run:

reportingEnabled

Determines whether SRF reporting is enabled.

  • true. SRF reporting enabled (default)
  • talse. SRF reporting disabled.

Note: If False, saveSnapshots and saveVideo are set to never.

saveSnapshots

Determine whether snapshots are saved for steps in your test run.

Supported options include:

  • never
  • always (default)
  • on-error (for failures only)
saveVideo

Determines whether video recordings are saved for each test run. For more details, see Define run settings.

Supported options include:

  • never
  • always (default)
  • on-error (for failures only)

Back to top

See also: