execute_js
Run JavaScript in the page's main world to read or alter the DOM, extract data, or test interactions. Returns the result of the last executed expression.
Instructions
Run JavaScript in the page (MAIN world). Requires the extension's "Allow user scripts" toggle; errors explain setup if disabled.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | JS evaluated in the page; the value of the last expression is returned | |
| tab_id | No | Target tab; omitted = last tab navigated in this session, else the active one | |
| frame_id | No | Target iframe id from get_frames; omitted = main frame | |
| max_length | No | Max output chars |