Chrome Devtools Cli

by ChromeDevTools1cec9cd1a3bbNo license53K starsListed Oct 8, 2026Updated Oct 8, 2026Repository updated today

Use this skill to write shell scripts or run shell commands to automate tasks in the browser or otherwise use Chrome DevTools via CLI.

Instructions onlySoftware Development
AI-generated overview

Drives Chrome DevTools from the shell to automate browser tasks, inspect pages, and capture performance data.

What it does
Documents the chrome-devtools-mcp command-line interface, which lets an agent control a browser from the terminal. It covers navigation, element snapshots and input automation, network and console inspection, performance tracing, heap snapshots, screenshots, Lighthouse audits, extensions, PWAs, and experimental features. Commands return Markdown-like text or JSON and can save output to files.
When to use it
Use it when a task requires automating a browser or inspecting a live page from the command line, such as clicking through a flow, reading console or network activity, or profiling page performance. It suits scripted or agent-driven browser work rather than manual browsing.
Requirements
The chrome-devtools-mcp CLI must be installed and a Chrome browser available; installation is covered in a bundled reference file. Some features need extra flags or tools, such as ffmpeg for screencasts. No scripts ship with the skill.

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 [blocked] for setup. Installation is a one-time prerequisite and is not part of the regular AI workflow.

AI Workflow

  1. Execute: Run tools directly. If you don't know the target page's ID, run chrome-devtools list_pages to find it. The background server starts implicitly; do not run start/status/stop before each use.
  2. Inspect: Use chrome-devtools take_snapshot <pageId> to get an element <uid>.
  3. Act: Use chrome-devtools click <pageId> <uid>, chrome-devtools fill <pageId> <uid> <value>, 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"

Permissions & File Access

By default, the CLI has full filesystem access (--allowUnrestrictedPaths=true), allowing file-saving parameters (--filePath, --outputDirPath) and upload_file to access files anywhere on the system. Pass --allowUnrestrictedPaths=false if you want to restrict file access to the OS temp directory.

Command Usage

sh
chrome-devtools <tool> [arguments] [flags]
  • Required arguments are passed positionally; optional arguments use flags.
  • Use --help on any command for usage details.
  • Output defaults to plain Markdown-like text; pass --output-format=json for JSON.

Input Automation (<uid> from snapshot)

bash
chrome-devtools take_snapshot 1 # Take a text snapshot of the page to get UIDs for elementschrome-devtools click 1 "id" # Clicks on the provided elementchrome-devtools click 1 "id" --dblClick true --includeSnapshot true # Double clicks and returns a snapshotchrome-devtools drag 1 "src" "dst" # Drag an element onto another elementchrome-devtools drag 1 "src" "dst" --includeSnapshot true # Drag an element and return a snapshotchrome-devtools fill 1 "id" "text" # Type text into an input, textarea, or select an optionchrome-devtools fill 1 "id" "text" --includeSnapshot true # Fill an element and return a snapshotchrome-devtools handle_dialog 1 accept # Handle a browser dialog (accept/dismiss)chrome-devtools handle_dialog 1 dismiss --promptText "hi" # Dismiss a dialog with prompt textchrome-devtools hover 1 "id" # Hover over the provided elementchrome-devtools hover 1 "id" --includeSnapshot true # Hover over an element and return a snapshotchrome-devtools press_key 1 "Enter" # Press a key or key combination ("Control+A", "Escape")chrome-devtools press_key 1 "Control+A" --includeSnapshot true # Press a key and return a snapshotchrome-devtools type_text 1 "hello" # Type text using keyboard into a focused inputchrome-devtools type_text 1 "hello" --submitKey "Enter" # Type text and press a submit keychrome-devtools upload_file 1 "id" "file.txt" # Upload a file through a provided elementchrome-devtools upload_file 1 "id" "file.txt" --includeSnapshot true # Upload a file and return a snapshot

Navigation

