playwright▌
oakoss/agent-skills · updated May 7, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
Playwright is a browser automation framework for Node.js and Python supporting Chromium, Firefox, and WebKit with a single API. It provides auto-waiting, web-first assertions, and full test isolation for reliable end-to-end testing.
Playwright
Overview
Playwright is a browser automation framework for Node.js and Python supporting Chromium, Firefox, and WebKit with a single API. It provides auto-waiting, web-first assertions, and full test isolation for reliable end-to-end testing.
When to use: Browser automation, web scraping, screenshot/PDF generation, API testing, configuring Playwright Test, troubleshooting Playwright errors, stealth mode and anti-bot bypass.
When NOT to use: Simple HTTP requests (use fetch), unit testing (use Vitest/Jest), serverless scraping at scale (consider Cloudflare Browser Rendering). For E2E test architecture (Page Object Models, CI sharding, test organization, authentication patterns), use the e2e-testing skill.
Quick Reference
| Pattern | API / Config | Key Points |
|---|---|---|
| Basic test | test('name', async ({ page }) => {}) |
Auto-wait, web-first assertions, test isolation |
| Locator | page.getByRole() / page.locator() |
Prefer role/label/text selectors over CSS |
| Assertion | expect(locator).toBeVisible() |
Auto-retrying, configurable timeout |
| API testing | request fixture / apiRequestContext |
Send HTTP requests, validate responses |
| Aria snapshot | expect(locator).toMatchAriaSnapshot() |
Validate accessibility tree structure via YAML |
| Class assertion | expect(locator).toContainClass('active') |
Match individual CSS class names (v1.52+) |
| Visible filter | locator.filter({ visible: true }) |
Match only visible elements (v1.51+) |
| Test step | test.step('name', async (step) => {}) |
Timeout, skip, and attachments (v1.50+) |
| Stealth mode | playwright-extra + stealth plugin |
Patches 20+ detection vectors |
| Authenticated session | context.cookies() + addCookies() |
Save/restore cookies and IndexedDB for persistence |
| Screenshot | page.screenshot({ fullPage: true }) |
Wait for key elements to load first |
| PDF generation | page.pdf({ format: 'A4' }) |
Chromium only, set printBackground: true |
| Clock API | page.clock |
Freeze, fast-forward, or simulate time in tests |
| A11y assertions | toHaveAccessibleName, toHaveRole |
Native assertions without axe-core dependency |
| Viewport assertion | expect(locator).toBeInViewport() |
Assert element is within the visible viewport |
| Changed tests only | --only-changed=$GITHUB_BASE_REF |
Run only test files changed since base branch |
| Docker | mcr.microsoft.com/playwright:v1.58.2-noble |
Use --init --ipc=host flags |
| Debug methods | page.consoleMessages() / page.requests() (v1.56+) |
No event listeners needed |
| Speedboard | HTML reporter (v1.57+) | Identifies slow tests and bottlenecks |
| Playwright Agents | npx playwright init-agents |
Planner, generator, healer for LLM-driven testing |
| Flaky test detection | --fail-on-flaky-tests (v1.50+) |
Exit code 1 on flaky tests in CI |
| Modify live responses | route.fetch() + route.fulfill() |
Intercept real response, tweak JSON, return it |
| Soft assertions | expect.soft(locator) |
Don't stop test on failure, report all at end |
| Retry block | expect(async () => {}).toPass() |
Default timeout is 0 (forever) — always set one |
| Custom matchers | expect.extend() / mergeExpects() |
Define or combine custom assertion methods |
| Actionability matrix | Per-action auto-wait checks | click: all 5 checks, fill: 3, focus/blur: none |
| Test modifiers | test.fixme() / test.fail() / test.slow() |
fixme=skip+track, fail=assert failure, slow=3x |
| Parallel modes | test.describe.configure({ mode: 'serial' }) |
serial, parallel, or default per-describe block |
| Teardown projects | teardown option on setup projects |
Auto-cleanup after all dependents finish |
Common Mistakes
| Mistake | Correct Pattern |
|---|---|
| Using CSS selectors over role selectors | Prefer getByRole, getByLabel, getByText for resilience |
| Not closing browser | Always await browser.close() in finally block |
Using setTimeout for waits |
Use locator auto-wait or waitForLoadState |
page.pause() left in CI code |
Guard with if (!process.env.CI) — hangs CI indefinitely |
| Clicking without waiting | Use locator().click() with built-in auto-wait |
| Shared state between tests | Each test gets fresh context via fixtures |
| Testing implementation details | Assert user-visible behavior, not DOM structure |
| Hardcoded waits for dynamic content | Wait for selector appearance or content stabilization |
Missing await on assertions |
All expect() assertions return promises — must be awaited |
| Same user agent for all scraping | Rotate user agents for high-volume scraping |
Using setTimeout for time-dependent tests |
Use page.clock API to freeze/fast-forward time |
| Installing axe-core for simple a11y checks | Use native toHaveAccessibleName/toHaveRole assertions |
Using toPass() without explicit timeout |
Always pass { timeout: 10_000 } — default is 0 (forever) |
Service worker silently blocking page.route() |
Set serviceWorkers: 'block' in context config when using MSW |
Using fill() for autocomplete/debounce inputs |
Use pressSequentially() with optional delay for per-keystroke handling |
storageState losing sessionStorage |
storageState only saves cookies + localStorage — inject sessionStorage via addInitScript() |
Delegation
- Selector troubleshooting: Use
Exploreagent - Test pattern review: Use
Taskagent - Code review: Delegate to
code-revieweragent
For E2E test architecture, Page Object Model patterns, CI sharding strategies, authentication flows, visual regression workflows, or test organization, use the
e2e-testingskill.
References
- Quick start and installation
- E2E testing patterns and assertions
- Selector strategies and best practices
- Configuration and Docker deployment
- Docker and CI
- Debug methods and performance analysis
- Common automation patterns
- Stealth mode and anti-bot bypass
- Known issues and solutions
- Site-specific blocking and bypasses
- Troubleshooting common problems
- Network testing, mocking, and API patterns
- Input patterns, actionability, and test modifiers
- Advanced assertions, polling, custom matchers, and annotations
- Advanced topics: MCP, AI agents, parallel contexts
How to use playwright on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add playwright
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches playwright from GitHub repository oakoss/agent-skills and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate playwright. Access the skill through slash commands (e.g., /playwright) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
Task Automation & Efficiency
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Knowledge Enhancement
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Quality Improvement
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client with skill support
- ›Clear understanding of task or problem to solve
- ›Willingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Installation Steps
- 1.Install skill using provided installation command
- 2.Test with simple use case relevant to your work
- 3.Evaluate output quality and relevance
- 4.Iterate on prompts to improve results
- 5.Integrate into regular workflow if valuable
Common Pitfalls
- ⚠Expecting perfect results without iteration
- ⚠Not providing enough context in prompts
- ⚠Using skill for tasks outside its intended scope
- ⚠Accepting outputs without review and validation
Best Practices▌
✓ Do
- +Start with clear, specific prompts
- +Provide relevant context and constraints
- +Review and refine all outputs before using
- +Iterate to improve output quality
- +Document successful prompt patterns
✗ Don't
- −Don't use without understanding skill limitations
- −Don't skip validation of outputs
- −Don't share sensitive information in prompts
- −Don't expect skill to replace human judgment
💡 Pro Tips
- ★Be specific about desired format and style
- ★Ask for multiple options to choose from
- ★Request explanations to understand reasoning
- ★Combine AI efficiency with human expertise
When to Use This▌
✓ Use When
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid When
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path▌
- 1Familiarize yourself with skill capabilities and limitations
- 2Start with low-risk, non-critical tasks
- 3Progress to more complex and valuable use cases
- 4Build expertise through regular use and experimentation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.5★★★★★43 reviews- ★★★★★Hassan Mehta· Dec 20, 2024
Keeps context tight: playwright is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Ishan Sethi· Dec 8, 2024
We added playwright from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Maya Torres· Dec 8, 2024
Useful defaults in playwright — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Olivia Wang· Nov 27, 2024
playwright reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Amelia Srinivasan· Nov 27, 2024
playwright is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Rahul Santra· Nov 19, 2024
playwright has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Ishan Taylor· Nov 19, 2024
Solid pick for teams standardizing on skills: playwright is focused, and the summary matches what you get after install.
- ★★★★★Noah Khanna· Oct 18, 2024
Registry listing for playwright matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Daniel Dixit· Oct 18, 2024
Keeps context tight: playwright is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Pratham Ware· Oct 10, 2024
Solid pick for teams standardizing on skills: playwright is focused, and the summary matches what you get after install.
showing 1-10 of 43