Skip to main content
POST
Execute Playwright/TypeScript code against the browser

Authorizations

Authorization
string
header
required

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

Path Parameters

id_or_name
string
required

Browser session ID or name

Body

application/json

Request to execute Playwright code

code
string
required

TypeScript/JavaScript code to execute. The code has access to 'page', 'context', and 'browser' variables. It runs within a function, so you can use a return statement at the end to return a value. This value is returned as the result property in the response. Example: "await page.goto('https://example.com'); return await page.title();"

executor
string

Name of a Playwright executor. Calls with the same name run in the same executor, one at a time; the first call with a new name creates it. Calls on different executors run concurrently. 'default' names the executor that runs calls without a name.

Pattern: ^[A-Za-z0-9_-]{1,64}$
Example:

"checkout"

timeout_sec
integer
default:60

Maximum execution time in seconds. Default is 60.

Required range: 1 <= x <= 300

Response

Code executed successfully

Result of Playwright code execution

success
boolean
required

Whether the code executed successfully

error
string

Error message if execution failed

result
any

The value returned by the code (if any)

stderr
string

Standard error from the execution

stdout
string

Standard output from the execution

tab
object

The tab 'page' was bound to for this call. Absent if the call failed before binding a tab.