browser_evaluate
Evaluates a JavaScript expression once in an attached browser tab, awaits a returned function's Promise, and returns JSON or a DOM element reference via cached cursors.
Instructions
Evaluate expression once; call a returned function once and await its Promise, without user activation. Use an async IIFE for statements. capture_truncated marks capture loss; required_chars/next_item signal page-budget needs. cursor reads cache without re-execution.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| frame | No | Child frame: at least one of url/title/path. url/title exact; path=unique nested CSS iframe steps (e.g. ["#frame"]); exclusive with frame_id. | |
| cursor | No | Exactly one of expression/cursor. Cursor reads cached JSON; omit frame/frame_id and result_type=element. | |
| frame_id | No | ||
| max_chars | No | Per-page JSON value budget, excluding metadata; capture cap 1M chars / 50000 nodes / depth 8. | |
| expression | No | ||
| tab_handle | Yes | ||
| timeout_ms | No | ||
| result_type | No | element: return one connected DOM element as a ref. | json |
| dialog_policy | No | accept/dismiss auto-handle dialogs and return their messages. | ask |