Geek-Chow头像
关注

chrome-devtools-mcp vs. Playwright: Debugger‘s Eyes vs. Tester‘s Hands

Abbreviations

AbbreviationFull nameMeaning
MCPModel Context ProtocolStandard for exposing tools to an AI agent
CDPChrome DevTools ProtocolChrome’s wire protocol for remote control and inspection
a11yAccessibility (11 letters between “a” and “y”)Here: the accessibility tree a page exposes
DOMDocument Object ModelThe page’s element tree
CLICommand-Line Interface—
E2EEnd-to-End (testing)Tests that drive the real UI
CIContinuous Integration—
LCP / INP / CLSLargest Contentful Paint / Interaction to Next Paint / Cumulative Layout ShiftCore Web Vitals
CrUXChrome User Experience ReportGoogle’s field performance data
PWAProgressive Web App—

1. The short answer

Both let a program — or an AI agent — drive a real browser. They were built for different jobs:

  • Playwright (Microsoft, 2020) is a browser automation library and test framework. Its purpose is to act on pages reliably across Chromium, Firefox and WebKit, mostly so you can write repeatable E2E tests and scripts. Playwright MCP is a separate, thin MCP server that exposes Playwright to AI agents.
  • chrome-devtools-mcp (Google’s Chrome DevTools team, 2025) is an MCP server that gives an AI agent Chrome DevTools. Its purpose is to inspect and debug a page the way a human developer does in DevTools: performance traces, network requests, console, CSS, memory heap snapshots, Lighthouse. It can click and type too, but that is a means, not the point.

A one-line way to remember it: Playwright is the tester’s hands; chrome-devtools-mcp is the debugger’s eyes.

2. Where they sit in the stack

Microsoft

Google

MCP

MCP

Bash: node script.mjs

CDP

CDP

CDP / patched
protocols

AI agent
(Claude Code, Cursor, Gemini CLI, ...)

Your own script / test suite
(Node, Python, Java, .NET)

chrome-devtools-mcp
(MCP server + CLI)

Puppeteer

DevTools frontend code
(trace analysis, insights)

Playwright MCP
(@playwright/mcp)

Playwright library
+ test runner

Google Chrome / Chrome for Testing

Chromium, Firefox, WebKit
(Playwright-pinned builds)

This diagram answers: what does each tool sit on, and how does an agent reach it?

Points the diagram makes explicit:

  • Both speak CDP to Chrome. At the wire level they do the same thing; the difference is what they choose to expose on top of it.
  • chrome-devtools-mcp is built on Puppeteer, Google’s older Node automation library, plus code from the DevTools frontend itself — which is how it can produce the same performance insights the DevTools Performance panel shows.
  • Playwright was started by the engineers who originally built Puppeteer, after they moved to Microsoft. It generalised the idea to three browser engines and multiple languages.
  • Playwright is a library first. You can use it with no AI at all — and with an AI agent you can call it through the MCP server or through scripts the agent runs with Bash.
  • chrome-devtools-mcp is an MCP server first (it also ships a CLI). You do not write programs against it.

3. Side-by-side

Dimensionchrome-devtools-mcpPlaywright (+ Playwright MCP)
MaintainerGoogle, Chrome DevTools teamMicrosoft
Primary purposeDebugging, inspection, performance analysisAutomation and E2E testing
Primary formMCP server (plus a CLI)Library + test runner; MCP server is an add-on
Built onPuppeteer + CDP + DevTools frontendIts own engine; CDP for Chromium, patched protocols for Firefox/WebKit
BrowsersGoogle Chrome / Chrome for Testing only (other Chromium “may work”)Chromium, Chrome, Edge, Firefox, WebKit (Safari engine)
LanguagesNone — consumed via MCP / CLITypeScript/JavaScript, Python, Java, .NET
Page representation for the agentText snapshot of the a11y tree with a uid per element; screenshots on requestText snapshot of the a11y tree with a ref per element; screenshots on request; optional coordinate “vision” mode
Automation toolsclick, fill, fill_form, hover, drag, press_key, type_text, upload_file, handle_dialog, navigate/new/close/select page, wait_fornavigate, click, type, fill form, select, hover, drag, press key, upload, dialogs, tabs, wait
Distinctive extrasPerformance traces with Core Web Vitals (LCP, INP, CLS) and per-insight analysis, CrUX field data, Lighthouse audits, network request list/detail, console messages with source-mapped stacks, computed CSS styles, heap snapshots and memory analysis, extension and PWA management, CPU/network emulationNetwork mocking, cookie/localStorage control, test assertions and locator generation, PDF output, tracing and video recording, device emulation (--device "iPhone 15"), and — outside MCP — codegen, auto-waiting locators, parallel test runner, HTML reports
Waiting modelWaits for the action’s effects (navigation, network) before returningAuto-waits on locators for actionability (visible, stable, enabled)
Browser binariesUses your installed stable ChromeDownloads browser builds pinned to the Playwright version
Attach to an existing browserYes (--browser-url / running-instance mode)Yes (--cdp-endpoint, or --extension for your real Chrome/Edge)
Token-saving option--slim (basic browser tasks only)Playwright CLI + skills (scripts instead of a large tool schema)

