Chrome DevTools Protocol
Chrome tools
for agents.
Give your coding agent a way to check its work in Chrome. It can click through a change, see the result at phone size, and read the browser errors when a flow breaks.
FIG. 01 / BROWSER SESSION
Commands
Download full guide ↓For commands that attach to Chrome, use --page to select a tab by ID or a unique title or URL match. Set CDP_PORT to the port printed by cdp launch. The default is 9222.
Browser control
cdp launch [URL] [--timeout MS]- Start headless Chrome and print its debugging endpoint. The browser stays open until interrupted.
cdp pages- List the IDs, titles, and URLs of open tabs.
cdp goto URL [--page MATCH] [--timeout MS]- Navigate the selected tab and wait for the document to load.
cdp click SELECTOR [--page MATCH] [--timeout MS]- Scroll a matching element into view and click it.
cdp wait SELECTOR [--page MATCH] [--timeout MS]- Wait until a matching element is visible.
cdp screenshot [FILE] [--page MATCH]- Save a viewport PNG. The default filename is screenshot.png. Use --full-page for the document or --element SELECTOR for a single element. To automate capture, add --launch, --url URL, repeated --click SELECTOR, --wait SELECTOR, or --timeout MS. A positional page match after FILE also works.
Page inspection
cdp eval EXPRESSION [--page MATCH]- Evaluate JavaScript in the tab and return the result as JSON.
cdp ax [--page MATCH]- Read accessible names, roles, and states, including a list of unnamed controls.
cdp metrics [--page MATCH]- Read Chrome performance counters and JavaScript heap usage.
Profiling and comparison
cdp cpu FILE [--duration MS] [--page MATCH]- Save a V8 CPU profile. The default recording lasts one second.
cdp allocations FILE [--duration MS] [--page MATCH]- Sample memory allocations and save a DevTools profile. The default recording lasts one second.
cdp heap FILE [--page MATCH]- Save a complete V8 heap snapshot.
cdp heap-diff BEFORE.heapsnapshot AFTER.heapsnapshot- Compare object counts and shallow memory usage by type.
cdp compare BASELINE.json CANDIDATE.json [--max-p95-increase MS]- Compare two performance reports. With a threshold, exit with code 1 if the increase in p95 frame time exceeds it.
Recipes and CLI information
cdp trace COMMAND FILE [options]- Record Chrome traces or query frame pacing, CPU samples, game metrics, and budgets. Trace command reference
cdp run RECIPE.json [--out DIRECTORY]- Run a JSON recipe in fresh Chrome profiles and return artifact paths. Use a dash in place of the filename to read from stdin.
cdp schema- Print the JSON Schema for recipes, including defaults and accepted options.
cdp help- List CLI usage and exit codes. Also available as cdp --help or simply cdp.
cdp version- Print the installed CLI version. Also available as cdp --version.
Version 1.1.0
Install the CLI.
Use Node 24 or newer and an installed Chrome or Chromium browser.
Download package ↓From your download directory
npm install -g ./cdp-tools-1.1.0.tgz cdp version cdp help