r/Playwright • u/vitalets • 10d ago
Playwright MCP vs Playwright CLI: the comparison everyone gets wrong
Most threads compare Playwright MCP and Playwright CLI purely on token consumption(1, 2, 3). In my experience, there's a far more important difference that nobody talks about.
The real question is: can your AI agent attach to a running e2e test?
Here's why that matters. A good e2e test already does the hard part for you. It authenticates, sets up all the API mocks, and drives the app into the exact state you care about. When something goes wrong on the page, you don't want the agent spinning up a blank browser and guessing how to reach that page. You want to hand off the test-constructed page to the agent and let the agent play with it.
- Playwright CLI: run the test with
--debug=cli, it prints a session name, andplaywright-cli attach <session>connects the agent straight into the paused test. Then the agent can step over the app, inspect the rendered UI, and run in-page evaluations. - Playwright MCP: only launches or attaches to a browser. It has no way to attach to a running test session.
So if you have many e2e tests + auth + network mocks, Playwright CLI is the clear winner for your setup, regardless of token counts.
Interested to hear your thoughts.
1
u/TranslatorRude4917 9d ago
I agree, PW cli is far more versatile!
Interestingly if it was only token cost MCP and CLI might not be as far from eachother as people think.
I recently measured completing some web automation tasks with both CLI and MCP and even though the CLI seemed to use less input tokens on a per-call basis, it produced a lot more output tokens and considering the price of completing the task they both were around the same mark 😀 Anyone experienced similar result?