The pinned-binaries row is not academic. In this repo’s csdn-publish skill, the installed Playwright expected chromium-1228, only 1217/1243 were on disk, and the launch failed until an executablePath override was added. chrome-devtools-mcp avoids that class of problem by using the Chrome you already have — at the price of supporting only Chrome.

4. What they have in common

It is easy to over-state the difference, so to be fair:

  • Same page model for the agent. Both default to an accessibility-tree text snapshot with stable element ids, rather than screenshots. Both chose this because text is cheaper and less ambiguous for an LLM than pixels.
  • Same basic actions. For “open this page, fill this form, click submit”, either works.
  • Same security caveat. Each exposes the whole browser session to the MCP client. Anything signed in to that profile is visible to the agent. Use an isolated profile (--isolated in both) unless you specifically need your real session.

5. When to use which

yes

no

yes

no

yes

no

Need a browser
for an agent or script

Is the goal to understand
WHY a page is slow,
broken or leaking?

chrome-devtools-mcp
traces, network, console,
CSS, heap, Lighthouse

Must it run repeatedly,
in CI, or on Firefox/Safari?

Playwright library
(test suite or script)

Exploring an unknown page,
one-off task?

Playwright MCP
or chrome-devtools-mcp

This diagram answers: given a task, which tool should I reach for first?

Concrete cases:

TaskPickWhy
“Why is LCP 4 s on the product page?”chrome-devtools-mcpRecords a trace and reads the same insights the Performance panel shows
“This button does nothing — find out why”chrome-devtools-mcpConsole errors with source-mapped stacks, failing network requests, computed styles
“Is this SPA leaking memory after navigation?”chrome-devtools-mcpHeap snapshots, compare, retaining paths
“Write a regression test for checkout”PlaywrightAssertions, auto-waiting locators, test runner, CI, cross-browser
“Publish this article to CSDN every week”Playwright library scriptDeterministic, zero tokens per step (this repo’s csdn-publish skill)
“Upload this video through a site I have never automated”Playwright MCPAgent explores step by step (this repo’s bilibili-uploader skill)
“Does it work in Safari?”PlaywrightOnly option with WebKit

They are not exclusive. A natural loop for an agent: reproduce and diagnose with chrome-devtools-mcp, fix the code, then lock the fix in with a Playwright test.

6. Conclusion

  • Playwright answers “make the browser do this, reliably, everywhere”. It is a cross-browser, multi-language automation library and test framework; Playwright MCP is its agent-facing wrapper.
  • chrome-devtools-mcp answers “tell me what is going on inside this Chrome page”. It is an agent-only window into Chrome DevTools — performance, network, console, styles and memory — with enough automation to reach the state you want to inspect.
  • They share the same foundation (CDP) and the same agent-facing page model (a11y snapshots), so simple navigation tasks work with either. Pick by the job: debugging → chrome-devtools-mcp; testing and repeatable automation → Playwright.

For how Playwright is wired into Claude Code in this repo (MCP server vs. library-via-Bash), see How Playwright Works with Claude Code.

References

转载自 CSDN-专业IT技术社区

原文链接:https://blog.csdn.net/PhilZhou/article/details/167391569

文章来源转载

评论

赞0

评论列表

微信小程序
QQ小程序

关于作者

点赞数:0
关注数:0
粉丝:0
文章:0
关注标签:0
加入于:--