Browser testing, web scraping, and UI validation using Playwright MCP.
Automate browser testing, web scraping, and UI validation using Playwright MCP server for comprehensive browser automation.
Core Testing Workflow:
browser_navigate - Load URLbrowser_wait_for - Wait for time, text, or elementbrowser_click - Click buttons and elementsbrowser_fill_form - Batch fill multiple form fieldsbrowser_type - Type into inputsbrowser_select_option - Select dropdown optionsbrowser_snapshot - Accessibility tree (for AI analysis)browser_take_screenshot - Visual capturebrowser_console_messages - Check for JavaScript errorsNavigate to http://localhost:8501
Wait 5 seconds
Take snapshot
Verify expected elements present
Fill form fields (use browser_fill_form for speed)
Click Submit button
Wait for "Success" text to appear
Take screenshot
Resize to 375x667 (mobile)
Take screenshot
Resize to 1920x1080 (desktop)
Take screenshot
Navigate to homepage
Click navigation link
Verify URL changed
Verify new page content
✅ DO:
browser_snapshot for AI analysisbrowser_fill_form❌ AVOID:
Navigate to http://localhost:8501
Wait 5 seconds
Take snapshot
Click element with ref from snapshot
Wait for "Success" text
Take screenshot
Resize to 375x667 # Mobile
Take screenshot
Resize to 768x1024 # Tablet
Take screenshot
Resize to 1920x1080 # Desktop
Take screenshot
Fill form fields (batch)
Click Submit
Wait for success message
Verify in snapshot
Get console messages (onlyErrors=true)
Get network requests
Verify no 404s or 500s
| 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 |
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