browser_evaluate
Evaluate JavaScript expressions in a page or cross-origin frames, bypassing permission denied errors by executing in the frame's own context.
Instructions
Evaluate a JS expression or function in the page and return the result.
frame_ref: run the JS INSIDE a child frame instead of the top document. Accepts
a frame id ('f1'), an element ref inside the frame ('f1e36'), or an <iframe>
element ref ('e81'). This works for CROSS-ORIGIN frames too — the code runs in
the frame's own context (unlike top-frame JS reaching in via contentDocument,
which the browser blocks). This is the fix for "Permission denied to access
property document on cross-origin object".
Examples: 'document.title' | '() => window.location.href'
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| expression | Yes | ||
| session_id | No | ||
| frame_ref | No |