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.

Device

Mobile. Device

new Device(propsopt) → {Device}

The description of a Mobile Device test object.
Parameters:
Name Type Attributes Description
props Object <optional>
Initializes the description using the supplied property bag.
Returns:
the description object that was initialized.
Type
Device

Methods

id(idopt) → {string|Description}

The device ID used by Mobile Center.
Parameters:
Name Type Attributes Description
id string <optional>
When provided, this method acts as a setter and sets the identifier value.
Returns:
If no parameter is provided, the method acts as a getter and returns the current stored identifier value; otherwise it returns 'this' for use with the builder pattern.
Type
string | Description

manufacturer(manufactureropt) → {string|Description}

The device manufacturer name
Parameters:
Name Type Attributes Description
manufacturer string <optional>
When provided, this method acts as a setter and sets the manufacturer value.
Returns:
If no parameter is provided, the method acts as a getter and returns the current stored manufacturer value; otherwise it returns 'this' for use with the builder pattern.
Type
string | Description

model(modelopt) → {string|Description}

The device model name
Parameters:
Name Type Attributes Description
model string <optional>
When provided, this method acts as a setter and sets the model value.
Returns:
If no parameter is provided, the method acts as a getter and returns the current stored model value; otherwise it returns 'this' for use with the builder pattern.
Type
string | Description

name(nameopt) → {string|Description}

The logical name that Mobile Center uses to identify the device.
Parameters:
Name Type Attributes Description
name string <optional>
When provided, this method acts as a setter and sets the name value.
Returns:
If no parameter is provided, the method acts as a getter and returns the current stored name value; otherwise it returns 'this' for use with the builder pattern.
Type
string | Description

osType(osTypeopt) → {string|Description}

The operating system currently running on the device.
Parameters:
Name Type Attributes Description
osType string <optional>
When provided, this method acts as a setter and sets the osType value.
Returns:
If no parameter is provided, the method acts as a getter and returns the current stored osType value; otherwise it returns 'this' for use with the builder pattern.
Type
string | Description

osVersion(osVersionopt) → {string|Description}

The operating system version currently running on the device.

The following symbols are supported:

>, >=, <, <=

For example:

osVersion(">4.0")

osVersion(">=4.1")

Parameters:
Name Type Attributes Description
osVersion string <optional>
When provided, this method acts as a setter and sets the osVersion value.
Returns:
If no parameter is provided, the method acts as a getter and returns the current stored osVersion value; otherwise it returns 'this' for use with the builder pattern.
Type
string | Description

Type Definitions

DeviceOrientation

Possible values for the device orientation type.
Type:
  • Object
Properties:
Name Type Description
portrait string Sets the device in portrait mode.
landscape string Sets the device in landscape mode.

DeviceSource

Possible values for the device source type.
Type:
  • Object
Properties:
Name Type Description
mobile_center string Device is stored on Mobile Center.
amazon_device_farm string Device is stored on an AWS Device Farm.
any string Device is stored either on Mobile Center or an AWS Device Farm.

Keys

Supplies constants representing mobile keyboard keys, which can be used in the input parameter of the Device.sendKey(key) method.
Type:
  • Object
Properties:
Name Type Description
enter string The Enter key. Supported on iOS and Android.
return string The Return key. Supported on iOS.
backspace string The Backspace key. Supported on iOS and Android.
delete string The Delete key. Supported on iOS and Android.
tab string The Tab key. Supported on Android.
escape string The Escape key. Supported on Android.
pageUp string The PageUp key. Supported on Android.
pageDown string The PageDown key. Supported on Android.
end string The End key. Supported on Android.
home string The Home key. Supported on Android.
left string The Left key. Supported on Android.
right string The Right key. Supported on Android.
up string The Up key. Supported on Android.
down string The Down key. Supported on Android.