Evaluate JavaScript
browser_evalEvaluates a JavaScript expression in the page and returns its result as a string or capped JSON, enabling programmatic reads and one-off DOM operations beyond indexed actions.
Instructions
Evaluate one JavaScript expression in the page this session owns and return what it produced: a string as itself, any other value as JSON, capped so one dump cannot crowd out the conversation. Use it for a programmatic read the indexed action space cannot express, or a one-off DOM operation. It runs on this session's one CDP connection: never start a second client — a raw websocket, a puppeteer/playwright script, another browser-harness daemon — because Chrome 144+ asks "Allow remote debugging?" once per connection and two drivers race each other on the same page. The expression gets no user gesture, a thrown error comes back as text, and it produces no observation: call browser_page before the next browser_act.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| expression | Yes | The JavaScript expression to evaluate in the page. | |
| timeout_ms | No | How long an awaited promise may take, in milliseconds. Default 30000, at most 120000. |