Skip to main content
POST
/
v1
/
browsers
/
{id}
/
playwright
/
execute
Execute browser-control code
curl --request POST \
  --url https://api.webcompute.dev/v1/browsers/{id}/playwright/execute \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "code": "<string>",
  "pageId": {},
  "timeoutMs": 30000,
  "capture": false,
  "variables": {},
  "variableScopes": {}
}
'

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string
required

Body

application/json
code
string
required

Top-level async Playwright code body. page, context, browser, files, and artifacts are in scope. Maximum 262144 UTF-8 bytes.

pageId
object

Optional canonical page id such as page_tab-1.

timeoutMs
integer
default:30000

Execution timeout in milliseconds.

Required range: 1 <= x <= 120000
capture

Set false to disable all automatic post-step capture, or pass an object to customize screenshot, status, observation, and activity capture.

Available options:
false
variables
object

Bounded string variables made available to Playwright code through the variables global. Runtime validation enforces the UTF-8 byte limit.

variableScopes
object

Bounded variable scope metadata for provided or policy-only variables.

Response

Browser-control execution completed.