How to Let Claude Code Control Chrome: Skip Login, Auto‑Fill Backend Data, and Solve Captchas Visually
This article walks through using Claude Code with Microsoft Playwright MCP to hijack the local Chrome browser, covering version requirements, the two connection modes, token configuration, real‑world tests for auto‑login, captcha solving, form queries, navigation pitfalls, security risks, and practical recommendations.
1. Official Claude‑in‑Chrome Extension – Prerequisites
Anthropic provides a Chrome extension that lets Claude Code open a new tab in the real Chrome instance using claude --chrome or /chrome. It works only with an official Pro/Max/Team/Enterprise subscription; API keys or third‑party providers such as Bedrock are not supported.
Supported versions: Claude Code ≥ 2.1.216, Chrome / Edge, extension ≥ 1.0.36.
Authentication must be a direct official subscription; other tokens are ignored.
Even with a valid subscription, the beta feature may fail to connect.
2. Playwright MCP – Two Connection Modes
Playwright MCP can be launched with a single command: npx @playwright/mcp@latest By default it creates a brand‑new isolated browser profile, which does not share the existing Chrome login state. To reuse the real Chrome profile, the --extension mode is required.
Install the Playwright Extension from the Chrome Web Store.
Add the --extension flag to the MCP command.
Configure MCP with a JSON block that includes the --extension argument and the extension token.
Restart the Claude Code session so MCP loads the new configuration.
If the token is missing, the extension shows “No clients are currently connected”. The token is displayed in the extension popup as PLAYWRIGHT_MCP_EXTENSION_TOKEN and must be copied into the MCP env section.
3. Test 1 – Automatic Login and Captcha Solving
Using the public JeecgBoot demo (account jeecg/jeecg#123456), the --extension mode reuses the saved Chrome password, so the login fields are auto‑filled. The captcha image, invisible to Claude’s DOM snapshot, is captured, OCR‑read, and the correct text is entered, resulting in a successful login for both numeric and alphanumeric captchas.
Note: the demo’s captcha is simple; more sophisticated challenges may fail.
4. Test 2 – Form Query and Result Verification
After logging in, the “System Users” list can be filtered by account, name, and gender. Using Claude’s snapshot, the script calls fill_form to populate the account field and clicks “Search”. The resulting table contains five rows, with a single record matching the filter (admin). The same approach works for the “Process Designer” list (45 rows, 10 per page), allowing full structured extraction without manual navigation.
This pattern—structured snapshot → fill → verify—is a high‑frequency, low‑error scenario for agents.
5. Test 3 – Navigation Pitfalls
The top‑level “More” menu (icon ...) expands to items without accessible names. Clicking “System Management” reports success but actually opens “Process Designer” because the click lands on a neighboring unnamed menu item. No error is raised, so visual confirmation is required.
✅ Verify the landing page (title or screenshot) after each click; tool‑reported success is insufficient.
✅ For icon‑only items, use screenshots to locate the element rather than guessing coordinates.
✅ Confirm “New” or “Add” actions before execution to avoid creating test data.
6. Common Pitfalls and Countermeasures
--extensionconfigured but not connected → extension shows “No clients are currently connected”; copy the token from the popup into the MCP env.
Configuration changes not taking effect → restart the Claude Code session because MCP loads only at startup.
Click reports success but lands on the wrong page → always capture a screenshot or read the page title after the click.
Menu items lack accessible names → rely on visual cues and re‑capture screenshots when guessing.
7. Security Considerations
When using --extension, the agent gains full access to the browser’s login state, including email, banking, and internal systems.
Disconnect the extension when not in use.
Avoid navigating to unrelated sensitive sites during tasks; require explicit confirmation for privileged actions.
Treat PLAYWRIGHT_MCP_EXTENSION_TOKEN as a secret; exclude it from version control via .gitignore.
A reported vulnerability (Manifold Security, May 2026) showed that a malicious extension could forge clicks in the same browser, though the default “ask before acting” mode still prompts for confirmation. Silent execution is only possible when the “no‑confirm” mode is enabled, so review permissions carefully before granting access.
8. Final Thoughts
Letting Claude Code control the real Chrome can automate backend data retrieval, form verification, and screenshot capture without manual browsing. The only non‑trivial step is copying the extension token; the rest follows the documented commands.
Related Links
Playwright MCP repository: https://github.com/microsoft/playwright-mcp
Playwright Extension (Chrome Web Store): https://chromewebstore.google.com/detail/playwright-extension/mmlmfjhmonkocbjadbfplnigmagldckm
Claude Code documentation: https://code.claude.com/docs/en/chrome
Security research (The Hacker News): https://thehackernews.com/2026/07/claude-for-chrome-flaw-lets-other.html
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Tech Ocean
Focused on AI programming, sharing ready-to-use development efficiency solutions.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
