跳到正文
DEV Community· TestMu AI Team·· 1 小時前AI 評分54

Playwright MCP 與 Kane CLI 的 tokens 用量比較:42,333 對 2,056

Playwright MCP vs Kane CLI: 42,333 vs 2,056 tokens

AI 導讀

TestMu AI 團隊以同一個網店購物流程比較 Playwright MCP 與 Kane CLI,計得完整頁面快照模式使用 42,333 個 tokens、browser_find 模式使用 4,076 個,Kane CLI 首次執行則使用 2,056 個。

正文

When a coding agent tests a web app through Playwright MCP, its own model drives the browser one tool call at a time and decides whether the test passed. With Kane CLI, which we build at TestMu AI (formerly LambdaTest), the agent hands one plain-English objective to a separate browser agent and gets back a pass or fail with evidence.

We wanted to know how much text each approach puts in front of the calling agent, so we ran the same flow both ways and counted every response.

The short version:

  • Playwright MCP, reading full snapshots: 42,333 tokens
  • Playwright MCP, using browser_find: 4,076 tokens
  • Kane CLI, first run: 2,056 tokens

The headline gap is against full snapshots. Against browser_find, the gap is much smaller. This is one flow, so treat it as one data point.

The flow

On TestMu AI's Ecommerce Playground:

  1. Open the store
  2. Search for "iPhone"
  3. Open the first result
  4. Add it to the cart
  5. Confirm the cart lists an iPhone

How we measured

  • 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, with no model in between. That isolates what the tools themselves return. It also means this was not a live Cursor session.
  • Two ways of reading the page. In the first, the agent takes a full browser_snapshot before each action. In the second, it uses browser_find, which searches the snapshot and returns only the matching nodes.
  • Why the second read is needed. In 0.0.83, action tools such as browser_navigate and browser_click save 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.
  • Counting. Every response was counted with the o200k_base tokenizer.

The results

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 the agent reads the hosted skill Same skill, already read
Calls from the agent 12 tool calls 12 tool calls 1 command 1 command
Text returned to the agent 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; the agent decides None; the agent decides 764 tokens 65 tokens
Browser time 15 seconds, plus the agent's thinking on 12 turns 15 seconds, plus the agent'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.

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. The agent can read only the final run_end line, which carries the status, a summary and the values Kane CLI extracted.

Approval checks add up. The Playwright MCP flow made 12 MCP tool calls. In Cursor, that means 12 prompts under an empty allowlist, or 12 classifier reviews under Auto-review. The Kane CLI command needed at most one. Only Run Everything skips the checks.

Where Kane CLI came out worse

  • The first run was slower. It took 96.7 seconds against 15 seconds of browser time for Playwright MCP. The two aren't like for like: 96.7 includes Kane CLI's reasoning, and 15 leaves out the calling agent's thinking on 12 turns. It is still a wait you will notice.
  • It cost 22.8 credits. Kane CLI's own model work is billed as credits, outside the calling agent's context. The work is still paid for, in a different place.
  • The replay returned more text than the first run: 3,575 tokens against 2,056. The final line alone was 65 tokens, and the replay used no credits, but an agent that reads the whole stream reads more.

What these numbers do not show

  • One flow on one demo store. A lighter page would shrink the snapshot cost.
  • The calling agent's reasoning isn't counted. It grows with each of the 12 Playwright MCP turns, and the totals above leave it out.
  • Tokenizers differ. Cursor's models tokenize slightly differently from o200k_base.
  • Setup text is a separate row. The 42,333, 4,076 and 2,056 figures leave it out.
  • Versions move. This was Playwright MCP 0.0.83, and newer versions have shipped since. Re-measure before relying on the figures.

Which one to use

  • Playwright MCP for long, open-ended browsing sessions where the agent needs a live view of the page. If token cost matters, try browser_find before full snapshots.
  • Kane CLI when you need to know whether a user flow works and want an exit code to act on.

The difference 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.

Try it on your own flow

Kane CLI installs from npm. This is the shape of the two Kane CLI runs, a first run saved by name and then a replay:

npm install -g @testmuai/kane-cli
kane-cli login --oauth

# First run, saved so it can be replayed
kane-cli run "Go to <your-store-url>, search for 'iPhone', open the first result, add it to the cart, then verify the cart lists an iPhone" \
  --agent --headless --name iphone-cart

# Replay
kane-cli testmd run .testmuai/tests/iphone-cart_test.md --agent --headless

Run the same flow through Playwright MCP, count the responses with one tokenizer, and compare. If you get very different numbers, post the flow and the versions in the comments.

This measurement was first published in Playwright CLI vs Playwright MCP: Which Should Your Coding Agent Use?, which also covers Playwright CLI.

來源:DEV Community · dev.to