bash
chrome-devtools close_page 1 # Closes the page by its indexchrome-devtools list_pages # Get a list of pages open in the browserchrome-devtools navigate_page 1 --url "https://example.com" # Navigates the currently selected page to a URLchrome-devtools navigate_page 1 --type "reload" --ignoreCache true # Reload page ignoring cachechrome-devtools navigate_page 1 --url "https://example.com" --timeout 5000 # Navigate with a timeoutchrome-devtools navigate_page 1 --handleBeforeUnload "accept" # Handle before unload dialogchrome-devtools navigate_page 1 --type "back" --initScript "foo()" # Navigate back and run an init scriptchrome-devtools new_page "https://example.com" # Creates a new pagechrome-devtools new_page "https://example.com" --background true --timeout 5000 # Create new page in backgroundchrome-devtools new_page "https://example.com" --isolatedContext "ctx" # Create new page with isolated contextchrome-devtools select_page 1 # Select a page as a context for future tool callschrome-devtools select_page 1 --bringToFront true # Select a page and bring it to front

Emulation

bash
chrome-devtools emulate 1 --networkConditions "Offline" # Emulate network conditionschrome-devtools emulate 1 --cpuThrottlingRate 4 --geolocation "0x0" # Emulate CPU throttling and geolocationchrome-devtools emulate 1 --colorScheme "dark" --viewport "1920x1080" # Emulate color scheme and viewportchrome-devtools emulate 1 --userAgent "Mozilla/5.0..." # Emulate user agentchrome-devtools resize_page 1 1920 1080 # Resizes the selected page's window

Performance

bash
chrome-devtools performance_analyze_insight 1 "1" "LCPBreakdown" # Get more details on a specific Performance Insight (pageId, insightSetId, insightName)chrome-devtools performance_start_trace 1 --reload true --autoStop false # Starts a performance trace recording (reload, autoStop)chrome-devtools performance_start_trace 1 --reload true --autoStop true --filePath "t.json.gz" # Start trace and save to a filechrome-devtools performance_stop_trace 1 # Stops the active performance tracechrome-devtools performance_stop_trace 1 --filePath "t.json.gz" # Stop trace and save to a file

Memory

bash
chrome-devtools take_heapsnapshot 1 "./snap.heapsnapshot" # Capture a memory heap snapshot

Memory Debugging (requires --memoryDebugging=true)

bash
chrome-devtools get_heapsnapshot_summary "./snap.heapsnapshot" # Get snapshot summary statschrome-devtools compare_heapsnapshots "./base.heapsnapshot" "./target.heapsnapshot" # Compare two snapshotschrome-devtools get_heapsnapshot_class_nodes "./snap.heapsnapshot" "Array" # Inspect class instanceschrome-devtools get_heapsnapshot_details "./snap.heapsnapshot" 123 # Detailed object propertieschrome-devtools get_heapsnapshot_dominators "./snap.heapsnapshot" 123 # Dominator tree for nodechrome-devtools get_heapsnapshot_duplicate_strings "./snap.heapsnapshot" # Find duplicated stringschrome-devtools get_heapsnapshot_edges "./snap.heapsnapshot" 123 # Node edges/referenceschrome-devtools get_heapsnapshot_object_details "./snap.heapsnapshot" 123 # Object details by node IDchrome-devtools get_heapsnapshot_retainers "./snap.heapsnapshot" 123 # Retaining objectschrome-devtools get_heapsnapshot_retaining_paths "./snap.heapsnapshot" 123 # Shortest retaining pathschrome-devtools close_heapsnapshot "./snap.heapsnapshot" # Free memory from loaded snapshot

Network

bash
chrome-devtools get_network_request 1 # Get the currently selected network request for page 1chrome-devtools get_network_request 1 --reqid 1 --requestFilePath "req.md" # Get request by id and save to filechrome-devtools get_network_request 1 --responseFilePath "res.md" # Save response body to filechrome-devtools list_network_requests 1 # List all network requests for page 1chrome-devtools list_network_requests 1 --pageSize 50 --pageIdx 0 # List network requests with paginationchrome-devtools list_network_requests 1 --resourceTypes Fetch # Filter requests by resource typechrome-devtools list_network_requests 1 --includePreservedRequests true # Include preserved requests

