chrome-devtools-cli
chromedevtools/chrome-devtools-mcp
Automate browser tasks and inspect Chrome DevTools from the command line.
What is chrome-devtools-cli?
A CLI tool that lets you control Chrome and interact with web pages programmatically via shell commands. Use it to automate browser workflows, inspect page elements, capture screenshots, analyze performance, and debug web applications from your terminal.
- Automate browser interactions (click, fill, drag, type, upload files) using element UIDs from snapshots
- Navigate pages, manage tabs, and handle dialogs
- Capture screenshots, text snapshots, and memory heapsnapshots for inspection
- Analyze performance with tracing, Lighthouse audits, and performance insights
- Inspect network requests, console messages, and evaluate JavaScript on the page
- Emulate network conditions, CPU throttling, geolocation, color schemes, and viewports
How to install chrome-devtools-cli
npx skills add https://github.com/chromedevtools/chrome-devtools-mcp --skill chrome-devtools-cli- Chrome browser installed and running
- Node.js and npm to install the CLI tool
How to use chrome-devtools-cli
- 1.Run `chrome-devtools list_pages` to see open browser tabs (the background server starts automatically)
- 2.Use `chrome-devtools take_snapshot` to get a text representation of the page with element UIDs
- 3.Interact with elements using their UIDs: `chrome-devtools click "uid"`, `chrome-devtools fill "uid" "text"`, etc.
- 4.Add `--includeSnapshot true` to commands to get an updated snapshot after each action
- 5.Use `chrome-devtools navigate_page --url "https://example.com"` to load new pages
- 6.Chain commands in shell scripts to automate multi-step workflows; state persists across calls
Use cases
- Automate end-to-end testing workflows by scripting browser interactions and assertions
- Monitor and debug web application performance with traces and Lighthouse audits
- Capture visual and accessibility snapshots for regression testing or documentation
- Inspect network traffic and console logs to diagnose issues in production-like environments
- Emulate different devices and network conditions to test responsive design and offline behavior
- QA engineers and test automation specialists
- Web developers debugging and profiling applications
- DevOps engineers automating browser-based monitoring tasks
- Performance engineers analyzing page load and runtime metrics
chrome-devtools-cli FAQ
No. The background server starts implicitly when you run any tool command. Do not run `start`, `status`, or `stop` before each use.
Use `chrome-devtools take_snapshot` to get a text representation of the page with UIDs (e.g., `uid=1_0`). Pass these UIDs to commands like `click`, `fill`, `drag`, etc.
Yes. You can write shell scripts that chain multiple `chrome-devtools` commands together. State persists across commands, so interactions build on each other.
Commands default to Markdown output. Use `--output-format=json` flag on any command to get JSON output instead.
Yes. Vision-based clicking and screencast recording are experimental and disabled by default. Enable them with `--experimentalVision=true` or `--experimentalScreencast=true` flags.
Full instructions (SKILL.md)
Source of truth, from chromedevtools/chrome-devtools-mcp.
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.
The chrome-devtools-mcp CLI lets you interact with the browser from your terminal.
Setup
Note: If this is your very first time using the CLI, see references/installation.md for setup. Installation is a one-time prerequisite and is not part of the regular AI workflow.
AI Workflow
- Execute: Run tools directly (e.g.,
chrome-devtools list_pages). The background server starts implicitly; do not runstart/status/stopbefore each use. - Inspect: Use
take_snapshotto get an element<uid>. - Act: Use
click,fill, etc. State persists across commands.
Snapshot example:
uid=1_0 RootWebArea "Example Domain" url="https://example.com/"
uid=1_1 heading "Example Domain" level="1"
Command Usage
chrome-devtools <tool> [arguments] [flags]
Use --help on any command. Output defaults to Markdown, use --output-format=json for JSON.
Input Automation (<uid> from snapshot)
chrome-devtools take_snapshot --help # Help message for commands, works for any command.
chrome-devtools take_snapshot # Take a text snapshot of the page to get UIDs for elements
chrome-devtools click "id" # Clicks on the provided element
chrome-devtools click "id" --dblClick true --includeSnapshot true # Double clicks and returns a snapshot
chrome-devtools drag "src" "dst" # Drag an element onto another element
chrome-devtools drag "src" "dst" --includeSnapshot true # Drag an element and return a snapshot
chrome-devtools fill "id" "text" # Type text into an input or select an option
chrome-devtools fill "id" "text" --includeSnapshot true # Fill an element and return a snapshot
chrome-devtools handle_dialog accept # Handle a browser dialog
chrome-devtools handle_dialog dismiss --promptText "hi" # Dismiss a dialog with prompt text
chrome-devtools hover "id" # Hover over the provided element
chrome-devtools hover "id" --includeSnapshot true # Hover over an element and return a snapshot
chrome-devtools press_key "Enter" # Press a key or key combination
chrome-devtools press_key "Control+A" --includeSnapshot true # Press a key and return a snapshot
chrome-devtools type_text "hello" # Type text using keyboard into a focused input
chrome-devtools type_text "hello" --submitKey "Enter" # Type text and press a submit key
chrome-devtools upload_file "id" "file.txt" # Upload a file through a provided element
chrome-devtools upload_file "id" "file.txt" --includeSnapshot true # Upload a file and return a snapshot
Navigation
chrome-devtools close_page 1 # Closes the page by its index
chrome-devtools list_pages # Get a list of pages open in the browser
chrome-devtools navigate_page --url "https://example.com" # Navigates the currently selected page to a URL
chrome-devtools navigate_page --type "reload" --ignoreCache true # Reload page ignoring cache
chrome-devtools navigate_page --url "https://example.com" --timeout 5000 # Navigate with a timeout
chrome-devtools navigate_page --handleBeforeUnload "accept" # Handle before unload dialog
chrome-devtools navigate_page --type "back" --initScript "foo()" # Navigate back and run an init script
chrome-devtools new_page "https://example.com" # Creates a new page
chrome-devtools new_page "https://example.com" --background true --timeout 5000 # Create new page in background
chrome-devtools new_page "https://example.com" --isolatedContext "ctx" # Create new page with isolated context
chrome-devtools select_page 1 # Select a page as a context for future tool calls
chrome-devtools select_page 1 --bringToFront true # Select a page and bring it to front
Emulation
chrome-devtools emulate --networkConditions "Offline" # Emulate network conditions
chrome-devtools emulate --cpuThrottlingRate 4 --geolocation "0x0" # Emulate CPU throttling and geolocation
chrome-devtools emulate --colorScheme "dark" --viewport "1920x1080" # Emulate color scheme and viewport
chrome-devtools emulate --userAgent "Mozilla/5.0..." # Emulate user agent
chrome-devtools resize_page 1920 1080 # Resizes the selected page's window
Performance
chrome-devtools performance_analyze_insight "1" "LCPBreakdown" # Get more details on a specific Performance Insight
chrome-devtools performance_start_trace true false # Starts a performance trace recording
chrome-devtools performance_start_trace true true --filePath t.gz # Start trace and save to a file
chrome-devtools performance_stop_trace # Stops the active performance trace
chrome-devtools performance_stop_trace --filePath "t.json" # Stop trace and save to a file
chrome-devtools take_memory_snapshot "./snap.heapsnapshot" # Capture a memory heapsnapshot
Network
chrome-devtools get_network_request # Get the currently selected network request
chrome-devtools get_network_request --reqid 1 --requestFilePath req.md # Get request by id and save to file
chrome-devtools get_network_request --responseFilePath res.md # Save response body to file
chrome-devtools list_network_requests # List all network requests
chrome-devtools list_network_requests --pageSize 50 --pageIdx 0 # List network requests with pagination
chrome-devtools list_network_requests --resourceTypes Fetch # Filter requests by resource type
chrome-devtools list_network_requests --includePreservedRequests true # Include preserved requests
Debugging & Inspection
chrome-devtools evaluate_script "() => document.title" # Evaluate a JavaScript function on the page
chrome-devtools evaluate_script "(a) => a.innerText" --args 1_4 # Evaluate JS with UID arguments
chrome-devtools get_console_message 1 # Gets a console message by its ID
chrome-devtools lighthouse_audit --mode "navigation" # Run Lighthouse audit for navigation
chrome-devtools lighthouse_audit --mode "snapshot" --device "mobile" # Run Lighthouse audit for a snapshot on mobile
chrome-devtools lighthouse_audit --outputDirPath ./out # Run Lighthouse audit and save reports
chrome-devtools list_console_messages # List all console messages
chrome-devtools list_console_messages --pageSize 20 --pageIdx 1 # List console messages with pagination
chrome-devtools list_console_messages --types error --types info # Filter console messages by type
chrome-devtools list_console_messages --includePreservedMessages true # Include preserved messages
chrome-devtools take_screenshot # Take a screenshot of the page viewport
chrome-devtools take_screenshot --fullPage true --format "jpeg" --quality 80 # Take a full page screenshot as JPEG with quality
chrome-devtools take_screenshot --uid "id" --filePath "s.png" # Take a screenshot of an element
chrome-devtools take_snapshot # Take a text snapshot of the page from the a11y tree
chrome-devtools take_snapshot --verbose true --filePath "s.txt" # Take a verbose snapshot and save to file
Extensions
chrome-devtools list_extensions # Lists all the Chrome extensions installed in the browser
chrome-devtools install_extension "/path/to/extension" # Installs a Chrome extension from the given path
chrome-devtools uninstall_extension "extension_id" # Uninstalls a Chrome extension by its ID
chrome-devtools reload_extension "extension_id" # Reloads an unpacked Chrome extension by its ID
chrome-devtools trigger_extension_action "extension_id" # Triggers the default action of an extension by its ID
Experimental Features
Experimental tools are disabled by default. Enable them with the corresponding flag during start.
chrome-devtools click_at 100 200 # Clicks at the provided coordinates (requires --experimentalVision=true)
chrome-devtools screencast_start # Starts a screencast recording (requires --experimentalScreencast=true and ffmpeg)
chrome-devtools screencast_stop # Stops the active screencast
chrome-devtools list_webmcp_tools # List all WebMCP tools (requires --categoryExperimentalWebmcp=true)
Service Management
chrome-devtools start # Start or restart chrome-devtools-mcp
chrome-devtools status # Checks if chrome-devtools-mcp is running
chrome-devtools stop # Stop chrome-devtools-mcp if any
Related skills
More from chromedevtools/chrome-devtools-mcp and the wider catalog.
chrome-devtools
Debug, automate, and inspect web pages using Chrome DevTools via MCP protocol.
debug-optimize-lcp
Guides debugging and optimizing Largest Contentful Paint (LCP) using Chrome DevTools MCP tools. Use this skill whenever the user asks about LCP performance, slow page loads, Core Web Vitals optimization, or wants to understand why their page's main content takes too long to appear. Also use when the user mentions "largest contentful paint", "page load speed", "CWV", or wants to improve how fast their hero image or main content renders.
a11y-debugging
Uses Chrome DevTools MCP for accessibility (a11y) debugging and auditing based on web.dev guidelines. Use when testing semantic HTML, ARIA labels, focus states, keyboard navigation, tap targets, and color contrast.
troubleshooting
Uses Chrome DevTools MCP and documentation to troubleshoot connection and target issues. Trigger this skill when list_pages, new_page, or navigate_page fail, or when the server initialization fails.
memory-leak-debugging
Diagnoses and resolves memory leaks in JavaScript/Node.js applications. Use when a user reports high memory usage, OOM errors, or wants to analyze heapsnapshots or run memory leak detection tools like memlab.