Legacy | Open device

  • Command: device

  • Subcommand: open

  • 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

Allocates one or more devices to the current script execution and prepares them for usage. Allocated devices are available to the execution without interruption until either the Close device function is used or the script ends.

This command allows you to run automation scripts without having to manually open the devices in the Perfecto UI. Furthermore, it allows automation scripts to be managed by an execution center, such as QC.

This setting is essential to disable device video in tests, in addition to setting the Video recording parameter value to norecord (False).

For best practice, use the automatic device allocation when running the script on a single device, or if the required devices should be available with no waiting time. Use the manual device allocation when running a script with a lenient timeframe, or if multiple devices are required and the testing requires each device for an extended time. The Open device and Close device functions enable users to open required devices, and release those that are not in use making them available for other users.

All allocated devices will close once the script execution is completed, unless they are open in the IDE.

To guarantee no interruption, allocated devices must be reserved.

Opened devices are automatically in their default state orientation and home screen.

Parameters

Name Value Default Description
deviceID*     The device for this command. It is possible to select multiple devices.
script

script (True)

nonscript (False)

True

Specify whether to run the open script or not.

True (default) - run the open script.

False - Don't run the open script.

allocation

wait (Wait)

nowait (no wait)

Wait

The behaviour in case the requested device is unavailable.

Wait - The script will be in 'Pending' until all requested devices become available.

No wait - The script will fail if one of the requested devices is not 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.
video

record (True)

nonrecord (False)

True

The video recording for the selected device. This is available once the device is closed.

True - Video recording enabled

False - Video recording disabled

audio

hasaudio (True)

noaudio (False)

False

The audio recording for the selected device. This is available once the device is closed.

True - Audio recording enabled

False - Audio recording disabled

Applicable only for iOS fast video devices

mode

add (Add)

replace (Replace)

Add

The allocation mode for the selected device. A device can be allocated as an addition to other open devices, or allocated as a single device closing any open devices being used in the script.

Add - Previously allocated devices will remain allocated

Replace - Previously allocated devices will be released

* 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=open&param.deviceId=6370E775
Copy

JSON request

{
    "executionId":"john@perfectomobile.com_controller_16-11-02_09_02_04_781",
    "reason":"Success",
    "timer.elapsed":"10360",
    "testGridReportUrl":"https://mycloud.reporting-stg.perfectomobile.com?externalId[0]=john@perfectomobile.com_controller_16-11-02_09_02_04_781",
    "timer.ux":"0",
    "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=372b9469-5003-4054-b803-1b9cd2feaea8",
    "description":"Success",
    "timer.system":"10360",
    "reportKey":"PRIVATE:controller/161102/controller_16-11-02_09_02_04_781.xml",
    "completed":"true",
    "flowEndCode":"SUCCEEDED",
    "timer.device":"0"}