browser_run_code_unsafe
Execute arbitrary Playwright JavaScript in the browser server process to automate page interactions, with the caveat that it is RCE-equivalent and unsafe for untrusted code.
Instructions
Run a Playwright code snippet. Unsafe: executes arbitrary JavaScript in the Playwright server process and is RCE-equivalent.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | A JavaScript function containing Playwright code to execute. It will be invoked with a single argument, page, which you can use for any page interaction. For example: `async (page) => { await page.getByRole('button', { name: 'Submit' }).click(); return await page.title(); }` | |
| session | No | Session id (default "default"). Each session is an isolated browser (own cookies, tabs) that runs in parallel with the others. Created on first use. | |
| filename | No | Load code from the specified file. Relative file names are resolved against the workspace root. If both code and filename are provided, code will be ignored. |