execute_js
Execute JavaScript on web pages to extract data, trigger dynamic content, and check page state. Returns values from scripts with return statements while creating a new browser instance for each execution.
Instructions
[STATELESS] Execute JavaScript and get return values + page content. Creates new browser each time. Use for: extracting data, triggering dynamic content, checking page state. Scripts with "return" statements return actual values (strings, numbers, objects, arrays). Note: null returns as {"success": true}. Returns values but page state is lost. For persistent JS execution, use crawl with session_id.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
scripts | Yes | JavaScript to execute. Use "return" to get values back! Each string runs separately. Returns appear in results array. Examples: "return document.title", "return document.querySelectorAll('a').length", "return {url: location.href, links: [...document.links].map(a => a.href)}". Use proper JS syntax: real quotes, no HTML entities. | |
url | Yes | The URL to load |