eval
Run JavaScript expressions in the page's isolated context, preventing window mutations from affecting page scripts; use eval_handle to retain references across calls.
Instructions
Evaluate a JS expression in the page (isolated context per Patchright default — window.X = ... mutations are NOT visible to page JS; use eval_handle to retain references).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| expr | Yes | JS expression. | |
| lease | No | Optional lease token to present if the target session is leased (0.7.0). Threaded per-call; never read from the server's env. | |
| session | No | Optional session name to target (omit for the shared 'default'). On a daemon shared with other agents, pass a UNIQUE name for stateful multi-step work (go→click→fill) so you don't collide on 'default'. | |
| timeout_ms | No | Give up after this long — a busy page starves isolated-world eval too. |