Actions10
Screenshot
AI-generatedOverview
This node allows direct control of a Chromium browser instance using the Playwright library connected via the Chrome DevTools Protocol (CDP) URL. It supports various browser automation operations such as navigating to URLs, clicking elements, filling inputs, pressing keys, waiting for page events or selectors, and capturing screenshots.
The Screenshot operation captures an image of the current page in the browser. It can capture either just the visible viewport or the entire full page, with configurable JPEG quality.
Common scenarios:
- Automating website testing by taking screenshots after navigation or interaction.
- Capturing visual snapshots of web pages for monitoring or archival purposes.
- Integrating browser automation into workflows that require dynamic content rendering before screenshotting.
Example:
- Connect to a running Chromium instance via CDP URL.
- Navigate to a product page.
- Capture a full-page screenshot at 90% JPEG quality.
- Use the screenshot binary data downstream for storage or analysis.
Properties
| Name | Meaning |
|---|---|
| CDP URL | Chrome DevTools Protocol WebSocket URL to connect to the browser instance. |
| Full Page | Whether to capture the entire webpage instead of only the visible viewport (true/false). |
| Quality | Screenshot quality from 0 to 100 (only applies to JPEG format). |
Output
- The node outputs an array of items, each containing:
json: An object with the property"operation"set to"screenshot".binary.screenshot: The screenshot image data as a binary file namedscreenshot.jpgwith MIME typeimage/jpeg.
This binary output can be used in subsequent nodes for saving to disk, uploading, or further processing.
Dependencies
- Requires a running Chromium-based browser instance accessible via a Chrome DevTools Protocol WebSocket URL.
- Uses the Playwright library to connect and control the browser.
- No internal credential types are exposed; users must provide the CDP URL manually.
- No additional environment variables or n8n credentials are required beyond the CDP URL input.
Troubleshooting
- Connection issues: If the node cannot connect to the browser, verify the CDP URL is correct and the browser is running with remote debugging enabled.
- Unsupported load state error: Occurs if an invalid load state string is provided in other operations; ensure only supported states (
load,domcontentloaded,networkidle) are used. - Timeout errors: Waiting for selectors or load states may time out if the page is slow or the selector does not appear; increase timeout values accordingly.
- Quality parameter ignored: Quality only affects JPEG screenshots; PNG format is not used here.
- Binary data missing: Ensure the operation is set to "Screenshot" to get binary output; other operations produce JSON-only output.