chrome-cdp-live-browser

Give AI agents access to your live Chrome session via CDP — interact with open tabs, logged-in accounts, and current page state

22 stars

Best use case

chrome-cdp-live-browser is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Give AI agents access to your live Chrome session via CDP — interact with open tabs, logged-in accounts, and current page state

Teams using chrome-cdp-live-browser should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/chrome-cdp-live-browser/SKILL.md --create-dirs "https://raw.githubusercontent.com/Aradotso/trending-skills/main/skills/chrome-cdp-live-browser/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/chrome-cdp-live-browser/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How chrome-cdp-live-browser Compares

Feature / Agentchrome-cdp-live-browserStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Give AI agents access to your live Chrome session via CDP — interact with open tabs, logged-in accounts, and current page state

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# chrome-cdp: Live Chrome Session for AI Agents

> Skill by [ara.so](https://ara.so) — Daily 2026 Skills collection.

`chrome-cdp` connects your AI agent directly to your running Chrome browser via the Chrome DevTools Protocol (CDP). Unlike browser automation tools that spin up fresh isolated browsers, this connects to tabs you already have open — with your logins, cookies, and current page state intact.

## What It Does

- **Live session access** — reads and interacts with tabs you're already logged into
- **Persistent daemon** — one WebSocket daemon per tab; the "Allow debugging" modal appears once, not on every command
- **No npm install** — only Node.js 22+ required
- **100+ tab support** — handles large numbers of open tabs reliably
- **Cross-origin iframe support** — `type` command works even inside cross-origin iframes

## Installation

### As a pi skill

```bash
pi install git:github.com/pasky/chrome-cdp-skill@v1.0.1
```

### Manual (for Amp, Claude Code, Cursor, Codex, etc.)

```bash
git clone https://github.com/pasky/chrome-cdp-skill
# Copy the skills/chrome-cdp/ directory to wherever your agent loads context from
```

### Enable Remote Debugging in Chrome

1. Open Chrome and navigate to: `chrome://inspect/#remote-debugging`
2. Toggle the **"Enable remote debugging"** switch

That's all. No flags, no relaunching Chrome.

The script auto-detects Chrome, Chromium, Brave, Edge, and Vivaldi on macOS, Linux, and Windows. For non-standard installs:

```bash
export CDP_PORT_FILE=/path/to/DevToolsActivePort
```

## Key Commands

All commands use `scripts/cdp.mjs` as the entry point. `<target>` is a unique prefix of the targetId shown by `list`.

### List Open Tabs

```bash
node scripts/cdp.mjs list
# Output:
# A1B2C3  https://github.com/pasky/chrome-cdp-skill  chrome-cdp-skill
# D4E5F6  https://mail.google.com/mail/u/0/           Gmail
```

### Screenshot a Tab

```bash
node scripts/cdp.mjs shot A1B2
# Saves screenshot to runtime dir, prints the file path
```

### Accessibility Tree (Semantic Snapshot)

```bash
node scripts/cdp.mjs snap A1B2
# Returns compact, semantic accessibility tree — best for understanding page structure
```

### Full HTML or Scoped HTML

```bash
node scripts/cdp.mjs html A1B2                    # full page HTML
node scripts/cdp.mjs html A1B2 ".main-content"    # scoped to CSS selector
node scripts/cdp.mjs html A1B2 "#article-body"    # scoped to ID
```

### Evaluate JavaScript

```bash
node scripts/cdp.mjs eval A1B2 "document.title"
node scripts/cdp.mjs eval A1B2 "window.location.href"
node scripts/cdp.mjs eval A1B2 "document.querySelectorAll('a').length"
```

### Navigate to URL

```bash
node scripts/cdp.mjs nav A1B2 https://example.com
# Navigates and waits for page load
```

### Network Resource Timing

```bash
node scripts/cdp.mjs net A1B2
# Shows network resource timing for the current page
```

### Click an Element

```bash
node scripts/cdp.mjs click A1B2 "button.submit"
node scripts/cdp.mjs click A1B2 "#login-btn"
node scripts/cdp.mjs click A1B2 "[data-testid='confirm']"
```

### Click at Coordinates

```bash
node scripts/cdp.mjs clickxy A1B2 320 480
# Clicks at CSS pixel coordinates (x=320, y=480)
```

### Type Text

```bash
node scripts/cdp.mjs type A1B2 "Hello, world!"
# Types at the currently focused element — works in cross-origin iframes
```

### Load More (Click Until Gone)

```bash
node scripts/cdp.mjs loadall A1B2 "button.load-more"
# Keeps clicking the selector until it disappears from the DOM
```

### Open a New Tab

```bash
node scripts/cdp.mjs open
node scripts/cdp.mjs open https://example.com
# Note: triggers Chrome's "Allow" prompt
```

### Stop Daemons

```bash
node scripts/cdp.mjs stop          # stop all daemons
node scripts/cdp.mjs stop A1B2     # stop daemon for specific tab
```

### Raw CDP Command Passthrough

```bash
node scripts/cdp.mjs evalraw A1B2 "Page.getFrameTree"
node scripts/cdp.mjs evalraw A1B2 "Runtime.evaluate" '{"expression":"1+1"}'
```

## Common Patterns

### Pattern: Read a Page You're Logged Into

```bash
# List tabs to find your target
node scripts/cdp.mjs list

# Grab the accessibility tree for a semantic view
node scripts/cdp.mjs snap D4E5

# Or get scoped HTML for a specific section
node scripts/cdp.mjs html D4E5 ".email-list"
```

### Pattern: Fill and Submit a Form

```bash
# Click the input field
node scripts/cdp.mjs click A1B2 "input[name='search']"

# Type into it
node scripts/cdp.mjs type A1B2 "my search query"

# Click submit
node scripts/cdp.mjs click A1B2 "button[type='submit']"

# Take a screenshot to verify result
node scripts/cdp.mjs shot A1B2
```

### Pattern: Extract Data with JavaScript

```bash
# Get all link hrefs on a page
node scripts/cdp.mjs eval A1B2 "Array.from(document.querySelectorAll('a')).map(a => a.href)"

# Get text content of a specific element
node scripts/cdp.mjs eval A1B2 "document.querySelector('.price').textContent.trim()"

# Get table data as JSON
node scripts/cdp.mjs eval A1B2 "
  Array.from(document.querySelectorAll('table tr')).map(row =>
    Array.from(row.querySelectorAll('td,th')).map(cell => cell.textContent.trim())
  )
"
```

### Pattern: Navigate and Wait

```bash
# Navigate and then immediately read the page
node scripts/cdp.mjs nav A1B2 https://news.ycombinator.com
node scripts/cdp.mjs snap A1B2
```

### Pattern: Paginated Content

```bash
# Keep loading content until "Load More" button disappears
node scripts/cdp.mjs loadall A1B2 "button[data-action='load-more']"

# Then extract all loaded content
node scripts/cdp.mjs eval A1B2 "document.querySelectorAll('.item').length"
```

### Pattern: Script Integration (Node.js)

```javascript
import { execFile } from 'node:child_process';
import { promisify } from 'node:util';

const exec = promisify(execFile);
const CDP = (...args) => exec('node', ['scripts/cdp.mjs', ...args]);

async function getPageTitle(tabPrefix) {
  const { stdout } = await CDP('eval', tabPrefix, 'document.title');
  return stdout.trim();
}

async function takeScreenshot(tabPrefix) {
  const { stdout } = await CDP('shot', tabPrefix);
  return stdout.trim(); // returns file path
}

async function navigateAndSnap(tabPrefix, url) {
  await CDP('nav', tabPrefix, url);
  const { stdout } = await CDP('snap', tabPrefix);
  return stdout;
}

// Usage
const tabs = (await CDP('list')).stdout;
console.log(tabs);
```

## Configuration

| Environment Variable | Purpose |
|----------------------|---------|
| `CDP_PORT_FILE` | Path to `DevToolsActivePort` file for non-standard browser installs |

Daemons auto-exit after **20 minutes of inactivity** — no manual cleanup needed in normal use.

## Troubleshooting

### "Allow debugging" modal keeps appearing
This happens if daemons aren't persisting. Make sure you're using the same `scripts/cdp.mjs` entry point — it manages daemon lifecycle automatically. If you switched tools mid-session, run `stop` and let daemons restart fresh.

### Browser not detected
If auto-detection fails, find your `DevToolsActivePort` file and set the env var:

```bash
# macOS Chrome example
export CDP_PORT_FILE="$HOME/Library/Application Support/Google/Chrome/Default/DevToolsActivePort"

# Linux Chrome example
export CDP_PORT_FILE="$HOME/.config/google-chrome/Default/DevToolsActivePort"
```

### Target not found / prefix ambiguous
Run `list` again — tab IDs change when tabs are closed/reopened. Use a longer prefix if multiple tabs share the same prefix characters.

### Remote debugging toggle not visible
Ensure you're on `chrome://inspect/#remote-debugging` (not just `chrome://inspect/`). The toggle is in the top-right of the page.

### Node.js version error
This project requires **Node.js 22+**. Check with `node --version` and upgrade if needed via [nvm](https://github.com/nvm-sh/nvm) or your package manager.

### Screenshots are blank or wrong size
The screenshot reflects the actual rendered viewport. If the tab is in a background window or the OS has display scaling, pixel coordinates for `clickxy` may need adjustment. Use `snap` or `eval` to inspect DOM state instead of relying solely on screenshots.

## Architecture Notes

- No Puppeteer, no Playwright, no intermediary — pure CDP WebSocket
- One persistent daemon process per tab (auto-spawned on first access)
- Daemon reuse is why 100+ tabs work reliably (no timeout on target enumeration)
- `type` uses CDP Input domain directly, bypassing iframe origin restrictions

Related Skills

superlevels-chrome-extension

22
from Aradotso/trending-skills

Open-source Chrome extension replacing 12+ browser extensions with privacy-respecting tools including tab cleaner, cookie editor, dark mode, JS toggle, GDPR dismisser, and more.

lightpanda-browser

22
from Aradotso/trending-skills

Expert skill for Lightpanda — the headless browser built in Zig for AI agents and automation. 9x less memory, 11x faster than Chrome. Installation, CLI, CDP server, Playwright/Puppeteer integration, and web scraping.

gemma-gem-browser-ai

22
from Aradotso/trending-skills

Build and extend Gemma Gem, an on-device AI browser assistant Chrome extension running Google's Gemma 4 model via WebGPU with no cloud dependencies.

agent-browser-automation

22
from Aradotso/trending-skills

Headless browser automation CLI for AI agents using native Rust binary with Chrome DevTools Protocol

```markdown

22
from Aradotso/trending-skills

---

zeroboot-vm-sandbox

22
from Aradotso/trending-skills

Sub-millisecond VM sandboxes for AI agents using copy-on-write KVM forking via Zeroboot

yourvpndead-vpn-detection

22
from Aradotso/trending-skills

Android app that detects VPN/proxy servers (VLESS/xray/sing-box) via local SOCKS5 vulnerability, exposing exit IPs and server configs without root

xata-postgres-platform

22
from Aradotso/trending-skills

Expert skill for Xata open-source cloud-native Postgres platform with copy-on-write branching, scale-to-zero, and Kubernetes deployment

x-mentor-skill-nuwa

22
from Aradotso/trending-skills

AI-powered X (Twitter) content strategy skill that distills methodologies from 6 top creators + open-source algorithm data into actionable writing, growth, and monetization guidance.

wx-favorites-report

22
from Aradotso/trending-skills

End-to-end pipeline to extract, decrypt, and visualize WeChat Mac favorites from encrypted SQLite DB into an interactive HTML report.

wterm-web-terminal

22
from Aradotso/trending-skills

Web terminal emulator with Zig/WASM core, DOM rendering, and React/vanilla JS bindings

worldmonitor-intelligence-dashboard

22
from Aradotso/trending-skills

Real-time global intelligence dashboard with AI-powered news aggregation, geopolitical monitoring, and infrastructure tracking