Run Custom Script
AI-generatedSummary
Execute custom JavaScript in a Puppeteer page and return normalized items, optionally capturing binary downloads.
Inputs
- scriptCode (required) — JavaScript code to execute with Puppeteer. Access to $page, $browser, $puppeteer vars.
- batchSize — Maximum number of pages to open simultaneously. More pages will consume more memory and CPU.
- browserWSEndpoint — WebSocket URL of the browser to connect to; empty launches a local browser.
- device — Device to emulate; see available devices in the UI.
- executablePath — Path to a bundled Chromium executable; ignored when using a WebSocket endpoint.
- headers — HTTP headers to send with requests; can be added multiple times.
- fileName — File name for binary output; only relevant for PDF or screenshot operations.
- launchArguments — Additional command‑line arguments passed to the browser launch.
- timeout — Maximum navigation time in milliseconds; 0 disables timeout. Has no effect on Run Custom Script.
- protocolTimeout — Maximum time to wait for a protocol response; 0 disables timeout.
- waitUntil — Navigation lifecycle event that signals success; defaults to 'load'.
- pageCaching — Enable page‑level caching; defaults to true.
- headless — Run browser in headless mode; defaults to true.
- shell — Use Chrome Headless Shell; requires headless mode enabled.
- stealth — Enable stealth plugin to evade detection.
- humanTyping — Enable human typing mode; provides .typeHuman() helper.
- captureDownloads — Capture any downloaded files as binary data and return them.
- humanTypingOptions — Options for human typing delays and typo chances.
- proxyServer — Custom proxy configuration string for Puppeteer.
- addContainerArgs — Add default container launch arguments for sandbox restrictions.
Output shape
array of normalized items; may include a 'binary' property containing base64‑encoded file data when captureDownloads is true
If captureDownloads is enabled, the first items in the array may contain a 'binary' object with data, filename, and mimeType; otherwise the output consists only of JSON fields.
Examples
Example 1: Extract public IP address
Set Script Code to navigate to https://httpbin.org/ip and return [{ ip: ipData, ...$json }]; all other options use defaults.
Example 2: Download a PDF file
Enable Capture Downloads, run a script that triggers a download, and return binary data via the 'binary' field.
Example 3: Scrape page HTML
Navigate to a URL in Script Code and return [{ html: await $page.content(), ...$json }]; use default options.