How can my coding agent check its own change in a browser?

Let your coding agent check its own change in a browser

An agent that can’t see the page guesses whether its change works. Give it a browser and it can open the page, click through the change, read the console and fix what it finds. Here are three ways to add one to an agent in your terminal, the browsers built into the Claude and ChatGPT apps, and then Trek.

What the agent needs

A coding agent edits files and runs commands. To check a page it needs three more things: a way to open a URL, a way to read what is on the page, and a way to act on it, such as a click or a typed value. Each option below adds those as tools the agent can call.

Start your dev server first, or tell the agent the command, and give it the address.

Playwright MCP

Microsoft’s Playwright MCP server reads a page as an accessibility snapshot, a text outline of what is on it, so the model doesn’t need to look at screenshots. It needs Node.js 20 or newer.

# Claude Code
claude mcp add playwright npx @playwright/mcp@latest

# Codex
codex mcp add playwright npx "@playwright/mcp@latest"

It opens a visible browser unless you pass --headless. It gives tools such as browser_navigate, browser_click, browser_type, browser_snapshot, browser_console_messages and browser_take_screenshot.

Its README also suggests the separate Playwright CLI with skills for coding agents, because a command uses fewer tokens than MCP tool schemas and page snapshots.

Chrome DevTools MCP

Google’s Chrome DevTools MCP drives a live Chrome and adds what DevTools has: console messages with source-mapped stack traces, network requests, performance traces and Lighthouse audits. It supports Chrome and Chrome for Testing only.

# Claude Code
claude mcp add chrome-devtools --scope user npx chrome-devtools-mcp@latest

# Codex
codex mcp add chrome-devtools -- npx chrome-devtools-mcp@latest

These lines come from its client setup page. --scope user adds the server for every project on your computer, not only the one you’re in. It sends usage statistics to Google unless you add --no-usage-statistics. The same package has a chrome-devtools command line and skills, and its README offers a plugin for Claude Code and Codex that installs the server with them.

Claude in Chrome

Claude Code can drive your own Chrome or Edge, or another Chromium browser such as Brave, Arc, Vivaldi or Opera, through Anthropic’s Claude in Chrome extension. Install the extension, then start Claude Code with the flag.

claude --chrome

It needs a direct Anthropic plan and a /login sign-in. With an API key it stays off, and it doesn’t work in WSL. Actions run in a visible browser window, signed in as you, so it can reach pages behind your logins and act as you on them.

Browsers built into the desktop apps

Anthropic’s Claude desktop app has a Browser pane in its Code tab. In a local session, Claude can start your dev server, open it there and check its own change. It takes screenshots, inspects the DOM, clicks, fills forms and fixes the issues it finds. Claude writes the server’s settings to .claude/launch.json, which you edit if your app needs a custom dev command.

OpenAI’s ChatGPT desktop app, where Codex lives, has a built-in browser too. It gives you and the agent a shared view of websites and local web apps inside a chat. With Computer Use, Codex can open pages, click, type, take screenshots and check the result of its work in the page. Mention @Browser in your task to point it there. The browser isn’t in the Codex CLI or the IDE extension, so from a terminal you still need one of the servers above.

Ask it to check

Having a browser doesn’t mean the agent will use it. Say so in the task, or once in AGENTS.md:

After a change to the UI, start the dev server, open the page you changed,
try the change the way a user would, and read the browser console.
Fix any error you see before you say you're done.

Two agents, two browsers

Playwright MCP keeps one browser profile per project. Chrome DevTools MCP keeps one for every project, in ~/.cache/chrome-devtools-mcp/chrome-profile. Only one browser can use a profile at a time. So if two agents work on one project, or both use Chrome DevTools MCP, start the second one’s server with --isolated, which gives it a temporary profile. If they work in separate worktrees, give each dev server its own port too.

With Trek

Trek has a browser built in, in the right panel, and gives every agent it runs the tools to use it: Claude Code, Codex, OpenCode, Droid, Cursor, GitHub Copilot and other ACP agents, and API and local models. There is nothing to install or add to each agent’s config.

  • The agent opens your dev server’s page beside the chat, reads it as an outline, clicks, types and takes screenshots, and you watch it do so.
  • Pick an element for the chat lets you click the part that looks wrong and send it with your message.
  • Typing a password, running a script in the page or opening a file on your computer asks you first, unless the thread has Full access.
  • Stop, on the strip above the page, takes the browser back for the rest of the turn.

Trek’s Browser uses the system’s web view: WebKit on a Mac, WebView2 on Windows and WebKitGTK on Linux. For a check that needs Chrome itself, an MCP server you added to Claude Code, such as Chrome DevTools MCP, still loads when Trek runs Claude Code. The Browser in Trek lists its tools and what each hand-holding level asks.

Questions

Which should I pick, Playwright MCP or Chrome DevTools MCP?

Playwright MCP works with Chrome, Firefox, WebKit and Edge and reads pages as accessibility snapshots. Chrome DevTools MCP drives Chrome only and adds performance traces, Lighthouse audits and memory tools. For checking that a change works, either will do.

Does the Claude app’s Browser pane work in an SSH session?

No. In an SSH session Claude doesn’t get the Browser pane’s tools, so it can’t open your app there or check its changes. To look at the app yourself, forward its port to your computer.

Do the desktop apps’ browsers use my sign-ins?

No. The Claude app’s Browser pane uses a clean profile with none of your saved logins or history. The ChatGPT app’s browser keeps a profile separate from your regular browser. To work as you in your own browser, each maker offers an extension instead, Claude in Chrome and ChatGPT’s browser extension.

Sources

Every agent. One trail.

Free and open source, for macOS, Windows and Linux (a preview). No Trek account.

Download TrekWaiting on you

Your system
Download for macOS

Apple silicon · macOS 13 or later Other chip: Intel

The first time you open it, go to System Settings, Privacy & Security and click Open Anyway.

Download for Windows

Installer, x64 · Windows 11 Other file: Zip, no installer

The first time, SmartScreen asks. Click More info, then Run anyway.

Download for Linux

x86_64 AppImage · Preview Other files: .debArm AppImageArm .deb

Runs on Ubuntu 22.04, Debian 12, Fedora 36 or later. Make the AppImage executable, then run it.

  • Homebrew (macOS)brew install --cask dokyit/trek/trek
  • npmnpx trek-desktop
  • Shell (macOS, Linux)curl -fsSL https://trekdesktop.com/install.sh | sh
  • PowerShell (Windows)irm https://trekdesktop.com/install.ps1 | iex

Every release, on GitHub

Trek is a desktop app. Open this page on your computer to get it.