Setting up the Claude Code Chrome extension for browser automation
Claude Code can control your Chrome browser. Navigate pages, click buttons, fill forms, read content, take screenshots. It's useful for testing web apps, debugging with console logs, or automating repetitive browser tasks without leaving the terminal.
I've tried other browser MCPs (Playwright MCP, Puppeteer, etc.) and the Chrome extension is noticeably faster. It connects to your actual browser session, so it shares your login state. No spinning up headless browsers, no separate auth flows. If you're logged into Gmail, Notion, or your staging environment, Claude Code can interact with those pages immediately.
The official docs cover everything in detail. This post is the short version.
What you need
- Google Chrome or Microsoft Edge
- The Claude in Chrome extension (v1.0.36+) from the Chrome Web Store
- Claude Code v2.0.73 or higher
- A direct Anthropic plan (Pro, Max, Teams, or Enterprise). This doesn't work through Bedrock or Vertex
Setup
Install the extension from the Chrome Web Store. That's the main step. Claude Code handles the rest.
Then start Claude Code with the --chrome flag.
claude --chromeIf you're already in a session, type /chrome to connect without restarting.
The first time you do this, Claude Code installs a native messaging host config file that Chrome reads on startup. If the extension isn't detected on your first attempt, restart Chrome and try again.
If you want Chrome enabled by default so you don't have to pass --chrome every time, run /chrome and select "Enabled by default." One thing to note though. Enabling it by default increases context usage since the browser tools are always loaded. I just use the flag when I need it.
Using it
Once connected, just tell Claude what to do in the browser. It opens new tabs for browser tasks and you can watch everything happen in real time.
Open localhost:3000, try submitting the form with invalid data,
and check if the error messages appear correctly.It can also read console output, which is great for debugging.
Open the dashboard and check the console for any errors on page load.For autonomous sessions where Claude Code runs unattended, combine it with --dangerously-skip-permissions so browser actions don't require manual approval.
claude --chrome --dangerously-skip-permissionsIf you're typing that often, a shell alias saves a lot of keystrokes. I use cldc for the whole thing.
If something breaks
The connection can drop during long sessions when the Chrome extension's service worker goes idle. Run /chrome and select "Reconnect extension" to fix it.
If a JavaScript alert or confirm dialog pops up on the page, it blocks all browser events. Claude Code can't dismiss it. You have to close it manually, then tell Claude to continue.
For the full troubleshooting guide, check the official docs.