# Claude Code in Chrome: Browser Automation From the CLI

> Chrome integration shares your browser's logged-in state, which is what makes it useful and what you have to reason about. Here is the permission model in full.

URL: https://www.matthewswong.com/en/blog/claude-code-chrome-browser-automation/

- Author: Matthews Wong (https://www.matthewswong.com/en/about/)
- Published: 2026-08-27
- Updated: 2026-08-27
- Category: AI

> **Key takeaway:** Claude Code connects to the Claude in Chrome extension to drive a real browser from the terminal. Claude opens tabs in a visible Chrome window and shares your browser's login state, so it can reach any site you are already signed into. It pauses and hands back to you at login pages and CAPTCHAs.

The first time I asked Claude to check a form on my local server, it opened a tab, filled the form with invalid data, read the validation errors off the page, and told me which of the three messages was wrong. Then I asked it to check something in a web app I was signed into, and it just did — because it was my browser, with my session, not a headless one it had to authenticate separately.

That is the whole design and the whole thing to think about. This post covers what sharing browser state actually means, how to connect and what enabling it by default costs you in context, the plan-mode split between reading and acting, the file-upload restrictions, the authentication configurations that silently disable the feature, and the two failures you will hit in a long session.

## It is your browser, with your sessions

Claude opens new tabs for browser tasks in a visible Chrome window, in real time, and shares your browser's login state. That is why it can draft in a Google Doc, read your Notion, or click through an internal dashboard with no API connector and no credentials configured anywhere. When it hits a login page or a CAPTCHA it stops and asks you to handle that part manually.

The tabs it opens are collected into a Chrome tab group tied to your session, and what happens to that group when the session ends depends on how it ends. Clearing the conversation closes the group including open pages, unless work that survives the clear is still running. Switching sessions, exiting, or clearing while such work runs closes the group only if it holds nothing but empty new tabs — so pages you might still be reading stay open.

> Recording a GIF captures everything visible in the browser, including account details on a logged-in page. That is exactly what you want for a demo of your own app and exactly what you do not want to paste into a public issue. Review a recording before it leaves your team, every time, because the thing that makes this feature convenient is the same thing that puts your session in the frame.

## Connecting, and what always-on costs

One flag starts a session with the browser attached, and a command manages everything else — status, permissions, reconnecting, and choosing which browser when more than one is connected. Site-level permissions are inherited from the Chrome extension rather than configured in Claude Code, so restricting which sites Claude may browse, click and type on happens in the extension's own settings.

## Plan mode splits by side effect

The plan-mode behaviour here is more carefully drawn than most people notice, and it is a good model for how a read-only mode should treat a tool that can do both. Reading a page costs nothing and prompts for nothing; changing anything prompts. The interesting part is the exceptions, where a call that is normally read-only becomes state-changing because of one input flag.

> When asking Claude to read console output, tell it what pattern to look for rather than asking for everything. Console logs are verbose, and the difference between check the console for errors when the page loads and show me the console is the difference between a useful answer and several thousand tokens of noise you then have to read yourself.

## What it is genuinely good for

The value is not browser automation on its own — there are better tools for that if automation is all you want. It is chaining a browser action to a coding task in one workflow, without switching context or writing a test harness for something you are going to do once.

| Task | Why it beats the alternative |
| --- | --- |
| Test a change on localhost | Claude fixes the code that caused the console error it just read, in the same turn |
| Verify a UI against a design | Building from a mock and checking the result are usually two people and two days apart |
| Act in an app you are logged into | No API connector, no OAuth setup, no credentials to store anywhere |
| Extract structured data from a page | A scraper you would write, run once, and never maintain |

## File uploads, and their three limits

Claude can attach files from your machine to upload fields on a page — it reads the file and sends the contents to the browser, so this works in remote sessions too. Three restrictions apply, and the third is the one that catches people:

- Permissions carry over: Claude can upload a file only when the session is allowed to read it, so a read deny rule blocks uploading it too.
- A single upload can include up to 10 MB of files in total.
- Files with multiple hard links are refused, which is common inside package-manager stores. Copy the file and upload the copy.

> Screenshots can be saved to disk rather than only shown, and Claude reports the path it wrote. That turns the browser into a way of producing artefacts you keep — a before-and-after pair for a pull request, a captured error state to attach to a ticket — rather than only a thing Claude looks at and describes to you.

## Where it is silently unavailable

This is the section worth reading before you conclude something is broken, because none of these produce an error that explains itself. The common thread is authentication: the browser extension cannot authenticate with an API key or a long-lived token, so a session using either keeps the integration off even when you explicitly ask for it.

## The two failures you will actually hit

Setting aside first-install issues, long sessions fail in a small number of predictable ways:

- The extension's service worker goes idle during an extended session and the connection breaks. Reconnect from the chrome command; nothing is lost.
- A JavaScript dialog — an alert, confirm or prompt — blocks the page and prevents Claude from receiving commands at all. Dismiss it manually and tell Claude to continue.
- On the very first enable, Claude Code installs a native messaging host configuration file that Chrome reads at startup, so if the extension is not detected on the first attempt, restart Chrome.
- Claude Code opens the connect tab only on that first install — it does not reopen it when a later session rewrites the configuration, such as after switching builds or config directories.

If the connection is still down after you reconnect or dismiss the dialog, Tabbit's walkthrough of the

Claude browser extension not connected error

shows how to tell whether the break is the session bridge, the account and organization, or the browser profile.

Treat this as a browser that a colleague is driving while you watch, because that is functionally what it is: your session, your logins, your tabs, in a window you can see. That framing gets the two important habits right on its own — you review a recording before sharing it, and you leave it off by default rather than always loaded, turning it on for the task that needs it. Both are cheap, and both matter more the more useful you find it.

## Sources & further reading

- Claude Code docs — Use Claude Code with Chrome
- Claude Code docs — Computer use
- Claude Code docs — Browser automation in VS Code
- Claude Code docs — Permission modes and plan mode
- Claude Code docs — Managed MCP configuration
- Claude Code docs — CLI reference
- Claude Code docs — Data and privacy
- Anthropic support — Getting started with Claude in Chrome

## Source links

- https://code.claude.com/docs/en/chrome
- https://code.claude.com/docs/en/computer-use
- https://code.claude.com/docs/en/vs-code
- https://code.claude.com/docs/en/permission-modes
- https://code.claude.com/docs/en/managed-mcp
- https://code.claude.com/docs/en/cli-reference
- https://code.claude.com/docs/en/data-usage
- https://support.claude.com/en/articles/12012173-getting-started-with-claude-in-chrome

## FAQ

### How do I connect Claude Code to Chrome?

Install the Claude in Chrome extension version 1.0.36 or later, then start Claude Code with the --chrome flag. Run /chrome at any time to check status, manage permissions, reconnect, or pick which browser to use. Selecting Enabled by default removes the need for the flag, at the cost of always loading the browser tools into context.

### Does Claude Code use my existing browser logins?

Yes. Claude opens tabs in a visible Chrome window and shares your browser's login state, so it can act in any site you are already signed into without API connectors or stored credentials. When it reaches a login page or CAPTCHA it pauses and asks you to handle that part manually.

### Why is Chrome integration disabled in my Claude Code session?

Usually authentication. The browser extension cannot authenticate with an API key or a long-lived token from claude setup-token, so those sessions keep the integration off even when you pass --chrome. It is also unavailable through Bedrock, Google Cloud's Agent Platform and Microsoft Foundry, and unsupported under WSL.

### What can Claude do in Chrome during plan mode?

Read-only calls run without a prompt: reading the page, getting page text, finding elements, reading console messages and network requests, and taking a screenshot. Clicks, typing, navigation, tab management and GIF recording all prompt. An otherwise read-only call also prompts when it sets a state-changing flag such as save_to_disk on a screenshot.

### Why did Claude Code stop responding to browser commands?

Two common causes. The Chrome extension's service worker can go idle during a long session, which breaks the connection — run /chrome and reconnect. Or a JavaScript dialog such as an alert or confirm is blocking the page, which prevents Claude receiving commands at all; dismiss it manually and tell Claude to continue.

---

- HTML version: https://www.matthewswong.com/en/blog/claude-code-chrome-browser-automation/
- Bahasa Indonesia: https://www.matthewswong.com/id/blog/claude-code-chrome-browser-automation/
- Site index for agents: https://www.matthewswong.com/llms.txt
- Sitemap: https://www.matthewswong.com/sitemap.xml
- API description (OpenAPI): https://www.matthewswong.com/openapi.json
