Legacy | Select device

  • Command: device

  • Subcommand: select

  • Supported Platforms: Native (legacy), UFT (legacy), Selenium, Appium

    All commands must be executed using the same framework. Sharing the execution ID between different frameworks is not possible. This means that if you work with a Selenium/Appium driver, you need to call the commands using the Selenium/Appium driver (or, in the case of Reporting commands, through the Reporting SDK that works with the driver) and not as part of a UFT test or another framework.

  • Supported OS: Android, iOS

Description

Enables selecting a device according to device attributes instead of a specific device ID. For example, specifying an iPad 4 model will randomly select an available iPad 4 device.

When you define multiple parameters (such as Model and OS Version), the command will select a single device that matches all of the defined requirements. Use Select Device when you would like to broaden the range of potential device options according to the specified attributes.

All Select Device parameters accept regular expressions, including wildcards. The parameters are case insensitive.

For more information, see Use the select device command.

Parameters

Name Value Default Description
variable     The variable to receive the device value.
os

Android (Android)

iOS (iOS)

BlackBerry (BlackBerry)

Symbian (Symbian)

Windows-Mobile (Windows-Mobile)

Windows Phone (Windows Phone)

  The name of the device's operating system.
osVersion     The version of the device's operating system.
osBuild     The build number of the operating system of the device requested for allocation.
cpuArch     CPU Architecture of the device to select
manufacturer     The manufacturer of the device. For example: Samsung, Apple, Nokia, HTC, ...
model     The model of the device. For example: iPhone-5S, Galaxy S III, Xperia Z, 9100, HTC One, ...
resolution     Resolution of the device screen.
operator     The device's network.
location     The location of the device.
description     The description of the device.
automationInfrastructure    

Displays the automation infrastructure configured for the OS version running on the device.

For iOS devices values:

UIAutomation - devices running iOS 10-

XCUITest - devices running iOS 10+

For Android devices values:

UIAutomator1 - devices running Android 5-

UIAutomator2 - devices running Android 5.1+.

automaticOperator     Indicates if the device should supply the operator identity, based on the installed SIM card.
allocation

wait (Wait)

nowait (No wait)

No wait

The behaviour in case the requested device is unavailable.

Wait- The script will be in 'Pending' until any of the matching devices become available

No wait- The script will fail if none of the matching devices is available

timeout    

The waiting time, in minutes, for the device to be available.

This parameter is only relevant when using Wait as the allocation policy.

datatable     A datatable, will return the selected devices. The data table should have a single column of type Handset.To use the datatable with other functions (e.g. device info), in the DeviceID parameter select the datatable.
persona    

The name of a pre-defined persona.

Georgia

Peter

Ross

Sam

Sara

repositoryFile    

The repository key of a defined persona json file in the media repository.

Example: PRIVATE:Personas/MyPersona.json

operability.score    

The Operability Score parameter selects the most stable device that matches the requested filter. The default is Any.

Best First - selects one of the devices with the highest operability score available. If the command was requested to populate a data table, it will populate the devices sorted according the operability score.

Error Free - selects one of the devices with no operability error. If the command was requested to populate a data table, it will populate the data table only with devices with no operability error.

Any - Does not select or sort according to the operability score.

* Mandatory parameter

Request & Response

Copy

Request

https://mycloud.perfectomobile.com/services/executions/john@perfectomobile.com_controller_16-11-02_09_02_04_781?operation=command&securityToken=<your_token>&command=device&subcommand=select&param.os=android&param.manufacturer=Samsung&param.model=Galaxy%20S5
Copy

JSON response

{
    "executionId":"john@perfectomobile.com_controller_16-11-02_09_02_04_781",
    "reason":"Success",
    "returnValue":"[6370E775]",
    "testGridReportUrl":"https://mycloud.reporting-stg.perfectomobile.com?externalId[0]=john@perfectomobile.com_controller_16-11-02_09_02_04_781",
    "singleTestReportUrl":"https://mycloud.perfectomobile.com/nexperience/singletest/report/?reportRepositoryKey=PRIVATE:controller/161102/controller_16-11-02_09_02_04_781.xml&ownerId=john@perfectomobile.com&sharingCode=e967892e-5541-4b12-aa04-dc039ed8908f",
    "description":"Success",
    "reportKey":"PRIVATE:controller/161102/controller_16-11-02_09_02_04_781.xml",
    "completed":"true",
    "flowEndCode":"SUCCEEDED"}