n8n-nodes-seleniumbase
v1.0.1
Published
n8n community node for executing Python scraping scripts using SeleniumBase API
Downloads
362
Maintainers
Readme
n8n-nodes-seleniumbase
This is an n8n community node that allows you to execute Python scraping scripts using the SeleniumBase API.
SeleniumBase is a comprehensive Python framework for browser automation and web testing.
n8n is a fair-code licensed workflow automation platform.
Prerequisite: SeleniumBase API Setup
** Before using this n8n node, set up and run the SeleniumBase API backend first**
Verify API is ready:
curl http://localhost:8000/healthThen set n8n credential Base URL to:
http://localhost:8000
Features
- Execute Python Scripts: Submit Python code using SeleniumBase for web scraping
- Attachment Support: Upload binary from previous node as attachment automatically
- Runtime Parameters: Send custom key-value params in submit payload
params - Async Job Handling: Automatically polls for job completion
- Artifact Collection: Retrieve screenshots, files, and other artifacts generated by your scripts
- Flexible Operations: Execute scripts, check status, or retrieve results as separate operations
Operations
| Operation | Description | |-----------|-------------| | Execute Script | Submit and execute a Python scraping script | | Get Job Status | Get the current status of an existing job | | Get Job Result | Get the full result of a completed job including artifacts and logs | | Clean Up Job | Delete a job and its artifacts from the API server | | Clean Up Profile | Delete a persisted browser profile |
Credentials
This node requires connection credentials:
| Field | Description |
|-------|-------------|
| Base URL | The URL of your SeleniumBase API server (e.g., http://localhost:8000) |
Usage
Execute Script
- Add the SeleniumBase node to your workflow
- Configure the API credentials
- Enter your Python code in the code editor
- (Optional) Set Attachment Name (for example:
data) to upload media from previous node - (Optional) Add Parameters key-value pairs
- Enable "Wait for Completion" to get results after the script finishes
- Execute the workflow
Options visibility
The node keeps all existing options.* parameter keys for compatibility, and now shows options based on operation context:
- Execute Script: Wait for Completion, Polling Interval, Timeout, Maintain Session Consistency, Attachment Name, Parameters, Download Artifacts, Clean Job After Execution
- Get Job Result: Download Artifacts, Clean Job After Execution
Runtime Constants
When this node executes a script, the API injects these Python constants:
SB_ATTACHMENT_PATH: absolute path to the uploaded binary file when Attachment Name is set.SB_PARAMS: dictionary from Parameters.
Example:
attachment_path = SB_ATTACHMENT_PATH
params = SB_PARAMS
print("Attachment:", attachment_path)
print("Params:", params)Example Python script:
from seleniumbase import SB
with SB(headless=True) as sb:
sb.open("https://example.com")
sb.save_screenshot_to_logs()
print("Title:", sb.get_page_title())Output
The node returns:
job_id: Unique identifier for the jobstatus: Job status (completed/failed)stdout: Script outputstderr: Script errorsartifacts: List of generated files (screenshots, etc.)error: Error message if the job failed
If a submitted job finishes with status failed, the node throws an execution error by default. If Continue On Fail is enabled in n8n, the item is returned with an error field instead.
Smoke checklist
Use this checklist against a running SeleniumBase API server:
- Execute Script with Wait for Completion = true and confirm JSON + artifacts return.
- Execute Script with Wait for Completion = false and confirm submit response returns immediately.
- Execute Script with Attachment Name set and confirm attachment upload path is available in script.
- Execute Script with a failing script and confirm node error behavior (or per-item error with Continue On Fail).
- Get Job Status for a valid and invalid job ID.
- Get Job Result with artifact download on/off and cleanup on/off.
- Clean Up Job and Clean Up Profile with valid and invalid IDs.
Development
# Install dependencies
npm install
# Build the node
npm run build
# Run in development mode with n8n
npm run dev
# Lint the code
npm run lintCompatibility
- n8n version: 1.0+
- Node.js version: 18+
