──────────────────────────────────────── For a long time, browser automation tools were designed for humans to write UI Automated Tests, Scrapping and sometimes some other automation workflows. An engineer would write the code, read the errors, decide the next step, and repeat. But now, AI coding agents can now handle many of those steps directly. Engineers shift toward directing the agent, reviewing results, and setting constraints. ──────────────────────────────────────── ▶ Playwright MCP Playwright MCP was one of the earlier tools that let AI agents interact with a browser. It allowed an agent to open pages, click elements, take snapshots, and perform basic browser tasks. Common uses included: • Inspecting page structure • Gathering element information • Debugging UI behavior • Reading console and network activity The flow was straightforward. The engineer gave the agent a task, and the agent used Playwright MCP to control the browser. ──────────────────────────────────────── ▶ Context Cost of Playwright MCP (old way) Playwright MCP works by loading a full page snapshot (HTML and related data) into the agent’s context after interactions. It also includes tool metadata. This can consume a noticeable portion of the available context window in a single use. As context fills up, agents become more likely to lose track of earlier instructions or make mistakes. The agent’s context functions as working memory. It holds the conversation, instructions, code, and any data the agent needs to stay coherent. Filling it with large page snapshots reduces room for everything else. ──────────────────────────────────────── ▶ Playwright CLI (new way) Playwright CLI takes a lighter approach. It gives the agent a command-line interface it can call like any other terminal tool. The agent runs small commands and receives focused results. Full page data is loaded only when the agent explicitly requests it. This keeps context usage lower. The agent decides what information it needs instead of receiving large snapshots by default.