SKILL.md--- name: chrome-devtools-cli description: Use this skill to write shell scripts or run shell commands to automate tasks in the browser or otherwise use Chrome DevTools via CLI. --- Automate Chrome via `chrome-devtools <tool> [args] [flags]`. First-time setup: [references/installation.md](references/installation.md). ## Workflow 1. **Execute**: Run tools directly; the daemon starts implicitly (skip `start`/`status`/`stop` unless changing startup flags). Use `list_pages` to find `<pageId>`. 2. **Inspect**: Run `chrome-devtools take_snapshot <pageId>` for element `<uid>`s (`uid=1_1 heading "Example" level="1"`). 3. **Act**: Pass `<pageId>` and `<uid>` to interaction tools. State persists across commands. - Required args are positional; optional args use `--flag`. Run `<tool> --help` for full options. - Output defaults to Markdown; pass `--output-format=json` for JSON. - Full filesystem access is on by default; pass `--allowUnrestrictedPaths=false` on `start` to restrict to OS temp dir. ## Core Commands ```bash # Pages & navigation chrome-devtools list_pages chrome-devtools new_page "https://example.com" chrome-devtools navigate_page 1 --url "https://example.com" # or --type reload|back chrome-devtools select_page 1 chrome-devtools close_page 1 # Snapshots & input (<uid> from take_snapshot; most accept --includeSnapshot true) chrome-devtools take_snapshot 1 # --verbose true --filePath s.txt chrome-devtools click 1 "uid" # --dblClick true chrome-devtools fill 1 "uid" "text" chrome-devtools press_key 1 "Enter" chrome-devtools type_text 1 "hello" --submitKey "Enter" # Debugging & inspection chrome-devtools evaluate_script "() => document.title" --pageId 1 chrome-devtools list_console_messages 1 # --types error chrome-devtools get_console_message 1 1 chrome-devtools list_network_requests 1 # --resourceTypes fetch chrome-devtools get_network_request 1 --reqid 1 chrome-devtools take_screenshot 1 # --fullPage true --filePath s.png # Daemon (only for startup flags or --sessionId=<uuid>) chrome-devtools start --headless=false # also: status | stop ``` ## References (Load on Demand) - [references/debugging-and-network.md](references/debugging-and-network.md): Network mocking, body exports, CSS styles, logpoints, Lighthouse, screencasts, extra input (`hover`, `drag`, `handle_dialog`, `upload_file`) and navigation flags. - [references/performance-and-memory.md](references/performance-and-memory.md): Performance traces/insights, heap snapshots, and heap-snapshot memory analysis. - [references/emulation-extensions-and-pwa.md](references/emulation-extensions-and-pwa.md): Emulation, viewport resize, extensions, PWAs, experimental tools. - [references/installation.md](references/installation.md): One-time installation and troubleshooting.