agentleFS
raomasterraomaster/skills/playwright-browser/SKILL.md

playwright-browser

Skill1 starsChanged 7 months agoMITView on GitHub

Use when automating browser tasks with Playwright — navigation, clicks, form fills, screenshots, assertions, or network interception. Also triggers when debugging flaky browser tests or setting up Playwright in a new project.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. AndyShiu/claude-skill-playwright-browser★ 41same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository8 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 0 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run scripts/check-playwright.sh to verify Playwright is installed before starting.

    line 12
  2. Very specific:

    Race conditions: Never use sleep() — use waitForSelector, waitForResponse, or waitForURL.

    line 64
  3. Very specific:

    Auth state: Use storageState to persist cookies/localStorage between test runs.

    line 65
  4. Very specific:

    Headless vs headed: Use headless: true in CI, headed locally for debugging.

    line 66
  5. Very specific:

    Multi-tab flows: Use context.newPage() for pages that open in new tabs.

    line 67
  6. Very specific:

    Iframe content: Use frame.locator() — page selectors don't pierce iframes.

    line 68

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

playwright-browser

Reference guide for browser automation with Playwright. Covers the most common patterns and their gotchas.

Setup

Run scripts/check-playwright.sh to verify Playwright is installed before starting.

Common Patterns

Navigate and wait for page to settle

await page.goto('https://example.com');
await page.waitForLoadState('networkidle');

Click and fill using semantic selectors

// Prefer role/label selectors over CSS — more resilient to UI changes
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByLabel('Email').fill('user@example.com');

Fill and submit a form

await page.getByLabel('Username').fill('user');
await page.getByLabel('Password').fill('secret');
await page.getByRole('button', { name: 'Login' }).click();
await page.waitForURL('/dashboard');

Take a screenshot

await page.screenshot({ path: 'screenshot.png', fullPage: true });

Assert content

await expect(page.getByText('Welcome back')).toBeVisible();
await expect(page).toHaveTitle('Dashboard');

Intercept network requests

await page.route('**/api/data', route => {
  route.fulfill({ json: { items: [] } });
});

Handle browser dialogs (alert/confirm)

page.on('dialog', dialog => dialog.accept());
await page.getByText('Delete').click();

Gotchas

  • Selectors rot: CSS selectors break on UI changes. Use getByRole, getByLabel, getByText instead.
  • Race conditions: Never use sleep() — use waitForSelector, waitForResponse, or waitForURL.
  • Auth state: Use storageState to persist cookies/localStorage between test runs.
  • Headless vs headed: Use headless: true in CI, headed locally for debugging.
  • Multi-tab flows: Use context.newPage() for pages that open in new tabs.
  • Iframe content: Use frame.locator() — page selectors don't pierce iframes.

Running Tests

npx playwright test                          # Run all tests
npx playwright test --headed                 # With browser visible
npx playwright test tests/login.spec.ts      # Single file
npx playwright test --debug                  # Step-through debugger
npx playwright show-report                   # HTML report after run

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.