Debugging & Inspection

bash
chrome-devtools evaluate_script "() => document.title" --pageId 1 # Evaluate a JavaScript function on page 1chrome-devtools evaluate_script "(a) => a.innerText" --pageId 1 --args 1_4 # Evaluate JS with UID arguments on page 1chrome-devtools get_console_message 1 1 # Gets a console message by its IDchrome-devtools lighthouse_audit 1 --mode "navigation" # Run Lighthouse audit for navigationchrome-devtools lighthouse_audit 1 --mode "snapshot" --device "mobile" # Run Lighthouse audit for a snapshot on mobilechrome-devtools lighthouse_audit 1 --outputDirPath ./out # Run Lighthouse audit and save reportschrome-devtools list_console_messages 1 # List all console messageschrome-devtools list_console_messages 1 --pageSize 20 --pageIdx 1 # List console messages with paginationchrome-devtools list_console_messages 1 --types error --types info # Filter console messages by typechrome-devtools list_console_messages 1 --includePreservedMessages true # Include preserved messageschrome-devtools take_screenshot 1 # Take a screenshot of the page viewportchrome-devtools take_screenshot 1 --fullPage true --format "jpeg" --quality 80 # Take a full page screenshot as JPEG with qualitychrome-devtools take_screenshot 1 --uid "id" --filePath "s.png" # Take a screenshot of an elementchrome-devtools take_snapshot 1 # Take a text snapshot of the page from the a11y treechrome-devtools take_snapshot 1 --verbose true --filePath "s.txt" # Take a verbose snapshot and save to file

Extensions

bash
chrome-devtools list_extensions # Lists all the Chrome extensions installed in the browserchrome-devtools install_extension "/path/to/extension" # Installs a Chrome extension from the given pathchrome-devtools uninstall_extension "extension_id" # Uninstalls a Chrome extension by its IDchrome-devtools reload_extension "extension_id" # Reloads an unpacked Chrome extension by its IDchrome-devtools trigger_extension_action "extension_id" # Triggers the default action of an extension by its ID

Progressive Web Apps (requires --categoryPwa=true)

bash
chrome-devtools install_pwa "https://example.com/" # Install PWA by manifest ID or URLchrome-devtools launch_pwa "https://example.com/" # Launch installed PWAchrome-devtools get_os_app_state "https://example.com/" # Get OS app installation statechrome-devtools uninstall_pwa "https://example.com/" # Uninstall PWA and close windows

Experimental Features

Experimental tools are disabled by default. Enable them with the corresponding flag during start.

bash
chrome-devtools click_at 1 100 200 # Clicks at the provided coordinates on page 1 (requires --experimentalVision=true)chrome-devtools screencast_start 1 --filePath "screen.mp4" # Starts a screencast recording on page 1 (requires --experimentalScreencast=true and ffmpeg)chrome-devtools screencast_stop 1 # Stops the active screencast on page 1chrome-devtools list_webmcp_tools 1 # List all WebMCP tools on page 1 (requires --categoryExperimentalWebmcp=true)chrome-devtools execute_webmcp_tool 1 "tool_name" --input '{"arg":"val"}' # Execute a WebMCP tool on page 1 (requires --categoryExperimentalWebmcp=true)chrome-devtools list_3p_developer_tools 1 # List third-party developer tools on page 1 (requires --categoryExperimentalThirdParty=true)chrome-devtools execute_3p_developer_tool 1 "tool_name" --params '{"arg":"val"}' # Execute third-party developer tool on page 1 (requires --categoryExperimentalThirdParty=true)

Service Management

bash
chrome-devtools start   # Start or restart chrome-devtools-mcpchrome-devtools start --headless=false # Start with visible browser windowchrome-devtools status  # Checks if chrome-devtools-mcp is runningchrome-devtools stop    # Stop chrome-devtools-mcp if any

Source and attribution

Source:ChromeDevTools/chrome-devtools-mcpinskills/chrome-devtools-cliat commit1cec9cd

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal