Run JavaScript inside an extension own page
browser_run_in_extensionEvaluates a JavaScript expression in an extension page context with browser.* APIs and DOM access, opening a temporary background tab to inspect or drive extensions without a CLI.
Instructions
Evaluate an expression inside the context of one of the extension own pages, where the WebExtension APIs (browser.*) and the extension DOM are available. It opens the page in a background tab, evaluates, then closes the tab. This is the general escape hatch behind browser_extension_storage: with it an extension that exposes no command line of its own can still be inspected and driven. The expression should return a JSON value or a string.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Extension id | |
| page | No | Relative page to run in (default: the options page) | |
| expression | Yes | JavaScript expression; may return a Promise |