Skip to main content
POST
/
devices
/
{deviceId}
/
browser
/
execute-script
Execute JavaScript in the device's Chrome browser (CDP)
curl --request POST \
  --url https://api.mobilerun.ai/devices/{deviceId}/browser/execute-script \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "script": "<string>"
}
'
{
  "result": "<unknown>",
  "$schema": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer token via Authorization header

Headers

X-Device-Display-ID
integer<int64>
default:0
Required range: x >= 0

Path Parameters

deviceId
string
required

Body

application/json
script
string
required

JavaScript expression to evaluate in the device's foreground Chrome tab (CDP Runtime.evaluate). It is an expression, not a function body — the expression's value is returned (no top-level 'return'). Must evaluate to a JSON-serializable value; wrap multi-statement logic in an IIFE, e.g. (() => { ... ; return x })().

Response

OK

result
any
required

JSON-serialized return value of the script (null if it returned undefined). Non-JSON-serializable numbers (Infinity, NaN, -0) are returned as their string representation.

$schema
string<uri>
read-only

A URL to the JSON Schema for this object.

Example:

"https://example.com/schemas/ExecuteScriptOutputBody.json"