Actions5
Overview
This node integrates with the Browserless API, enabling automated browser interactions such as web scraping, screenshot capture, PDF generation, and executing custom JavaScript code within a browser context. It is useful for scenarios where you need to programmatically extract content from websites, generate visual or document representations of web pages, or run scripts in a headless browser environment.
Practical examples include:
- Extracting structured data (JSON) from complex web pages.
- Capturing screenshots of webpages for monitoring or reporting.
- Generating PDFs of web pages for archiving or sharing.
- Running custom JavaScript code on a page to manipulate or retrieve data dynamically.
Properties
Name | Meaning |
---|---|
Browser Options | A collection of settings to configure the browser session: - BlockAds: Enable blocking of advertisement network traffic. - Headless: Run browser without UI. - Ignore HTTPS Errors: Ignore HTTPS errors. - Stealth: Enable stealth mode to avoid bot detection. - User Data Dir: Path to reuse previous session data like cookies. - TrackingId: Arbitrary ID for tracking sessions. - Keep Alive: Time in milliseconds to keep the browser running after session. - Flags: Command-line flags passed directly to Chrome at startup (e.g., --no-sandbox ). |
Output
The output structure depends on the selected resource:
- For Content, JSON, and Function resources, the output is JSON data containing the results of the requested operation (e.g., scraped content, executed function result).
- For Screenshot and PDF resources, the output includes binary data representing the image or PDF file respectively, alongside an empty JSON object.
Specifically:
json
: Contains the main data payload (scraped content, function output, or empty for binary outputs).binary.data
: Contains the raw binary data for screenshots or PDFs.
Dependencies
- Requires access to the Browserless API service endpoint (
https://chrome.rowserless.io
). - Needs an API authentication token configured in the node credentials to authorize requests.
- No other external dependencies are required beyond standard n8n environment setup.
Troubleshooting
Common issues:
- Invalid or missing API key credential will cause authentication failures.
- Incorrect URLs or unreachable targets may lead to request timeouts or errors.
- Improperly formatted JSON in the "context" property for the Function resource can cause parsing errors.
- Using incompatible or unsupported command-line flags in Browser Options might prevent the browser from launching correctly.
Error messages:
"error": "Authentication failed"
: Check that the API key credential is correctly set."error": "Invalid JSON in context"
: Verify the JSON string provided in the Function resource's context field.- Network-related errors: Ensure the target URL is accessible and the Browserless API endpoint is reachable.
Links and References
- Browserless API Documentation
- Chromium Command Line Switches — for supported browser flags
- n8n Documentation