Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Complete browser automation with Playwright. Auto-detects dev servers, writes clean test scripts to /tmp. Test pages, fill forms, take screenshots, check responsive design, validate UX, test login flows, check links, automate any browser task. Use when user wants to test websites, automate browser interactions, validate web functionality, or perform any browser-based testing.
.claude/skills/microck-playwright-browser-automation/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-05 | ✗→✓ | ▲ Improved | 165% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 242% | 0% |
| case-20 | ✓→✓ | = Same ✓ | 175% | 0% |
| case-14 | ✓→✓ | = Same ✓ | 113% | 0% |
| case-19 | ✓→✓ | = Same ✓ | 113% | 0% |
IMPORTANT - Path Resolution: This skill can be installed in different locations (plugin system, manual installation, global, or project-specific). Before executing any commands, determine the skill directory based on where you loaded this SKILL.md file, and use that path in all commands below. Replace $SKILL_DIR with the actual discovered path.
Common installation paths:
~/.claude/plugins/marketplaces/playwright-skill/skills/playwright-skill~/.claude/skills/playwright-skill<project>/.claude/skills/playwright-skillGeneral-purpose browser automation skill. I'll write custom Playwright code for any automation task you request and execute it via the universal executor.
CRITICAL WORKFLOW - Follow these steps in order:
bash cd $SKILL_DIR && node -e "require('./lib/helpers').detectDevServers().then(servers => console.log(JSON.stringify(servers)))"
/tmp/playwright-test-*.jsheadless: false unless user specifically requests headless mode/tmp/playwright-test-*.js (won't clutter your project)cd $SKILL_DIR && node run.js /tmp/playwright-test-*.jsbashcd $SKILL_DIR npm run setup
This installs Playwright and Chromium browser. Only needed once.
Step 1: Detect dev servers (for localhost testing)
bashcd $SKILL_DIR && node -e "require('./lib/helpers').detectDevServers().then(s => console.log(JSON.stringify(s)))"
Step 2: Write test script to /tmp with URL parameter
javascript// /tmp/playwright-test-page.js const { chromium } = require('playwright'); // Parameterized URL (detected or user-provided) const TARGET_URL = 'http://localhost:3001'; // <-- Auto-detected or from user (async () => { const browser = await chromium.launch({ headless: false }); const page = await browser.newPage(); await page.goto(TARGET_URL); console.log('Page loaded:', await page.title()); await page.screenshot({ path: '/tmp/screenshot.png', fullPage: true }); console.log('📸 Screenshot saved to /tmp/screenshot.png'); await browser.close(); })();
Step 3: Execute from skill directory
bashcd $SKILL_DIR && node run.js /tmp/playwright-test-page.js
javascript// /tmp/playwright-test-responsive.js const { chromium } = require('playwright'); const TARGET_URL = 'http://localhost:3001'; // Auto-detected (async () => { const browser = await chromium.launch({ headless: false, slowMo: 100 }); const page = await browser.newPage(); // Desktop test await page.setViewportSize({ width: 1920, height: 1080 }); await page.goto(TARGET_URL); console.log('Desktop - Title:', await page.title()); await page.screenshot({ path: '/tmp/desktop.png', fullPage: true }); // Mobile test await page.setViewportSize({ width: 375, height: 667 }); await page.screenshot({ path: '/tmp/mobile.png', fullPage: true }); await browser.close(); })();
javascript// /tmp/playwright-test-login.js const { chromium } = require('playwright'); const TARGET_URL = 'http://localhost:3001'; // Auto-detected (async () => { const browser = await chromium.launch({ headless: false }); const page = await browser.newPage(); await page.goto(`${TARGET_URL}/login`); await page.fill('input[name="email"]', 'test@example.com'); await page.fill('input[name="password"]', 'password123'); await page.click('button[type="submit"]'); // Wait for redirect await page.waitForURL('**/dashboard'); console.log('✅ Login successful, redirected to dashboard'); await browser.close(); })();
javascript// /tmp/playwright-test-form.js const { chromium } = require('playwright'); const TARGET_URL = 'http://localhost:3001'; // Auto-detected (async () => { const browser = await chromium.launch({ headless: false, slowMo: 50 }); const page = await browser.newPage(); await page.goto(`${TARGET_URL}/contact`); await page.fill('input[name="name"]', 'John Doe'); await page.fill('input[name="email"]', 'john@example.com'); await page.fill('textarea[name="message"]', 'Test message'); await page.click('button[type="submit"]'); // Verify submission await page.waitForSelector('.success-message'); console.log('✅ Form submitted successfully'); await browser.close(); })();
javascriptconst { chromium } = require('playwright'); (async () => { const browser = await chromium.launch({ headless: false }); const page = await browser.newPage(); await page.goto('http://localhost:3000'); const links = await page.locator('a[href^="http"]').all(); const results = { working: 0, broken: [] }; for (const link of links) { const href = await link.getAttribute('href'); try { const response = await page.request.head(href); if (response.ok()) { results.working++; } else { results.broken.push({ url: href, status: response.status() }); } } catch (e) { results.broken.push({ url: href, error: e.message }); } } console.log(`✅ Working links: ${results.working}`); console.log(`❌ Broken links:`, results.broken); await browser.close(); })();
javascriptconst { chromium } = require('playwright'); (async () => { const browser = await chromium.launch({ headless: false }); const page = await browser.newPage(); try { await page.goto('http://localhost:3000', { waitUntil: 'networkidle', timeout: 10000 }); await page.screenshot({ path: '/tmp/screenshot.png', fullPage: true }); console.log('📸 Screenshot saved to /tmp/screenshot.png'); } catch (error) { console.error('❌ Error:', error.message); } finally { await browser.close(); } })();
javascript// /tmp/playwright-test-responsive-full.js const { chromium } = require('playwright'); const TARGET_URL = 'http://localhost:3001'; // Auto-detected (async () => { const browser = await chromium.launch({ headless: false }); const page = await browser.newPage(); const viewports = [ { name: 'Desktop', width: 1920, height: 1080 }, { name: 'Tablet', width: 768, height: 1024 }, { name: 'Mobile', width: 375, height: 667 } ]; for (const viewport of viewports) { console.log(`Testing ${viewport.name} (${viewport.width}x${viewport.height})`); await page.setViewportSize({ width: viewport.width, height: viewport.height }); await page.goto(TARGET_URL); await page.waitForTimeout(1000); await page.screenshot({ path: `/tmp/${viewport.name.toLowerCase()}.png`, fullPage: true }); } console.log('✅ All viewports tested'); await browser.close(); })();
For quick one-off tasks, you can execute code inline without creating files:
bash# Take a quick screenshot cd $SKILL_DIR && node run.js " const browser = await chromium.launch({ headless: false }); const page = await browser.newPage(); await page.goto('http://localhost:3001'); await page.screenshot({ path: '/tmp/quick-screenshot.png', fullPage: true }); console.log('Screenshot saved'); await browser.close(); "
When to use inline vs files:
Optional utility functions in lib/helpers.js:
javascriptconst helpers = require('./lib/helpers'); // Detect running dev servers (CRITICAL - use this first!) const servers = await helpers.detectDevServers(); console.log('Found servers:', servers); // Safe click with retry await helpers.safeClick(page, 'button.submit', { retries: 3 }); // Safe type with clear await helpers.safeType(page, '#username', 'testuser'); // Take timestamped screenshot await helpers.takeScreenshot(page, 'test-result'); // Handle cookie banners await helpers.handleCookieBanner(page); // Extract table data const data = await helpers.extractTableData(page, 'table.results');
See lib/helpers.js for full list.
For comprehensive Playwright API documentation, see API_REFERENCE.md:
detectDevServers() before writing test code for localhost testing/tmp/playwright-test-*.js, never to skill directory or user's projectTARGET_URL constant at the top of every scriptheadless: false unless user explicitly asks for headless modeheadless: true when user specifically requests "headless" or "background" executionslowMo: 100 to make actions visible and easier to followwaitForURL, waitForSelector, waitForLoadState instead of fixed timeoutsconsole.log() to track progress and show what's happeningPlaywright not installed:
bashcd $SKILL_DIR && npm run setup
Module not found: Ensure running from skill directory via run.js wrapper
Browser doesn't open: Check headless: false and ensure display available
Element not found: Add wait: await page.waitForSelector('.element', { timeout: 10000 })
User: "Test if the marketing page looks good"
Claude: I'll test the marketing page across multiple viewports. Let me first detect running servers...
[Runs: detectDevServers()]
[Output: Found server on port 3001]
I found your dev server running on http://localhost:3001
[Writes custom automation script to /tmp/playwright-test-marketing.js with URL parameterized]
[Runs: cd $SKILL_DIR && node run.js /tmp/playwright-test-marketing.js]
[Shows results with screenshots from /tmp/]User: "Check if login redirects correctly"
Claude: I'll test the login flow. First, let me check for running servers...
[Runs: detectDevServers()]
[Output: Found servers on ports 3000 and 3001]
I found 2 dev servers. Which one should I test?
- http://localhost:3000
- http://localhost:3001
User: "Use 3001"
[Writes login automation to /tmp/playwright-test-login.js]
[Runs: cd $SKILL_DIR && node run.js /tmp/playwright-test-login.js]
[Reports: ✅ Login successful, redirected to /dashboard]/tmp for automatic cleanup (no clutter)run.js| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-20 | pass→pass | 8,212 | 5,577 | -32% | 1 | 1 | 0% | 1,565 | 4,308 | +175% | 0 | 0 | — |
case-01 | fail→fail | 12,903 | 9,709 | -25% | 1 | 1 | 0% | 2,660 | 3,961 | +49% | 0 | 0 | — |
case-02 | fail→fail | 10,660 | 8,892 | -17% | 1 | 1 | 0% | 810 | 3,854 | +376% | 0 | 0 | — |
case-03 | fail→fail | 8,482 | 8,529 | +1% | 1 | 1 | 0% | 1,533 | 3,798 | +148% | 0 | 0 | — |
case-09 | fail→fail | 4,183 | 5,572 | +33% | 1 | 1 | 0% | 685 | 3,611 | +427% | 0 | 0 | — |
case-04 | fail→fail | 8,003 | 6,574 | -18% | 1 | 1 | 0% | 1,474 | 3,729 | +153% | 0 | 0 | — |
case-05 | fail→pass | 10,450 | 14,347 | +37% | 1 | 1 | 0% | 2,042 | 5,419 | +165% | 0 | 0 | — |
case-06 | fail→fail | 9,370 | 7,062 | -25% | 1 | 1 | 0% | 1,750 | 3,641 | +108% | 0 | 0 | — |
case-07 | fail→fail | 11,261 | 7,683 | -32% | 1 | 1 | 0% | 2,204 | 3,735 | +69% | 0 | 0 | — |
case-08 | fail→fail | 12,565 | 9,604 | -24% | 1 | 1 | 0% | 2,220 | 3,892 | +75% | 0 | 0 | — |
case-10 | fail→pass | 6,972 | 5,513 | -21% | 1 | 1 | 0% | 1,220 | 4,170 | +242% | 0 | 0 | — |
case-11 | fail→fail | 13,921 | 4,079 | -71% | 1 | 1 | 0% | 2,611 | 3,836 | +47% | 0 | 0 | — |
case-12 | fail→fail | 15,099 | 7,962 | -47% | 1 | 1 | 0% | 2,385 | 3,798 | +59% | 0 | 0 | — |
case-13 | fail→fail | 10,062 | 6,483 | -36% | 1 | 1 | 0% | 1,966 | 3,707 | +89% | 0 | 0 | — |
case-14 | pass→pass | 10,141 | 4,319 | -57% | 1 | 1 | 0% | 1,817 | 3,866 | +113% | 0 | 0 | — |
case-15 | fail→fail | 8,252 | 6,031 | -27% | 1 | 1 | 0% | 1,585 | 3,656 | +131% | 0 | 0 | — |
case-16 | fail→fail | 13,134 | 2,952 | -78% | 1 | 1 | 0% | 2,758 | 3,686 | +34% | 0 | 0 | — |
case-17 | fail→fail | 11,745 | 7,425 | -37% | 1 | 1 | 0% | 2,346 | 3,564 | +52% | 0 | 0 | — |
case-18 | fail→fail | 10,631 | 7,362 | -31% | 1 | 1 | 0% | 2,083 | 3,783 | +82% | 0 | 0 | — |
case-19 | pass→pass | 13,412 | 12,579 | -6% | 1 | 1 | 0% | 2,782 | 5,923 | +113% | 0 | 0 | — |
case-21 | pass→pass | 7,503 | 5,425 | -28% | 1 | 1 | 0% | 1,411 | 4,250 | +201% | 0 | 0 | — |
case-22 | pass→pass | 14,571 | 12,405 | -15% | 1 | 1 | 0% | 2,981 | 6,109 | +105% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 9 counted toward the lift figure. The other 13 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of 0 percentage points is the difference between those two pass rates over the 9 comparable cases. 9 cases got worse with the skill loaded, and they are included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.