Playwright Plugin for Claude Code: Test Your Web App in a Real Browser

Playwright Plugin for Claude Code: Test Your Web App in a Real Browser

The Playwright Claude Code plugin gives Claude a real browser it can open, click and read, so it can test your web app instead of guessing how it behaves. We loaded it in a throwaway folder, pointed it at a small coffee order page with a hidden bug, and let Claude find and fix the problem. This guide shows what the plugin is, how to set it up, what happened step by step, and where it falls short.

This guide is part of our Claude Code tutorials. Find more add-ons in our Skills Directory.

Tested with Claude Code v2.1.318 on November 5, 2026.

The plugin came from Anthropic’s public plugins repository (commit fa4eb54, dated November 3, 2026) and it started version 0.0.84 of Microsoft’s @playwright/mcp package. We loaded it with --plugin-dir and --setting-sources project, so nothing was installed into the normal Claude Code setup. Everything below is one demo on one tiny page, so treat it as one honest example and not a benchmark.

Quick Summary

QuestionAnswer
What is it?An official-marketplace plugin that adds Microsoft’s Playwright browser tools to Claude Code
Install command/plugin install playwright@claude-plugins-official
What it addsOne MCP server with 25 tools, such as navigate, fill form, click, take a screenshot and read console messages
NeedsNode.js, because the plugin starts the server with npx
What we ranTwo short prompts: test an order form and read the wrong total, then fix the bug and re-test
What we did not runFirefox, WebKit, mobile emulation, file uploads and the unsafe “Run Playwright code” tool

What Is the Playwright Plugin for Claude Code?

Playwright is a well-known tool that controls a web browser from code. The plugin wraps a version of it that speaks MCP, the Model Context Protocol, so Claude can call browser actions the same way it calls any other tool. If MCP is new to you, our guide to MCP servers explains the idea.

The plugin itself is tiny. Its folder holds a manifest that names Microsoft as the author and a one-file .mcp.json. That file says to run npx @playwright/mcp@latest, and that is the entire plugin.

Anthropic’s docs describe a plugin as a bundle of skills, agents, hooks and MCP servers that Claude Code loads as one unit. They also say that installing a plugin adds those parts to your machine. Our skills versus plugins guide covers the differences if you want more detail.

Claude Code docs plugins overview with the sentence listing skills, agents, hooks and MCP servers highlighted in red
The official docs list MCP servers as one of the things a plugin can bundle
Flow diagram: your prompt, plugin starts the Playwright server, headless browser opens your page, you approve each action, Claude reports what it saw
The five steps between your prompt and Claude’s report

How to Install the Playwright Plugin

Option 1: The official marketplace

The plugin is listed in Anthropic’s official marketplace as playwright. To add it to your own setup, run this inside Claude Code and follow the prompts.

/plugin install playwright@claude-plugins-official

We did not run this command, because we did not want to change the normal setup. Our plugin install guide and the marketplace explainer cover the install screens in detail. The discover plugins page is the source for the commands.

Claude Code docs install and manage plugins page with the sentence about installing skills, agents, hooks and MCP servers highlighted
Installing a plugin also adds its MCP server to your machine

Option 2: Try it in a throwaway folder

This is what we did. We cloned the plugins repository into a sandbox folder and started Claude Code with the plugin folder passed to --plugin-dir. The command looked like this, with the path shortened.

claude --setting-sources project --plugin-dir ./claude-plugins-public/external_plugins/playwright

The plugin loads for that session only. When you close it, your normal setup is exactly as it was.

Two things to know before the first run

First, the server needs a browser. By default it opens a visible window, and the server’s own help text says it runs headed unless you pass --headless. The help lists chrome, firefox, webkit and msedge as browser choices.

We did not want a window popping up, and we did not want to touch the real Chrome. So we installed Playwright’s own Chromium into the sandbox and set the environment variable PLAYWRIGHT_MCP_HEADLESS=true for the session. The run worked without any visible window, and we did not need to edit the plugin.

Second, the first start needs internet, because npx downloads the package. After that, it is cached.

Check That the Plugin Is Connected

Once Claude Code was open, we typed /mcp. The list showed a line called plugin:playwright:playwright with a green check and 25 tools.

Claude Code mcp screen listing plugin:playwright:playwright connected with 25 tools
The /mcp screen shows the plugin’s server as connected with 25 tools

Opening that entry showed the status as connected and a “View tools” option. The tool list included 19 names on the first screen, and the screen said there were 6 more that we did not scroll to.

