evaluate_script
Execute JavaScript functions in the active Safari page and receive JSON-serializable results for automation and debugging.
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 |
|---|---|---|---|
| args | No | An optional list of element UIDs to pass as arguments. | |
| function | Yes | A JavaScript function declaration to be executed 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; }` |