Run Shell Command (FR)
Perfecto Command
mobile:handset:shell
Purpose
Runs an adb shell command on an Android device, for example to list the content of a folder on a device or to show a list of devices connected to a device.
Parameters
Name |
Type |
Possible Values |
Description |
---|---|---|---|
command |
String |
Any adb shell command |
A key-value pair of string to object, where the first part is the command and the second part is the adb shell command. |
Return Value
The shell command line response from the Android device, in the form of a string. The following image shows an example.
Exceptions
String with the error code of the shell command
Examples
Copy
Java sample
Map<String, Object> params1 = new HashMap<>();
params1.put("command","<YOUR SHELL COMMAND HERE>");
String result1 = (String) driver.executeScript("mobile:handset:shell", params1);