browser_evaluate
Execute JavaScript in the active page or inside a specified iframe. Choose isolated world for stealth or main world to access page-defined globals.
Instructions
Evaluate JavaScript in the active page. Pass 'function' for a function body, 'expression' for a plain expression, or 'script' (deprecated). By default JS runs in an isolated stealth world (DOM is shared, but the page's own window globals are NOT visible). Set world:'main' to run in the page's real world — required to read or call globals the page defined (e.g. a page-registered callback). Pass frameSelector to run inside a specific iframe (including cross-origin ones, e.g. a captcha widget hosted on a different domain) instead of the top-level page — same CSS selector browser_click/browser_fill/browser_type already accept.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| world | No | Execution world. 'isolated' (default) = stealth, page globals hidden; 'main' = page's real world, page globals visible/callable. | |
| script | No | ||
| function | No | ||
| expression | No | ||
| frameSelector | No | Run inside this iframe (CSS selector) instead of the top-level page — reaches cross-origin iframe content that plain JS (element.contentDocument) cannot, the same way browser_click/browser_fill/browser_type already do. |