Run End-to-End Tests from Your Terminal with Kane CLI
Author and Run Tests Right from the Terminal in Natural Language, with an Evidence-Backed Pass or Fail from a Real Browser.
npm install -g @testmuai/kane-cli
Playwright CLI vs Playwright MCP: Which Should Your Coding Agent Use?
playwright-cli vs Playwright MCP for coding agents: tokens, setup, CI and who judges the result. Plus where Kane CLI fits, with Cursor and Claude Code.
Last Updated on:
Use Playwright CLI or Playwright MCP when your agent needs to drive a browser, and Kane CLI when it needs a verdict. Playwright CLI suits coding agents that work through the shell and file system. Playwright MCP suits long exploratory sessions that benefit from a live view of the page. Neither decides whether your app works; the agent does. Kane CLI takes a goal in plain English and returns pass or fail with evidence, so the agent stops grading its own homework.
Most comparisons stop at "CLI uses fewer tokens." That's Microsoft's guidance, and it's true per call. But Slack Engineering measured 200+ agent runs, and on a long flow Playwright CLI used more tokens than MCP. Both statements hold, because the cost of a task depends on how many turns the agent takes. Give each tool its own job and you can use all three without paying twice.
The short answer: Playwright CLI vs Playwright MCP vs Kane CLI
| If you want to... | Use | Why |
|---|---|---|
| Let a coding agent poke at your running app while you build | Playwright CLI | Small outputs, snapshots saved to files, works through the shell |
| Run a long, open-ended browsing session with lots of reasoning | Playwright MCP | Keeps a live view of the page in the agent's context |
| Know whether a user flow actually works, and gate a release on it | Kane CLI | Judges against criteria you write; returns exit codes and evidence |
| Get frozen test code you maintain yourself | Playwright Test (npx playwright test) | Deterministic, fast, mature tooling around it |
What is Playwright CLI?
Playwright CLI (playwright-cli) is Microsoft's command-line tool for driving a browser from the shell, built with coding agents in mind. Each command does one thing (open a page, click, type, take a snapshot) and prints a short result. The CLI writes page snapshots to a file, and the output points to that file instead of printing the whole page. The agent reads the file only when it needs to.
npm install -g @playwright/cli@latest
playwright-cli install --skills # teaches Claude Code, Copilot and others how to use it
playwright-cli --helpCurrent versions as of November 2026: @playwright/cli 0.1.24 and @playwright/mcp 0.0.85. The Cursor measurements later in this article were taken on Playwright MCP 0.0.83.
Sessions live in memory by default, so cookies survive between commands but disappear when the browser closes. Add --persistent to keep the profile on disk, or -s=name to run several named sessions side by side. The whole command set is in the reference of Playwright CLI commands.
Which Chrome build these sessions use, and with which sandbox setting, is compared with Playwright MCP and the test runner in Playwright sandbox for AI agents. The Playwright 1.65 release guide lists the Chromium, Firefox and WebKit builds that version bundles.
What is Playwright MCP?
Playwright MCP is Microsoft's MCP server that gives an agent a browser as a set of tools. Each action returns an accessibility snapshot of the page straight into the model's context, so the agent always "sees" the current state. That helps when the agent is exploring and gets expensive on busy pages. To map a whole web app instead of one page, Kane CLI Exploration walks every screen it can reach and records the flows between them. For setup, flags and safety, see our Playwright MCP guide.
What is Kane CLI?
Kane CLI is TestMu AI's testing agent for the terminal. You give it one goal in plain English. It drives a real Chrome browser itself, checks the outcome against the criteria in your goal, and returns one result: pass, fail, setup error or timeout. Every run produces an .evidence pack with steps, screenshots and logs. Flows you save as a test.md replay from cache on later runs, with no agent and no LLM cost, and re-author only the steps your UI changed.
The difference between Playwright MCP and Kane CLI is who decides: Playwright MCP hands the agent browser snapshots and leaves the judgment to the model; Kane CLI runs the objective itself and hands the agent a verdict.
npm install -g @testmuai/kane-cliYou can also point your coding agent such as Claude Code, Codex CLI, and Gemini CLI to install Kane CLI using the below Kane CLI skill command. Run this command from your project root, then ask your AI assistant to use SKILL.md.
npx agentskillsforall add https://github.com/LambdaTest/kane-cli --skill kane-cli # Claude Code, Codex CLI and Gemini CLIIf your coding agent plans from a spec, the guide to spec-driven development tools shows how to add a testing step to each tool.
What's the difference between MCP vs CLI?
The difference between MCP vs CLI is where the page data goes. With MCP, the snapshot goes into the model's context after every action. With CLI, the snapshot goes into a file, and the agent decides whether to read it.
Model APIs are stateless, so every turn re-sends the whole conversation, including every snapshot taken so far. You pay for a big snapshot in context again on every later turn, which is the case for CLI.
Is Playwright CLI really cheaper than Playwright MCP?
Per command, yes. Per task, it depends on how many turns the agent takes.
Microsoft's README says Playwright CLI with skills is more token-efficient for coding agents because it keeps large tool schemas and accessibility trees out of context. Slack Engineering then ran the same complex flow through both, with the same model (Slack Engineering, June 2026):
| Same flow, Claude Opus 4.6 | Turns | Tokens |
|---|---|---|
| Playwright MCP | ~40 | ~3.8M |
| Playwright CLI | ~85 | ~6M |
Across their full experiment, Playwright CLI also failed more often (about 12 to 20% versus 0 to 12% for MCP), mostly on login, timing and session handling rather than reasoning.
Both claims hold. Each CLI command is cheap, but one browser action through the CLI often becomes several commands (act, wait, snapshot, read the file, find the element), and each extra turn re-sends the whole conversation. CLI wins on a short task, and on a long one the turn count can eat the savings. So measure turns per task, not tokens per call.
If you work in Claude Code, our guide to Claude Code tokens shows how to find which MCP server or subagent is using your plan with /usage.
What does the same task look like in each tool?
Task: in a notes app, create a note called "Q4 plan", tag it "work", search for it and confirm it shows up.
Playwright CLI. The agent runs a sequence like this (the e references come from the snapshot and will differ on your page):
playwright-cli open https://notes.staging.app # Use your sample URL here.
playwright-cli snapshot
playwright-cli click e14 # "New note"
playwright-cli fill e22 "Q4 plan"
playwright-cli click e31 # tag picker
playwright-cli click e38 # "work"
playwright-cli fill e9 "Q4 plan" # search box
playwright-cli snapshot # agent reads the file to check resultsThe agent then reads the last snapshot and decides for itself whether the note appeared.
Playwright MCP. The same steps happen as tool calls (browser_navigate, browser_click, browser_type and so on), and every call returns the page snapshot into context. The agent again decides whether it worked.
Kane CLI. One command runs the flow, and this time the check decides whether it worked:
kane-cli run "Create a note called 'Q4 plan', tag it 'work', search for 'Q4 plan', \
and verify the note appears in the results with the 'work' tag" \
--url https://notes.staging.app --agent --headless \
| tail -1 | jq '{status, one_liner, test_url}'Your coding agent gets one line back. Exit code 0 means pass, 1 fail, 2 setup error, 3 timeout. For a closer look at that verdict next to Playwright MCP's click and snapshot tools, read the roundup of Playwright MCP alternatives.
Using Kane CLI from Cursor instead of Playwright MCP
In Cursor, the split comes down to who drives the browser and who calls the result. With Playwright MCP, Cursor's own model calls browser tools one step at a time and decides whether the test passed. With Kane CLI, Cursor hands one objective to a separate browser agent and gets back a pass or fail verdict with evidence. We ran one flow ourselves, so treat the numbers as one data point: on TestMu AI's Ecommerce Playground, open the store, search for "iPhone", open the first result, add it to the cart, and confirm the cart lists an iPhone. For setting up Playwright MCP in Cursor, see using Playwright with Cursor. For how Kane CLI compares with Cursor's own Bugbot and cloud agents, see Kane CLI vs Cursor.
- Playwright MCP 0.0.83 - We connected through the official MCP SDK client, the same protocol Cursor uses, and made the tool calls a Cursor agent would make, without a model in between. That isolates what the tools themselves return.
- Two reading strategies - In the first, the agent reads the page with a full
browser_snapshotbefore each action. In the second, it usesbrowser_find, which searches the snapshot and returns only matching nodes. - Why the second read is needed - In 0.0.83, action tools such as
browser_navigateandbrowser_clicksave the snapshot to a file and return only a link, so the agent has to ask for the page again before its next action. - Kane CLI in agent mode - We ran the same flow as one objective with
--agent --headless, then replayed the saved test. - Token counts - Every response was counted with the o200k_base tokenizer. Cursor's models tokenize slightly differently, and the counts leave out Cursor's own reasoning, which grows with each of the 12 Playwright MCP turns.
| Measure | Playwright MCP, full snapshots | Playwright MCP, browser_find | Kane CLI, first run | Kane CLI, replay |
|---|---|---|---|---|
| Setup text loaded | 4,396 tokens of tool definitions | 4,396 tokens of tool definitions | 1,784 tokens, if Cursor reads the hosted skill | Same skill, already read |
| Calls from Cursor | 12 tool calls | 12 tool calls | 1 command | 1 command |
| Text returned to Cursor | 42,333 tokens | 4,076 tokens | 2,056 tokens in 24 NDJSON lines | 3,575 tokens in 53 NDJSON lines |
| Final result line only | None; Cursor decides | None; Cursor decides | 764 tokens | 65 tokens |
| Browser time | 15 seconds, plus Cursor's thinking on 12 turns | 15 seconds, plus Cursor's thinking on 12 turns | 96.7 seconds, reasoning included | 23 seconds |
| Kane CLI credits | None | None | 22.8 credits | None |
All four runs confirmed an iPhone in the cart. The per-call log shows where the tokens went:
- Snapshots are the cost - With full snapshots, four page reads made up 41,385 of the 42,333 tokens. The store's home page alone was 20,116 tokens, a 1,360-line accessibility tree with 1,156 element references.
- browser_find helps, if the agent knows what to look for - Searching for "Search For Products" or "Add to Cart" cut the reads to a few hundred tokens each. The search-results page still returned 2,241 tokens, because "iPhone" matched every product card.
- Kane CLI's result is small and structured - Cursor can read only the final run_end line, which carries the status, a summary, and the values Kane CLI extracted. Kane CLI's own model work is billed as credits, outside Cursor's context.
- Approval checks add up - The Playwright MCP flow made 12 MCP tool calls, which means 12 prompts under an empty allowlist or 12 classifier reviews under Auto-review. The Kane CLI command needed at most one, and only Run Everything skips the checks.
The broader trade-off is covered in MCP vs CLI.
Playwright CLI vs Playwright MCP vs Kane CLI: full comparison
For a quick visual walkthrough of this concept, watch the video below from TestMu AI.
Subscribe to the TestMu AI YouTube channel for more tutorials on testing and automation.
| Playwright CLI | Playwright MCP | Kane CLI | |
|---|---|---|---|
| Made by | Microsoft | Microsoft | TestMu AI |
| What it is | Shell commands for browser actions | MCP server exposing browser tools | Testing agent that returns a verdict |
| Unit of work | One action per command | One action per tool call | One goal per command |
| Where page data goes | Snapshot file on disk | Model context, every step | Stays inside Kane's own run; agent gets one result line |
| Who decides pass/fail | The calling agent | The calling agent | Criteria in your goal, checked against the page DOM by default |
| Second run of the same flow | Agent reasons through it again | Agent reasons through it again | Replays saved steps from cache with no LLM cost; re-authors only what changed |
| Parallel runs | Named sessions (-s=name) | --isolated or separate profiles | One isolated Chrome per process; testrun run --parallel N |
| CI signal | Your script decides | Not designed for it | Exit codes 0/1/2/3, NDJSON output |
| Evidence | Files you keep | What you collect | Hash-verified .evidence pack |
| Native mobile apps | No | No | iOS Simulator and Android Emulator |
| Export to Playwright code | Generates code | Locators only, via the testing tools | Python or JavaScript export |
| Agent skill | playwright-cli install --skills | MCP config | npx @testmuai/kane-cli-skill |
Which should run in CI?
Neither Playwright CLI nor Playwright MCP is built to be a CI gate on its own, because the agent's judgment decides the result. In CI you want a fixed pass/fail rule, a time limit and a predictable cost. Use Playwright Test for code you maintain, or Kane CLI for flows written as intent:
- run: npm install -g @testmuai/kane-cli
- name: Verify critical flows
env:
LT_USERNAME: ${{ secrets.LT_USERNAME }}
LT_ACCESS_KEY: ${{ secrets.LT_ACCESS_KEY }}
run: |
kane-cli testrun run --tags smoke --parallel 4 --on-failure fail-fast \
--headless --username "$LT_USERNAME" --access-key "$LT_ACCESS_KEY"When the coding agent itself is what you test, the guide on how to gate GitHub Actions on Rook CLI verdicts sets up the same kind of job. For flows that come from a spec.md, the Spec Kit with Claude Code tutorial gates spec-driven changes in CI. If your agent browses through OpenCode, OpenCode Browse vs Kane CLI weighs its signed-in browser tool against a saved test that gates releases.
How do you use all three without paying twice?
Give your agent clear jobs for each tool. Put rules like these in your CLAUDE.md or AGENTS.md:
## Browser tools
- To look at the app while coding (inspect a page, read console errors,
try a click): use playwright-cli.
- For long exploratory sessions where you need to keep reasoning over the
page: use Playwright MCP.
- Before saying a UI change is done: run
kane-cli run "<goal and expected result>" --agent --headless
and only report done on exit code 0. Include the test_url.
- Never decide pass/fail from your own reading of a snapshot.The last rule separates the agent that writes the code from the check that proves it works. Our guide to AI coding agent verification shows how to enforce that rule with a hook instead of trusting the agent to follow it.
Author
Anubhav Singhmaar is an AI Product Manager at TestMu AI driving Kane CLI, the command-line tool that brings browser automation to the terminal, turning natural-language flows into runs in a real Chrome browser that return pass or fail with shareable proof. He owns the roadmap and prioritization and works with engineering to ship developer-facing features. Before TestMu AI, he spent over four years at Sprinklr owning enterprise voice AI across APAC and EMEA. A mechanical engineer turned product manager, he grounds guidance in real QA workflows.
Reviewer
Srinivasan Sekar is Director of Engineering at TestMu AI, where he leads engineering and open-source initiatives behind the Selenium and Appium automation grid and owns TestMu AI's MCP Server. A committer to Appium and a contributor to Selenium, WebdriverIO, Taiko, and AppiumTestDistribution, he brings over 15 years of experience in quality engineering and open-source technologies. He is the author of the Apress book 'The MCP Standard: A Developer's Guide to Building Universal AI Tools with the Model Context Protocol,' a Certified Kubernetes and Cloud Native Associate, and an international conference speaker. Before TestMu AI he spent over eight years at Thoughtworks as a Principal Consultant and Quality Architect. Srinivasan holds a B.Tech in Information Technology from Anna University.
Playwright CLI vs MCP FAQs
Did you find this page helpful?
More Related Blogs
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance
- Advanced access controls
- Advanced data retention rules
- Advanced Local Testing
- Premium Support options
- Early access to beta features
- Private Slack Channel
- Unlimited Manual Accessibility DevTools Tests


