Tool list for the Playwright server including Navigate to a URL, Fill form and Take a screenshot, each outlined in red
Three of the tools we cared about: navigate, fill form and take a screenshot
Tool nameWhat it doesMarked as
Navigate to a URLOpens a pagedestructive, open-world
Fill formTypes into form fieldsdestructive, open-world
Take a screenshotSaves an image of the pageread-only, open-world
Page snapshotReads the page as textread-only, open-world
Get console messagesLists console logs and errorsread-only, open-world
List network requestsShows requests the page maderead-only, open-world
Run Playwright code (unsafe)Runs code you or Claude writedestructive, open-world

Notice the words open-world next to every tool. That label means the tools can reach beyond your own machine, which matters for safety, and we come back to it later.

The Test: Find a Bug With the Browser

The demo page

We wrote a tiny page for a made-up shop called Bean There Coffee. It has a quantity box, a size menu, a tip box and a Place order button. Two files make it up: index.html and app.js.

We planted one bug on purpose. The script reads the tip box as text and then adds it to a number, so the page joins the two instead of adding them.

var tip = document.getElementById('tip').value;
var total = qty * price + tip;

Prompt 1: test the order

We served the folder on a local address and sent this prompt to Claude.

Use the Playwright browser tools to open http://localhost:8765, order 2 large coffees with a 1 dollar tip, and tell me the exact total the page shows. Save a screenshot as order-before.png.

Claude stopped before every browser action and asked for permission. The first one was “Navigate to a URL” with the address we gave it, and the choices were Yes or No. We chose Yes each time.

Claude Code permission prompt for the Playwright Navigate to a URL tool with the tool name outlined in red
Every browser action asks first, which keeps you in control

The whole round took 13 seconds of work after the approvals. Claude called the browser tools six times, then reported what it saw.

Claude Code reply saying the page shows Total: $91 and explaining that 2 times 4.50 plus 1 should be 10, with the explanation outlined in red
Claude read the wrong total from the real page and explained why it was wrong

Claude answered that the page showed a total of $91. It also said that 2 times $4.50 plus $1 should come to $10. It guessed correctly that the subtotal 9 had been joined with the tip 1 as text.

The screenshot that the plugin saved shows the same thing. This is a real image of the page in the headless browser, not a mock-up.

Bean There Coffee order page showing quantity 2, Large size, tip 1 and the total Total: $91 outlined in red
The page the browser saw, with the wrong total of $91

The Fix: Let Claude Repair and Re-Test

Prompt 2: fix and prove it

In a fresh session we sent a second prompt. We asked Claude to fix the bug in app.js, re-test the same order, check the console and save a new screenshot.

The order total on the page is wrong when a tip is added. Fix it in app.js, then use the Playwright browser tools to re-test the same order (2 large coffees, 1 dollar tip), check the browser console for errors, and save a screenshot as order-after.png.

Claude read the file and proposed a one-line change. It wrapped the tip in Number() and added || 0 so an empty tip box counts as zero. We approved the edit.

Terminal diff showing the tip line changed to use Number with the changed lines outlined in red
The one-line fix, shown as a diff before we approved it

Something useful happened next. Claude noticed that the Playwright browser would not open a local file path, so it started a small web server on its own and asked us to approve that command. That matches the server’s help text, which says navigation to file:// pages is blocked unless you pass a special flag.

After the server was up, Claude entered the same order, clicked the button and read the console. It then stopped the server it had started, so nothing was left running.

Claude Code summary of the fix with the fixed total, the bug explanation and the console result outlined in red
The final report: what the bug was, how it re-tested and what the console said

The new screenshot shows a total of $10, which is the right answer for 2 large coffees and a $1 tip.

Bean There Coffee order page showing the same order with the total Total: $10 outlined in red
The same order after the fix now shows the correct total

What the console check found

Claude reported one console error, a 404 for /favicon.ico. It said the page had no icon and the simple server did not supply one, and that there were no JavaScript errors. That is an honest and correct reading, because we never gave the page an icon.

This is a good example of why the console tool is handy. A real browser surfaces small problems that a code review would not.

Flow diagram: test in browser, read the code, fix app.js, re-test
The loop we saw: test, read, fix, then test again

What We Liked and What We Did Not

The browser lets Claude check its own fix instead of guessing.

The best part was the proof. Claude did not just say the fix should work.

It opened the page, entered the order and showed the new total. For anyone who has asked an AI to fix a front-end bug and then found it still broken, this is the useful difference.

