evaluate_script
Execute JavaScript functions in a web page to extract data or perform actions, returning results as JSON for automated testing or content retrieval.
Instructions
Evaluate a JavaScript function inside the currently selected page. Returns the response as JSON, so returned values have to be JSON-serializable.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| function | Yes | A JavaScript function declaration to be executed by the tool in the currently selected page. Example without arguments: `() => { return document.title }` or `async () => { return await fetch("example.com") }`. Example with arguments: `(el) => { return el.innerText; }` | |
| args | No | An optional list of arguments to pass to the function. | |
| dialogAction | No | Handle dialogs while execution. "accept", "dismiss", or string for response of window.prompt. Defaults to accept. |