Package Information
Documentation
n8n-nodes-playwright-api
An n8n community node for remote browser automation using Playwright over WebSocket.
Unlike other n8n Playwright nodes that run browsers locally (requiring ~1GB of browser binaries), this node connects to a remote Playwright server — ideal for Kubernetes, Docker, and cloud environments where n8n and the browser engine run on separate containers/machines.
How It Works
┌─────────────┐ WebSocket ┌──────────────────────┐
│ n8n │ ◄──────────────► │ Playwright Server │
│ (this node) │ connect() │ (Docker container) │
└─────────────┘ └──────────────────────┘
This node uses Playwright's native browserType.connect(wsEndpoint) to connect to a remote Playwright server over WebSocket. The connection uses the full Playwright protocol, supporting all browsers (Chromium, Firefox, WebKit) with full feature fidelity.
Prerequisites
- A running Playwright server accessible via WebSocket
- Important: The Playwright version on the server must match the client version (currently 1.49.0)
Recommended: Microsoft Playwright Docker Image
docker run --rm -p 3000:3000 mcr.microsoft.com/playwright:v1.58.0-noble \
npx playwright launch-server --browser chromium --host 0.0.0.0 --port 3000
Installation
In n8n (Community Node)
- Go to Settings > Community Nodes
- Install:
n8n-nodes-playwright-api
Manual Installation
cd ~/.n8n/custom
pnpm install n8n-nodes-playwright-api
Note: Set
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1in your environment to skip browser binary downloads — this node only needs the Playwright client library, not the browser binaries.
Configuration
Credentials
Create a Playwright API credential in n8n with:
| Field | Description | Example |
|---|---|---|
| WebSocket Endpoint | The WS URL of your Playwright server | ws://playwright-server:3000 |
| Browser Type | Chromium, Firefox, or WebKit | chromium |
| Timeout (ms) | Connection timeout | 30000 |
| Slow Mo (ms) | Delay between operations (for debugging) | 0 |
| Headers | Optional auth headers for the WS connection | Authorization: Bearer token |
Operations
| Operation | Description |
|---|---|
| Navigate | Go to a URL and retrieve page content |
| Take Screenshot | Capture full page or viewport screenshots |
| Get Text | Extract text using CSS selectors or XPath |
| Click Element | Click on an element |
| Fill Form | Populate form fields |
| Run Custom Script | Execute custom JavaScript with full Playwright API access |
Custom Script Variables
In the Run Custom Script operation, these variables are available:
$page— Current Playwright Page instance$browser— Browser instance$playwright— Playwright library$helpers— n8n helper methods (includingprepareBinaryData)$json,$input— Standard n8n variables
Docker Compose Example
See docker-compose.yml for a complete setup with n8n and a Playwright server.
services:
n8n:
image: n8nio/n8n
ports:
- "5678:5678"
depends_on:
- playwright-server
playwright-server:
image: mcr.microsoft.com/playwright:v1.58.0-noble
command: npx playwright launch-server --browser chromium --host 0.0.0.0 --port 3000
ports:
- "3000:3000"
Then configure your Playwright API credentials with ws://playwright-server:3000.
Kubernetes Deployment
Example Kubernetes manifests for running the Playwright server as a separate service:
apiVersion: apps/v1
kind: Deployment
metadata:
name: playwright-server
spec:
replicas: 1
selector:
matchLabels:
app: playwright-server
template:
metadata:
labels:
app: playwright-server
spec:
containers:
- name: playwright
image: mcr.microsoft.com/playwright:v1.58.0-noble
command: ["npx", "playwright", "launch-server", "--browser", "chromium", "--host", "0.0.0.0", "--port", "3000"]
ports:
- containerPort: 3000
resources:
requests:
memory: "512Mi"
cpu: "500m"
limits:
memory: "2Gi"
cpu: "2000m"
---
apiVersion: v1
kind: Service
metadata:
name: playwright-server
spec:
selector:
app: playwright-server
ports:
- port: 3000
targetPort: 3000
Then configure your n8n Playwright API credentials with ws://playwright-server:3000.
Version Compatibility
| This Node | Playwright Server |
|---|---|
| 0.1.x | v1.58.x |
The Playwright client and server major.minor versions must match. If you upgrade the Playwright dependency in this node, you must also update your Playwright server image.
Development
# Clone the repo
git clone <repo-url>
cd n8n-nodes-playwright-api
# Install dependencies (skips browser download)
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 pnpm install
# Build
pnpm build
# Link to n8n for development
cd ~/.n8n/custom
pnpm link <path-to-this-repo>
License
MIT
Credits
Based on n8n-nodes-playwright by Mohamed Toema, modified for remote browser execution.