evaluate_mainworld
Execute synchronous JavaScript in the browser's main execution context to access framework states, window globals, and page-defined variables for web automation.
Instructions
Execute JavaScript in the page's MAIN execution context (same as browser DevTools console).
USE THIS TOOL WHEN YOU NEED TO:
Access window globals like window.NUXT, window.NEXT_DATA, window.APP_STATE
Read framework hydration state (Next.js, Nuxt.js, Vue, React, etc.)
Access variables/functions defined by the page's own scripts
Interact with third-party libraries loaded by the page (jQuery, etc.)
CRITICAL LIMITATIONS:
NO async/await support - scripts must be SYNCHRONOUS only
NO Promise, fetch(), setTimeout callbacks
Script will be REJECTED if it contains async patterns
EXAMPLES:
"window.NUXT" → Returns Nuxt.js state
"window.NEXT_DATA" → Returns Next.js props
"typeof jQuery !== 'undefined' ? jQuery.fn.jquery : null" → Check jQuery version
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pageId | No | Page ID (uses active page if not specified) | |
| script | Yes | SYNCHRONOUS JavaScript expression. No async/await/Promise/fetch allowed. Returns the expression result. |