Browser execute command

Executes a JavaScript script on the device browser application. Supported for Chrome, Safari, and instrumented hybrid apps.

Parameters

Name Type Possible values Description

Device ID*

String

 

The device for this command. By default, this is the device under test (DUT).

JS script

String

 

The JavaScript code to execute.

Repository key

Media

 

The full repository path, including directory and file name, where to locate the JavaScript file.

When using commands that utilize files from the repository, the paths to the files are specified as repository keys. A repository key consists of the subarea and the path to the file.

For example, to specify a file called myImage.jpg stored in the images folder located in the PRIVATE subarea, specify the key as PRIVATE:images/myImage.jpg.

You can select a file that already resides in the Perfecto repository or select a file from your computer that is then uploaded to the Perfecto repository. To learn more about the Perfecto repository, see Manage the repository. Click the Select media link, browse to the file, and then click SELECT.

Timeout

Number

 

The time, in seconds, to wait for the page to load before executing the JavaScript code. The script cannot be executed while the page is in loading state.

webView

Number

 

For hybrid applications: The index number of the webview element.

Comment

String

 

Adds a comment to the script

On-fail Result*

Condition

Ignore | Break | Continue | Abort | Catch

The behavior when the command fails.

* Mandatory parameter