<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Accessibility-Tree on K-Life Hack | Systems Architecture &amp; DevOps</title><link>https://klifehack.com/en/tags/accessibility-tree/</link><description>Recent content in Accessibility-Tree on K-Life Hack | Systems Architecture &amp; DevOps</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Wed, 09 Sep 2026 10:03:04 +0900</lastBuildDate><atom:link href="https://klifehack.com/en/tags/accessibility-tree/index.xml" rel="self" type="application/rss+xml"/><item><title>Accessibility Tree-Based AI Browser Automation Architecture with Playwright MCP</title><link>https://klifehack.com/en/p/playwright-mcp-browser-automation-architecture/</link><pubDate>Wed, 09 Sep 2026 10:03:04 +0900</pubDate><guid>https://klifehack.com/en/p/playwright-mcp-browser-automation-architecture/</guid><description>&lt;p&gt;In automated web browser testing and E2E verification, implementations relying on hardcoded CSS selectors or XPath easily break due to subtle UI modifications or dynamic class name obfuscation (CSS-in-JS, Tailwind, production build minification). Furthermore, recent screenshot coordinate estimation approaches using LLMs or multimodal models are vulnerable to screen resolution discrepancies and responsive rendering variations, frequently causing non-deterministic operational errors.&lt;/p&gt;&#10;&lt;p&gt;To eliminate such operational friction, &amp;ldquo;Playwright MCP,&amp;rdquo; based on the Model Context Protocol (MCP) being developed within the Microsoft ecosystem, has been introduced. This article outlines the architecture of the Accessibility Tree (A11y Tree) snapshot mechanism adopted by Playwright MCP, the deployment procedures for various MCP client environments, and troubleshooting strategies during operation.&lt;/p&gt;&#10;&lt;h2 id="structural-approach-accessibility-tree-snapshot-mechanism"&gt;Structural Approach: Accessibility Tree Snapshot Mechanism&#10;&lt;/h2&gt;&lt;p&gt;Rather than relying on pixel-level image recognition or decorative nested &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; tag structures, Playwright MCP provides the Accessibility Tree—interpreted by the OS and screen readers—to the LLM as context.&lt;/p&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;[ Web Page / Raw DOM Tree ]&#10; │&#10; ▼&#10;[ Accessibility Tree Engine (Playwright) ]&#10; ├── Semantic role extraction (button, textbox, link)&#10; ├── State &amp;amp;amp; attribute analysis (aria-*, expanded, checked)&#10; └── Issuance of deterministic Element References&#10; │&#10; ▼&#10;[ LLM Context Window (Structured text representation) ]&#10;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This architecture provides the following advantages:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;b&gt;Elimination of Selector Breakage&lt;/b&gt;: Identifies target elements based on their roles and Accessible Names, preventing script failures caused by CSS class name changes or DOM hierarchy modifications.&lt;/li&gt;&#10;&lt;li&gt;&lt;b&gt;Token Efficiency Optimization&lt;/b&gt;: Reduces context window consumption by transmitting a pruned tree containing only semantic information, rather than whole-screen pixel data or extensive HTML strings to the LLM.&lt;/li&gt;&#10;&lt;li&gt;&lt;b&gt;Deterministic Operations&lt;/b&gt;: A unique reference index (Element Reference) is assigned to each element, explicitly determining the target for clicks and inputs.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;h2 id="mcp-server-architecture-and-client-configuration"&gt;MCP Server Architecture and Client Configuration&#10;&lt;/h2&gt;&lt;h3 id="prerequisites"&gt;Prerequisites&#10;&lt;/h3&gt;&lt;ul&gt;&#10;&lt;li&gt;Node.js: 20.x or higher recommended&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h3 id="client-configuration-mcpservers"&gt;Client Configuration (mcpServers)&#10;&lt;/h3&gt;&lt;p&gt;Add the following JSON block to the configuration files of MCP clients such as Claude Desktop, Cursor, Cline, or VS Code (e.g., &lt;code&gt;claude_desktop_config.json&lt;/code&gt; or the Cursor configuration pane).&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-json" data-lang="json"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;#34;mcpServers&amp;#34;&lt;/span&gt;: {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;#34;playwright&amp;#34;&lt;/span&gt;: {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;#34;command&amp;#34;&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#34;npx&amp;#34;&lt;/span&gt;,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;#34;args&amp;#34;&lt;/span&gt;: [&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;@playwright/mcp@latest&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="execution-loop-and-internal-state-machine"&gt;Execution Loop and Internal State Machine&#10;&lt;/h2&gt;&lt;p&gt;Playwright MCP operates not as a single static command execution, but as a closed-loop state machine between the AI agent and the browser.&lt;/p&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;┌────────────────────────────────────────────────────────┐&#10;│ AI Agent │&#10;└───────────────────────────┬────────────────────────────┘&#10; │ (1) Start session / Navigation instruction&#10; ▼&#10;┌────────────────────────────────────────────────────────┐&#10;│ Browser Process (Playwright) │&#10;└───────────────────────────┬────────────────────────────┘&#10; │ (2) Page load complete / Generate A11y snapshot&#10; ▼&#10;┌────────────────────────────────────────────────────────┐&#10;│ Accessibility Snapshot Generator │&#10;└───────────────────────────┬────────────────────────────┘&#10; │ (3) Return semantic tree&#10; ▼&#10;┌────────────────────────────────────────────────────────┐&#10;│ AI Agent │&#10;│ (Identify element references &amp;amp;amp; infer execution actions) │&#10;└───────────────────────────┬────────────────────────────┘&#10; │ (4) Send operation command (Click, Fill, etc.)&#10; ▼&#10;┌────────────────────────────────────────────────────────┐&#10;│ Playwright MCP Execution Pipeline │&#10;└───────────────────────────┬────────────────────────────┘&#10; │ (5) Recapture updated DOM state&#10; ▼&#10; [ Continue to next step ]&#10;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="primary-tool-interfaces-provided"&gt;Primary Tool Interfaces Provided&#10;&lt;/h2&gt;&lt;p&gt;The primary tool interfaces exposed by Playwright MCP to clients are as follows:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;browser_navigate&lt;/code&gt;: Controls navigation to URLs, back/forward history traversal, and reloading.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;A11y Tree Target Resolution&lt;/code&gt;: Dispatches Click events to elements identified on a role basis.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;Semantic Form Handlers&lt;/code&gt;: Handles string input into form fields, checkbox toggles, and dropdown selections.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;Screenshot Engine&lt;/code&gt;: Extracts screen captures on a full-page or per-element basis.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;Storage State Persistence&lt;/code&gt;: Serializes session information (Cookies, &lt;code&gt;localStorage&lt;/code&gt;) to enable authentication bypass and reuse across test scenarios.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;browser_run_code_unsafe&lt;/code&gt;: Directly executes arbitrary Playwright scripts from the LLM (*Executes outside the sandbox; use only in isolated, trusted environments).&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="troubleshooting"&gt;Troubleshooting&#10;&lt;/h2&gt;&lt;h3 id="1-missing-browser-binary-error"&gt;1. Missing Browser Binary Error&#10;&lt;/h3&gt;&lt;p&gt;When running &lt;code&gt;npx @playwright/mcp@latest&lt;/code&gt;, if browser binaries such as Chromium are missing in the host environment, an error occurs immediately upon process startup.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Error: browserType.launch: Executable doesn&amp;#39;t exist at /root/.cache/ms-playwright/chromium-1155/chrome-linux/chrome&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;╔═════════════════════════════════════════════════════════════════════════╗&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;║ Looks like Playwright was just installed or updated. ║&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;║ Please run the following command to download new browsers: ║&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;║ ║&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;║ npx playwright install ║&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;╚═════════════════════════════════════════════════════════════════════════╝&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;b&gt;Resolution Steps:&lt;/b&gt; Pre-install browser dependencies within the host environment or container.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;npx playwright install --with-deps chromium&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="2-missing-system-dependencies-in-headless-environments"&gt;2. Missing System Dependencies in Headless Environments&#10;&lt;/h3&gt;&lt;p&gt;When running in a Linux server environment, missing shared libraries required for GUI rendering will cause a &lt;code&gt;host system dependencies&lt;/code&gt; error. In this case, installing additional packages suited to the distribution is required.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo npx playwright install-deps&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="3-verifying-deployment-verification-logs"&gt;3. Verifying Deployment Verification Logs&#10;&lt;/h3&gt;&lt;p&gt;Verify that the MCP process is correctly resident and in a state to accept the JSON-RPC protocol via standard output and the process list.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$ ps aux | grep playwright&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;node /usr/local/bin/npx @playwright/mcp@latest&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;/root/.cache/ms-playwright/chromium-1155/chrome-linux/chrome --disable-field-trial-config --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --headless=new --remote-debugging-pipe&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="configuration-notes"&gt;Configuration Notes&#10;&lt;/h2&gt;&lt;p&gt;Playwright MCP is an approach that resolves the challenges of both traditional &amp;ldquo;code-based procedural testing&amp;rdquo; and &amp;ldquo;ambiguous UI manipulation via visual models.&amp;rdquo; By utilizing the Accessibility Tree as a standard interface, a browser automation pipeline based on robust semantic analysis can be constructed. For integration into production environments, properly designing the serialization management of authentication states and execution permission controls is essential.&lt;/p&gt;&#10;</description></item></channel></rss>