Playwright MCP: AI-Powered Browser
Automation in 2025
What Is Playwright MCP?
npm install -g @playwright/mcp
npx @playwright/mcp@latest
npx playwright install chromium firefox webkit
npx @playwright/mcp@latest --port 8931 --host 0.0.0.0
nano ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest", "--headless"]
}
}
}
code --add-mcp '{"name":"playwright","command":"npx","args":["@playwright/mcp@latest"]}'
1. Go to https://the-internet.herokuapp.com/login
2. Enter username "tomsmith"
3. Enter password "SuperSecretPassword!"
4. Click Login
5. Confirm success message says "You logged into a secure area!"
const { test, expect } = require('@playwright/test');
test('Login Test', async ({ page }) => {
await page.goto('https://the-internet.herokuapp.com/login');
await page.fill('#username', 'tomsmith');
await page.fill('#password', 'SuperSecretPassword!');
await page.click('button[type="submit"]');
const msg = await page.locator('.flash.success');
await expect(msg).toContainText('You logged into a secure area!');
});
npx playwright test login.test.js
What You Should Know:
Want to Master This With a Mentor?
Should You Learn It?