The permission prompts are a mixed blessing. They keep you safe, but a single test needed about nine approvals across the two prompts. You can reduce the clicks with your permission settings, though we kept the defaults.

What workedWhat to watch
Claude saw the real page and read the exact wrong totalMany approval prompts in default mode
Fix and re-test happened in one conversationThe browser blocks file:// pages, so you need a local server
Console errors were checked without extra effortHeaded by default, so a window opens unless you ask for headless
Plugin is a single small file, easy to readIt uses @latest, so the server version can change under you

Safety Notes Before You Install

This plugin downloads and runs a package with npx every time it starts. That package is published by Microsoft, but you are still running code from the internet, so read the plugin folder first. Anthropic’s docs have a section on plugin security and trust that is worth a read, and the discover plugins page linked above is the place to find it.

The tools are marked open-world, so a browser that Claude controls can visit any site your network allows. The server has options to limit which sites it may contact, but its own help says these are not a security boundary. Treat the browser as untrusted when you point it at sites you do not control.

The “Run Playwright code (unsafe)” tool deserves special caution. Its name says it all, so keep the approval prompt on for it. Also remember that a page Claude reads can contain text that tries to give Claude instructions, so do not point it at pages you do not trust while it holds your project open.

Try It Yourself

Here is a safe practice task. Create a folder with a small page that has a form, serve it on a local address, and ask Claude to test it. Use a copy-paste prompt like this one.

Open http://localhost:8000 with the Playwright browser tools. Fill in every field with sample data, click the submit button, and tell me exactly what the page shows. Then check the console for errors and save a screenshot as result.png.

Plant a small bug first, as we did, so you can see Claude catch it. Then ask it to fix the bug and run the same test again.

Common Mistakes

  • Asking Claude to open a file path. The browser blocks file:// pages by default, so serve the folder on http://localhost first.
  • Forgetting Node.js. The plugin starts with npx, which needs Node.js on your machine.
  • Running it headed without realizing. A browser window will open unless you ask for headless mode.
  • Trusting one test. One passing run on one input does not prove the page works, so try an empty field and an odd value too.
  • Skipping the console check. Ask for it in your prompt, because Claude only reads the console when it is told to.

Pro Tips

  • Say the exact result you expect. In our prompt, the expected $10 made the wrong $91 stand out right away.
  • Ask for a screenshot with a file name, so you have proof you can open yourself.
  • Pair it with a test-first habit. Our guide on test-driven development shows the same idea with unit tests.
  • For written test files, see our guide to writing tests. The browser plugin checks a running page, while test files re-run on their own later.
  • Read the official MCP docs if you want to manage the server’s scope or approvals.

Cheat Sheet

Cheat sheet card with the install command, check commands and example prompts for the Playwright plugin
Install, check and prompt patterns in one card

Frequently Asked Questions

Is the Playwright plugin free?

The plugin and the Playwright server do not charge anything in our test. Claude still uses your normal Claude Code usage while it reads pages and writes fixes.

Does it need my real Chrome browser?

No. We used Playwright’s own Chromium, installed in a throwaway folder. The server can also use Chrome, Firefox, WebKit or Edge if you choose them.

Why did Claude refuse to open my local HTML file?

The server blocks file:// addresses by default. The simple fix is to serve the folder on http://localhost, which is what Claude did on its own in our test.

Can it test pages that need a login?

We did not test that. Do not type real passwords into a page Claude controls, and use a test account if you try.

Is this the same as the Webapp Testing skill?

No. This plugin gives Claude live browser tools. A skill is a set of written instructions, and our skills guide explains how those differ.

Conclusion

The Playwright plugin turns Claude Code from a tool that edits files into one that can also check the result in a real browser. In our single demo it found a wrong total, explained the cause, made a one-line fix and proved the fix with a new screenshot, all in two short prompts. Install it if you build web pages and want Claude to verify its own changes, but read the plugin first, keep the approvals on, and remember that we tested only one small page. For more tools like this, browse the Claude tool page and our full list of Claude Code tutorials.

Newsletter

New AI tools in your inbox

The best new tools and the AI news that matters, in one short email. Unsubscribe any time.

Free · No spam · Unsubscribe any time

✓ Looks like you’re subscribed

Loading Google’s sign-up form…

Looks like you’re already subscribed

Thanks for reading! New AI tools and the AI news that matters will land in your inbox.

Not subscribed yet? Refresh the page to load the sign-up form.

The sign-up form couldn’t load. If you use an ad or content blocker, allow news.google.com and reload the page.

Free instant check before you pay. Takes a few seconds.

Scroll to Top