Device Interactions
Execute an adb shell command on an Android device
Runs an adb shell command on the device and returns stdout. This command is not available for iOS devices. The adbShellCommand should be the shell command without the 'adb shell' prefix (e.g., 'ls /' not 'adb shell ls /'). Use for checking device properties, listing packages, granting permissions, or any operation available through adb.
On a private device any adb shell command runs. On a public device, which is shared infrastructure, commands are restricted to an allowlist and anything outside it comes back as a 400. The allowlist is published in the mobile FAQ.
post/sessions/{sessionId}/device/executeShellCommand
Request
- Base URLhttps://api.us-west-1.saucelabs.com/rdc/v2
- AuthHTTP basic
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Path parameters
sessionIdstring required
The id of the device session
Request body
Example request
{
"adbShellCommand": "ls /"
}Response
Command executed successfully
Example response
{
"stdout": "acct debug_ramdisk keyrefuge sdcard\napex default.prop linkerconfig sepolicy_version\naudit_filter_table dev lost+found spu\nbin dpolicy mnt storage\n"
}Changes
No recorded changes to this operation across all 1 revision of this API.