arty-chrome-cdp-launcher
v1.1.1
Published
Start Google Chrome with remote debugging (CDP) for Playwright connectOverCDP
Maintainers
Readme
arty-chrome-cdp-launcher
Launch Google Chrome with remote debugging enabled, so tools like Playwright can connect over CDP.
Supports Linux, macOS, and Windows.
Install
npm install arty-chrome-cdp-launcherQuick start
import { ensureChromeWithCDP } from 'arty-chrome-cdp-launcher';
import { chromium } from 'playwright';
const cdpUrl = await ensureChromeWithCDP();
const browser = await chromium.connectOverCDP(cdpUrl);
const context = browser.contexts()[0];
const page = context.pages()[0] ?? (await context.newPage());ensureChromeWithCDP():
- Checks if Chrome is already listening on the CDP port
- If not, starts Chrome with
--remote-debugging-port - Returns the CDP URL (default
http://127.0.0.1:9222)
CLI
npx arty-chrome-cdpConfiguration
| Variable | Default | Description |
|---|---|---|
| CDP_PORT | 9222 | Remote debugging port |
| CHROME_USER_DATA_DIR | ~/.arty-chrome-cdp | Dedicated Chrome profile directory |
Example:
CDP_PORT=9333 CHROME_USER_DATA_DIR=/tmp/my-chrome npx arty-chrome-cdpNotes
- Uses a separate user-data directory by default, so it won’t interfere with your everyday Chrome profile.
- If Chrome is already running with that same profile, close it first or CDP may fail to start.
License
ISC
