Legacy | Browser execute
-
Command: browser
-
Subcommand: execute
-
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
Executes a JavaScript script on the device browser application. Supported for Chrome, Safari, and instrumented hybrid apps.
Parameters
Name | Value | Default | Description |
---|---|---|---|
deviceID* | The device for this command. | ||
script |
The JavaScript code to execute. Copy
Example
|
||
repositoryFile |
The full repository path, including directory and file name, where to locate the JavaScript script. Example: Click browse and navigate to the file. |
||
timeout | 30 |
The time, in seconds, to wait for the page to be loaded in order to execute the JavaScript code. The JavaScript code cannot be executed while the page is in loading state. |
|
webView | 1 | The index number of the web view in a hybrid application. | |
framework |
appium-1.3.4 (Appium) perfectoMobile (PerfectoMobile) |
PerfectoMobile |
The automation framework. PerfectoMobile (default) Appium |
* Mandatory
Request& Response
Request
https://mycloud.perfectomobile.com/services/executions/john@perfectomobile.com_controller_16-12-07_08_30_54_151?operation=command&securityToken=<your_token>&command=browser&subcommand=execute¶m.deviceId=2ACB96B8¶m.repositoryFile=PRIVATE:media/scripts/hello.js
JSON response
{
"reason":"Success",
"timer.elapsed":"578",
"returnValue":"OK",
"testGridReportUrl":"https://mycloud.reporting-stg.perfectomobile.com?externalId[0]=john@perfectomobile.com_controller_16-12-07_08_30_54_151",
"description":"Success",
"timer.system":"15",
"completed":"true",
"flowEndCode":"SUCCEEDED",
"executionId":"john@perfectomobile.com_controller_16-12-07_08_30_54_151",
"timer.ux":"563",
"singleTestReportUrl":"https://mycloud.perfectomobile.com/nexperience/singletest/report/?reportRepositoryKey=PRIVATE:controller/161207/controller_16-12-07_08_30_54_151.xml&ownerId=john@perfectomobile.com&sharingCode=a8d8ba68-ee11-4594-a83a-2eca62034d2c",
"reportKey":"PRIVATE:controller/161207/controller_16-12-07_08_30_54_151.xml",
"timer.device":"563"}