To learn more about using JavaScript in LeanFT, see Setting up and working with the JavaScript SDK.
For JavaScript code samples, see Code Samples - JavaScript.

SrfLab

SrfLab

new SrfLab()

The SRF lab, where you can launch browsers or lock devices in SRF.

Methods

launchBrowser(browserCapabilities) → {Promise.<Web.BrowserTO>}

Launches a new browser tab, according to supplied Web.BrowserType or a browser capabilities property bag. Returning an instance of Web.Browser for the launched browser. The returned browser instance is valid until the tab is closed.
Parameters:
Name Type Description
browserCapabilities string | object the type of browser to launch: Possible values: Web.BrowserType, or a property bag defining the browser capabilities.
Properties
Name Type Description
type string if a property bag is supplied, it must have the type key, Possible values: Web.BrowserType.
Returns:
a promise that is fulfilled with the browser instance.
Type
Promise.<Web.BrowserTO>

lockDevice(description, appsToInstallopt, deviceSourceopt) → {Promise.<Mobile.DeviceTO>}

Obtains a device from the SRF Mobile lab and locks it, so that only LeanFT can perform actions on it.
Parameters:
Name Type Attributes Description
description Mobile.Device | object The description of the device or a device capabilities property bag.
appsToInstall Array.<Mobile.Application> <optional>
An Application array of applications to install on the device.
deviceSource Mobile.Device.DeviceSource <optional>
The source location of the device. You can use the DeviceSource object or just pass 'mobile_center', 'amazon_device_farm' or 'any' as a string.
Returns:
a promise that is fulfilled with the locked device.
Type
Promise.<Mobile.DeviceTO>

lockDeviceById(deviceID) → {Promise.<Mobile.DeviceTO>}

Obtains a device from the SRF Mobile lab by deviceID and locks it, so that only LeanFT can perform actions on it.
Parameters:
Name Type Description
deviceID string The device ID used by SRF Mobile lab.
Returns:
a promise that is fulfilled with the locked device.
Type
Promise.<Mobile.DeviceTO>

releaseEnvironment(envToRelease)

Release the allocated device environment.
Parameters:
Name Type Description
envToRelease Web.BrowserTO | Mobile.DeviceTO the browser or device environment to release.