run_script_background
Run a JavaScript automation file from a path or URL in the background and return immediately with task info, saving script output to JSON and log files.
Instructions
📁 Execute a JavaScript file in the background with browser automation. Returns immediately with task info while script runs in background. Output is saved to files. 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. | |
| projectFolder | No | output folder: Set this to specify where output files (.json and .log) will be saved. If not provided, defaults to system temp directory /tmp/{session_id}. Example: '/Users/username/my-project/outputs' | |
| autoCloseBrowser | No | Automatically close the browser after script execution completes. Default: true |