chrome-cdp
Chrome CDP
Lightweight Chrome DevTools Protocol CLI. Connects directly via WebSocket — no Puppeteer, works with 100+ tabs, instant connection. Uses a persistent per-tab daemon so Chrome's "Allow debugging" modal fires only once.
Prerequisites
- Chrome with remote debugging enabled: open
chrome://inspect/#remote-debuggingand toggle the switch - Python 3.10+ with
websocketslibrary
Commands
All commands use python -m chrome_cdp. The <target> is a unique targetId prefix from list; copy the full prefix shown in the list output (for example 6BE827FA). The CLI rejects ambiguous prefixes.
List open pages
python -m chrome_cdp list
Take a screenshot
python -m chrome_cdp shot <target> [file] # default: /tmp/screenshot.png
Captures the viewport only. Scroll first with eval if you need content below the fold. Output includes the page's DPR and coordinate conversion hint (see references/coordinate-system.md).
Accessibility tree snapshot
python -m chrome_cdp snap <target>
Prefer snap over html for understanding page structure — it's compact and semantic.
Evaluate JavaScript
python -m chrome_cdp eval <target> <expr>
Watch out: avoid index-based selection (
querySelectorAll(...)[i]) across multipleevalcalls when the DOM can change between them (e.g. after clicking Ignore, card indices shift). Collect all data in oneevalor use stable selectors.
Other commands
python -m chrome_cdp html <target> [selector] # full page or element HTML
python -m chrome_cdp nav <target> <url> # navigate and wait for load
python -m chrome_cdp net <target> # resource timing entries
python -m chrome_cdp click <target> <selector> # click element by CSS selector
python -m chrome_cdp clickxy <target> <x> <y> # click at CSS pixel coords
python -m chrome_cdp type <target> <text> # Input.insertText at current focus
python -m chrome_cdp loadall <target> <selector> [ms] # click "load more" until gone
python -m chrome_cdp evalraw <target> <method> [json] # raw CDP command passthrough
python -m chrome_cdp stop [target] # stop daemon(s)
Coordinates
shot saves an image at native resolution: image pixels = CSS pixels x DPR. CDP Input events (clickxy etc.) take CSS pixels.
CSS px = screenshot image px / DPR
shot prints the DPR for the current page. Typical Retina (DPR=2): divide screenshot coords by 2.
For the full coordinate system reference including DPR detection, viewer scaling, and worked examples, see references/coordinate-system.md.
Tips
- Prefer
snapoverhtmlfor page structure — it's compact and semantic. - Use
type(not eval) to enter text in cross-origin iframes — useclick/clickxyto focus first, thentype. - Chrome shows an "Allow debugging" modal once per tab on first access. A background daemon keeps the session alive so subsequent commands need no further approval. Daemons auto-exit after 20 minutes of inactivity.
- Use
evalrawto send arbitrary CDP methods not covered by the built-in commands (e.g.DOM.getDocument,Network.enable).
Advanced Usage
For detailed protocol documentation, see:
- references/coordinate-system.md — DPR, CSS pixels, screenshot coordinate mapping
- references/daemon-ipc.md — Unix socket protocol, NDJSON format, request/response schema
More from dashed/claude-marketplace
playwright
Browser automation with Playwright for Python. Use when testing websites, taking screenshots, filling forms, scraping web content, or automating browser interactions. Triggers on browser, web testing, screenshots, selenium, puppeteer, or playwright.
22tmux
Remote control tmux sessions for interactive CLIs (python, gdb, git add -p, etc.) by sending keystrokes and scraping pane output. Use when debugging applications, running interactive REPLs (Python, gdb, ipdb, psql, mysql, node), automating terminal workflows, interactive git commands (git add -p, git stash -p, git rebase -i), or when user mentions tmux, debugging, or interactive shells.
11ai-friendly-cli
Build and refactor CLIs for AI agent compatibility. Use when making command-line interfaces machine-readable, adding structured JSON output, hardening inputs against hallucinations, implementing safety rails like dry-run flags, adding schema introspection, or designing multi-surface architectures (CLI + MCP).
3zellij
Terminal workspace and multiplexer for interactive CLI sessions. Use when managing terminal sessions, running interactive REPLs, debugging applications, automating terminal workflows, or when user mentions zellij, terminal multiplexer, floating panes, or session layouts. Simpler alternative to tmux with native session management.
2mermaid-cli
Generate, validate, and fix diagrams from Mermaid markup using the mermaid-cli (mmdc) tool. Use when creating flowcharts, sequence diagrams, class diagrams, state diagrams, ER diagrams, Gantt charts, pie charts, mindmaps, or any Mermaid-supported diagram type. Also use when validating, verifying, or fixing Mermaid diagram syntax. Triggers on mentions of mermaid, mmdc, diagram generation, diagram validation, or converting .mmd files to images/SVG/PDF.
2design-principles
Guide AI-assisted UI generation toward enterprise-grade, intentional design. Use when building user interfaces, creating dashboards, designing enterprise software or SaaS applications, generating frontend code with styling, or when the user asks for design help. Enforces principles inspired by Linear, Notion, Stripe, and Vercel.
2