execute_js
Run JavaScript code in the live browser page, with support for async functions, return value capture, and iframe targeting. Automate complex scenarios that require direct page context execution.
Instructions
Execute custom JavaScript in the page context with async support, return value capture, and iframe targeting.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | JavaScript code to execute in the page context | |
| async | No | Wrap code in an async function | |
| iframe | No | Execute inside a specific iframe (0 = main frame, 1+ = iframe by index) | |
| timeout | No | ||
| returnValue | No | Return the result of the expression | |
| waitForIframe | No | Wait for the iframe to finish loading before executing | |
| iframeSelector | No | Execute inside iframe matched by CSS selector |