npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

n8n-nodes-playwright-chromium-cdp

v1.0.4

Published

n8n node for browser automation using Playwright with remote browser via CDP

Readme

n8n-nodes-playwright-chromium-cdp

This is an n8n community node for browser automation using Playwright with a remote browser via CDP (Chrome DevTools Protocol).

Unlike other browser automation nodes, this one does not install or launch browsers locally. Instead, it connects to an already running browser instance via CDP endpoint.

Credits

This project is based on n8n-nodes-puppeteer by Nicholas Penree. The original Puppeteer implementation has been replaced with Playwright, focusing on remote browser connection via CDP.

Features

  • Remote Browser Connection: Connect to any browser that exposes a CDP endpoint
  • No Local Browser Installation: Perfect for containerized environments
  • Full Playwright API Access: Use the powerful Playwright API for automation
  • Device Emulation: Emulate various devices (mobile, tablet, desktop)
  • Screenshot & PDF Generation: Capture pages as images or PDFs
  • Custom Scripts: Run custom JavaScript code with full Playwright access

Installation

Follow the installation guide in the n8n community nodes documentation.

npm install n8n-nodes-playwright-chromium-cdp

Prerequisites

You need a running browser with CDP enabled. Here are some options:

Option 1: Run Chrome/Chromium with CDP

# macOS
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222

# Linux
google-chrome --remote-debugging-port=9222

# Windows
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222

Option 2: Use Docker

docker run -d -p 9222:9222 zenika/alpine-chrome --no-sandbox --remote-debugging-address=0.0.0.0 --remote-debugging-port=9222

Option 3: Use browserless.io or similar services

Many services provide remote browsers with CDP access.

Credentials

Create credentials with the CDP endpoint URL:

  • CDP Endpoint URL: The URL to connect to (e.g., http://localhost:9222)
  • Timeout: Connection timeout in milliseconds

Operations

Get Page Content

Retrieves the full HTML content of a page.

Get Screenshot

Captures a screenshot of the page (PNG or JPEG).

Get PDF

Generates a PDF from the page (Chromium-based browsers only).

Run Custom Script

Execute custom JavaScript code with access to Playwright objects:

// Available variables:
// $browser - Browser instance (connected via playwright.chromium.connectOverCDP())
// $context - Browser context
// $page - Page instance  
// $playwright - Playwright module with { chromium, devices }

// Navigate and extract data
await $page.goto('https://example.com');

const title = await $page.title();
const content = await $page.textContent('body');

// Return data (must be an array)
return [{ title, content, ...$json }];

Options

  • Batch Size: Process multiple items in parallel
  • Emulate Device: Emulate specific devices (iPhone, Pixel, etc.)
  • Viewport: Set custom viewport dimensions
  • User Agent: Custom user agent string
  • Locale/Timezone: Set browser locale and timezone
  • Geolocation: Set fake geolocation
  • Extra Headers: Add custom HTTP headers
  • Wait Until: Navigation wait strategy (load, domcontentloaded, networkidle, commit)
  • Timeout: Navigation timeout
  • Ignore HTTPS Errors: Bypass SSL certificate errors
  • JavaScript Enabled: Toggle JavaScript execution
  • Bypass CSP: Bypass Content Security Policy

Example: Storing and Reusing Cookies

Node 1: Login and save cookies

await $page.goto('https://example.com/login');

await $page.fill('#username', 'user');
await $page.fill('#password', 'pass');
await $page.click('#login-button');

// Wait for navigation
await $page.waitForLoadState('networkidle');

// Get cookies from context
const cookies = await $context.cookies();

return [{ cookies }];

Node 2: Use saved cookies

const { cookies } = $input.first().json;

// Set cookies
await $context.addCookies(cookies);

// Navigate to authenticated page
await $page.goto('https://example.com/dashboard');

const data = await $page.textContent('.dashboard-content');

return [{ data }];

Example: Taking Screenshots

await $page.goto('https://example.com');

// Wait for content to load
await $page.waitForSelector('.main-content');

// Take screenshot as base64
const screenshot = await $page.screenshot({ 
  type: 'png',
  fullPage: true 
});

return [{
  binary: {
    screenshot: {
      data: screenshot.toString('base64'),
      mimeType: 'image/png',
      fileName: 'screenshot.png',
    },
  },
}];

Development

# Install dependencies
npm install

# Build the node
npm run build

# Watch for changes
npm run dev

License

MIT License - see LICENSE.md

Based on n8n-nodes-puppeteer by Nicholas Penree.