run_script
Execute JavaScript files from local disk or remote URLs with browser automation access to build complex, reusable workflows; provide scriptPath or scriptUrl.
Instructions
📁 Execute a JavaScript file from local disk path or remote URL with access to browser automation. Use for complex automation scripts or reusable workflows. Must provide either scriptPath OR scriptUrl (not both).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | No | Arguments to pass to the script. Common: {query: 'search term', url: 'target.com'} | |
| scriptUrl | No | Remote URL to the JavaScript file (e.g., 'https://example.com/scripts/automation.js'). Cannot be used with scriptPath. | |
| sessionId | No | Session ID to use for script execution. If not provided, uses current session. If provided, will connect to the specified session's browser. | |
| screenshot | No | Take a screenshot after script execution. Default: false | |
| scriptPath | No | Local disk path to the JavaScript file (e.g., 'scripts/login-workflow.js'). Cannot be used with scriptUrl. | |
| autoCloseTab | No | Automatically close the tab after script completes (only works when createNewTab is true). Helps prevent tab accumulation. | |
| createNewTab | No | Create a new tab for this script execution. Each script runs in isolation with its own tab. Useful for running multiple scripts in parallel without interference. |