Back to Testing & Quality Assurance

Playwright MCP Testing

testingbrowser-automationplaywrightmcpweb-ui
β˜… 4.6 (189)⭐ 32πŸ“„ Apache-2.0πŸ•’ 2026-02-09Source β†—

Install this skill

npx skills add sfc-gh-dflippo/snowflake-dbt-demo

Works across Claude Code, Cursor, Codex, Copilot & Antigravity

What this skill does

  • β€’Programmatic navigation and viewport resizing
  • β€’DOM state analysis via accessibility tree snapshots
  • β€’Batch form submission for rapid testing
  • β€’Visual capture and screenshot comparison
  • β€’Real-time inspection of browser console messages

When to use it

  • βœ“Verifying application behavior after code changes
  • βœ“Testing form validation logic and successful submission flows
  • βœ“Auditing UI responsiveness across mobile, tablet, and desktop viewports
  • βœ“Identifying client-side JavaScript errors during page initialization

When not to use it

  • βœ•High-frequency unit testing of pure logic functions
  • βœ•Performance testing that requires deep network latency analysis
  • βœ•Scraping highly protected sites with complex anti-bot measures

How to invoke it

Example prompts that trigger this skill:

  • β€œNavigate to the login page and take a snapshot to list form fields.”
  • β€œResize the browser to mobile dimensions and check for UI layout issues.”
  • β€œFill out the registration form with test credentials and submit it.”
  • β€œCheck the browser console for any JavaScript errors on the dashboard.”
  • β€œCapture a screenshot of the main landing page to verify visuals.”

Example workflow

  1. Open the target URL using the navigate tool.
  2. Request an accessibility snapshot to identify interactive button refs.
  3. Execute interaction commands using retrieved element references.
  4. Wait for a success message or specific state change.
  5. Verify results by checking for console errors and visual state.

Prerequisites

  • –Playwright browser binaries installed via 'npx @playwright/mcp browser install'
  • –Node.js runtime environment

Pitfalls & limitations

  • !Assuming elements are immediately available without explicit wait commands.
  • !Over-relying on visual screenshots instead of semantic snapshots for interaction.
  • !Missing dynamic state updates if wait durations are too short.

FAQ

How do I ensure the agent clicks the correct element?
Always trigger an accessibility snapshot first; this gives the agent a clear, text-based map of the DOM elements and their labels to reference.
What should I do if my browser tests are running too slowly?
Use the batch form filling tool rather than individual typing commands to reduce the number of discrete steps sent to the browser.
Can I test how my site looks on mobile devices?
Yes, use the resize tool to adjust the browser viewport to standard mobile dimensions before taking your screenshots.
Why are my screenshots coming back blank?
This usually happens when a screenshot is requested before the page has finished rendering; ensure you use a wait command for content loading first.

How it compares

Unlike manual testing or generic Puppeteer scripts, this MCP implementation provides an AI-native interface, allowing the agent to interpret the page structure automatically via snapshots instead of requiring hardcoded selectors.

Source & trust

⭐ 32 starsπŸ“„ Apache-2.0πŸ•’ Updated 2026-02-09πŸ›‘ network

From the source: β€œ# Playwright MCP Testing Automate browser testing, web scraping, and UI validation using Playwright MCP server for comprehensive browser automation. ## Quick Start **Core Testing Workflow:** 1. Navigate to application 2. Take snapshot (accessibility tree) 3. Interact with elements 4. Verify expected…”

View the full SKILL.md source

# Playwright MCP Testing

Automate browser testing, web scraping, and UI validation using Playwright MCP server for
comprehensive browser automation.

## Quick Start

**Core Testing Workflow:**

1. Navigate to application
2. Take snapshot (accessibility tree)
3. Interact with elements
4. Verify expected behavior
5. Take screenshots for documentation

## Key Tools

### Navigation & Waiting

- `browser_navigate` - Load URL
- `browser_wait_for` - Wait for time, text, or element

### Interaction

- `browser_click` - Click buttons and elements
- `browser_fill_form` - Batch fill multiple form fields
- `browser_type` - Type into inputs
- `browser_select_option` - Select dropdown options

### Validation

- `browser_snapshot` - Accessibility tree (for AI analysis)
- `browser_take_screenshot` - Visual capture
- `browser_console_messages` - Check for JavaScript errors

## Testing Patterns

### Page Load Verification

```sql
Navigate to http://localhost:8501
Wait 5 seconds
Take snapshot
Verify expected elements present
```

### Form Testing

```sql
Fill form fields (use browser_fill_form for speed)
Click Submit button
Wait for "Success" text to appear
Take screenshot
```

### Responsive Design

```sql
Resize to 375x667 (mobile)
Take screenshot
Resize to 1920x1080 (desktop)
Take screenshot
```

### Multi-Page Navigation

```sql
Navigate to homepage
Click navigation link
Verify URL changed
Verify new page content
```

## Best Practices

βœ… **DO:**

- Use `browser_snapshot` for AI analysis
- Wait for content (3-5 seconds)
- Batch form fields with `browser_fill_form`
- Use element refs from snapshots for reliable clicks
- Check console for errors

❌ **AVOID:**

- Using screenshots when you need to interact
- Typing each field individually
- Skipping waits for dynamic content
- Ignoring console errors

## Common Workflows

### Pre-Deployment Testing

- Test all pages load without errors
- Verify navigation works
- Test forms submit successfully
- Check data displays correctly
- Validate responsive design (375, 768, 1920px)
- Check console for JavaScript errors

### Accessibility Validation

- Take snapshot of each page
- Verify interactive elements have labels
- Check heading hierarchy
- Verify form labels associated

### Visual Regression

- Take full-page screenshots
- Compare with baseline
- Document changes

## Quick Reference

### Common Test Flow

```sql
Navigate to http://localhost:8501
Wait 5 seconds
Take snapshot
Click element with ref from snapshot
Wait for "Success" text
Take screenshot
```

### Responsive Testing

```sql
Resize to 375x667  # Mobile
Take screenshot
Resize to 768x1024  # Tablet
Take screenshot
Resize to 1920x1080  # Desktop
Take screenshot
```

### Form Submission

```sql
Fill form fields (batch)
Click Submit
Wait for success message
Verify in snapshot
```

### Error Checking

```sql
Get console messages (onlyErrors=true)
Get network requests
Verify no 404s or 500s
```

---

## Troubleshooting

| Issue                      | Solution                                                               |
| -------------------------- | ---------------------------------------------------------------------- |
| Browsers not installed     | Run `npx @playwright/mcp browser install`                              |
| Element not found          | Take snapshot first to get current page state and exact ref            |
| Tests too slow             | Use `browser_fill_form` instead of multiple `browser_type`             |
| MCP not starting           | Restart IDE, verify `mcp.json` is valid JSON                           |
| Timeout errors             | Increase wait times or use `browser_wait_for` with specific conditions |
| Screenshots blank          | Ensure page is fully loaded before taking screenshot                   |
| Console errors not showing | Use `browser_console_messages` with `onlyErrors=true` parameter        |

---

## Resources

- `TESTING_PATTERNS.md` - Common test scenarios (coming soon)
- `STREAMLIT_TESTING.md` - Streamlit-specific patterns (coming soon)
- `ACCESSIBILITY.md` - Accessibility testing workflows (coming soon)
- `mcp-config.json` - MCP server configuration

Quoted from sfc-gh-dflippo/snowflake-dbt-demo for reference β€” see the original for the authoritative, latest version.

πŸ“„ Full skill instructions β€” original source: sfc-gh-dflippo/snowflake-dbt-demo
The Playwright MCP server enables AI agents to execute browser-based automation tasks directly from your development environment. By bridging the gap between LLMs and real browser engines, it allows you to navigate pages, fill forms, and validate UI elements programmatically. Instead of relying on manual clicks or flaky brittle scripts, you can generate an accessibility tree snapshot, which provides the agent with a semantic map of the DOM. This structure allows the model to make precise interactions based on actual page content rather than guessing selectors. It is suited for automated regression suites, verifying responsive layouts across different viewports, and inspecting console output for client-side errors. By combining standard browser operations with AI-driven analysis, this skill transforms how agents handle front-end interactions and visual validation in your local or pre-deployment workflow.

How to Use This Skill Unit

Option A: Project-Specific (Recommended)

  1. Click "Download" above
  2. In your project, create the directory: .agent/skills/playwright-mcp/
  3. Save the file as SKILL.md
  4. The agent will automatically discover the skill based on its description.

Option B: Global Installation (All Agents)

Save the file to these locations to make it available across all projects:

  • Claude Code: ~/.claude/skills/sfc-gh-dflippo/snowflake-dbt-demo/playwright-mcp/SKILL.md
  • Cursor: ~/.cursor/skills/sfc-gh-dflippo/snowflake-dbt-demo/playwright-mcp/SKILL.md
  • Antigravity: ~/.gemini/antigravity/skills/sfc-gh-dflippo/snowflake-dbt-demo/playwright-mcp/SKILL.md

πŸš€ Install with CLI:
npx skills add sfc-gh-dflippo/snowflake-dbt-demo

Read the Master Guide: Mastering Agent Skills β†’

Recommended Rules

View more rules β†’

Recommended Workflows

View more workflows β†’

Recommended MCP Servers

View more MCP servers β†’

Take It Further

Maximize your productivity with these powerful resources

πŸ“‹

Define Your Standards

Set up coding standards to ensure this workflow produces consistent, high-quality results.

Browse Rules Library
πŸ“–

Master Workflows

Learn how to create custom workflows, use Turbo Mode, and build your automation library.

Complete Guide

How to use this Skill in Claude Code & Cursor

For Claude Code (CLI)

To use this skill in Claude Code, copy the rule content into your project's custom instructions or follow our Add-Skill CLI guide. This ensures Claude follows your standards during every code generation.

For Cursor & Windsurf

For Cursor or Windsurf, individual skills are best used in the "Rules for AI" section. This specific unit helps the agent avoid testing & quality assurance issues, leading to cleaner, more efficient code.

Why the skill format matters: the standardized Agent Skills format lets your AI agent load detailed instructions only when they are relevant, keeping your prompt clean while improving results.

Source & attribution

This skill is categorized under Testing & Quality Assurance and is published by sfc-gh-dflippo, maintained in sfc-gh-dflippo/snowflake-dbt-demo.

← Browse All Agent Skills
Sponsored AI assistant. Recommendations may be paid.