Execute Playwright/TypeScript code against the browser
Execute arbitrary Playwright code in a fresh execution context against the browser. The code runs in the same VM as the browser, minimizing latency and maximizing throughput. It has access to 'page', 'context', and 'browser' variables. It can `return` a value, and this value is returned in the response.
/browsers/{id}/playwright/executeExecute arbitrary Playwright code in a fresh execution context against the browser.
The code runs in the same VM as the browser, minimizing latency and maximizing throughput.
It has access to 'page', 'context', and 'browser' variables.
It can return a value, and this value is returned in the response.
Authorization
bearerAuth In: header
Path Parameters
Browser session ID
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Request to execute Playwright code
Response
Code executed successfully
Result of Playwright code execution
curl -X POST "https://example.com/browsers/string/playwright/execute" \ -H "Content-Type: application/json" \ -d '{ "code": "string" }'{ "success": true, "result": null, "error": "string", "stdout": "string", "stderr": "string"}{ "code": "string", "message": "string", "details": [ { "code": "string", "message": "string" } ], "inner_error": { "code": "string", "message": "string" }}{ "code": "string", "message": "string", "details": [ { "code": "string", "message": "string" } ], "inner_error": { "code": "string", "message": "string" }}