Jean Galea

AI, Investing, Health, and Building Businesses

  • Start Here
  • AI & Tech
    • AI
    • Tech
    • Modern Web Stack
    • Business
  • Investing
    • Investing Basics
    • Crypto
    • Stocks
    • P2P Lending
    • Real Estate
    • Calculators
    • Dividends
    • FIRE & Early Retirement
    • European Investing Hub
  • Life
    • Essays
    • Barcelona
    • Padel
    • Health & Fitness
    • Hobbies
    • Family
  • About
    • My Story
    • Projects
    • AI Consultancy
    • Plugins
    • Speaking
  • Blog
  • Community
    • Good Life Collective
    • Daily Driver AI
  • Search

Five Ways Claude Code Can Use a Browser

Last updated: November 27, 20261 Comment

MacBook Pro showing colorful code in PhpStorm

Which of agent-browser, Claude in Chrome, Playwright CLI, Playwright MCP and Chrome DevTools MCP to use depends on two things: whether the task needs your logged-in session, and whether it runs unattended.

Default to agent-browser attached to your own Chrome. It handles logged-in and logged-out work, short checks and long flows. The other four each cover a narrow job.

agent-browser

Vercel Labs makes this CLI. Install it with npm i -g agent-browser && agent-browser install.

Its snapshots are compact accessibility trees with element refs like @e1 and @e2 instead of full DOM dumps. A long session stays cheap on context, and Claude keeps its budget for reasoning.

It can reuse your login state in four ways:

  • --auto-connect attaches to a Chrome that’s already running and reuses its sessions.
  • --profile <name> reuses the logins of a Chrome profile.
  • --state <file> loads saved cookies and storage. Save one with agent-browser --auto-connect state save ./auth.json.
  • --cdp <port|url> connects to any browser that exposes the DevTools protocol, for example a Chrome started with --remote-debugging-port=9222.

To make your running Chrome the default for every call, add this to your shell profile:

export AGENT_BROWSER_AUTO_CONNECT=1

Use auto-connect when the task needs the session already open in your window. Use a profile or a saved state file when a run should leave that window alone, and --no-auto-connect for a clean headless browser.

Running in your real Chrome also brings that profile’s cookies and fingerprint. Pages that stop a bare HTTP client, like Cloudflare-protected docs, open the way they do when you browse them yourself.

Claude in Chrome

It’s a Chrome extension that drives the browser you have open. It works largely from screenshots, which get heavy on context once a session runs long.

The extension pairs with one Claude account. If you run Claude Code under more than one account, it only works on the one it’s paired with, while agent-browser works on all of them.

Playwright CLI

This is Microsoft’s command-line Playwright for coding agents. Install it with npm install -g @playwright/cli@latest, then run playwright-cli install --skills so Claude Code learns the commands.

It keeps large tool schemas and accessibility trees out of the model’s context. Named sessions let you bind a browser to one agent: PLAYWRIGHT_CLI_SESSION=name claude.

Use it for unattended work that wants a fresh headless browser with no login state, like an overnight scrape of public pricing pages.

Playwright MCP

Add it with claude mcp add playwright npx @playwright/mcp@latest. It’s the pick for two jobs: generating durable Playwright test files you commit and run later, and test runs in WebKit and Firefox.

Chrome DevTools MCP

Performance traces, network inspection and console debugging, in Chrome only. Google’s Chrome team maintains it. In Claude Code, install it with /plugin marketplace add ChromeDevTools/chrome-devtools-mcp, then /plugin install chrome-devtools-mcp@chrome-devtools-plugins. When a page is slow, ask Claude Code for a performance trace and read what comes back.

Which One to Use

Question Tool
Should it run unattended in a fresh, logged-out browser? Playwright CLI
Does it need a durable test file, or WebKit and Firefox? Playwright MCP
Is the question why a page is slow, or what the network or console did? Chrome DevTools MCP
Anything else, logged in or not, short or twenty steps deep agent-browser on your Chrome

With the auto-connect variable set, every agent-browser call lands in your real Chrome without a flag.

Related

The Building Blocks of Claude Code: A Practical Guide for Founders
Run Claude Code on a Hetzner Box and Drive It From Your Laptop and Phone
A Collection of Thoughts and Life Lessons
Claude Code working through an issue queue overnight in a terminal
How to Run Claude Code While You Sleep
Bundled network cables connecting servers in a data center, illustrating cloud backup infrastructure
How to Back Up Your Claude Code Setup to the Cloud
Network of interconnected nodes representing web data extraction
5 Ways to Get Data From Any Website (Without Writing Code)

Filed under: AI

About Jean Galea

I build things on the internet and write about AI, investing, health, and how to live well. Founder of AgentVania and the Good Life Collective.

Comments

  1. Amy says

    November 18, 2026 at 7:11 am

    I’ve been reading your posts here, and this one pairs well with why you built your own AI layer instead of installing OpenClaw: you want to see the moving pieces, including which browser tool is in use. The LinkedIn composer example is a good warning. The rule is clear — Claude in Chrome for logged-in work, agent-browser for long sessions, Playwright for the rest. We’re building Tabbit (tabbit.ai), a free AI browser with a CLI that lets coding agents use your signed-in browser, aimed at that same logged-in case.

    Reply

Leave a Reply Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords or links in the name field.

Jean Galea

Founder | AI builder | Dad of three | Athlete

Follow @jeangalea

  • My Padel Journey
  • Affiliate Disclaimer
  • Cookies
  • Contact

Copyright © 2006 - 2026