Agent Skill
Web app testing
Tests local web apps by writing Python Playwright scripts, with a helper that starts your dev servers first, plus screenshots and console log capture.
Bookmark
Bookmarks are kept in your free account, so you can find this page again on any device.
Sign in to bookmarkInstall
Commands are pinned to commit e4bb5d9, the version we read, wherever the install method supports it.
npx skills
npx skills add anthropics/skills@e4bb5d960d87126ff3b3a8af1a104b7db67560ba --skill webapp-testing -a claude-codeCopies the skill into .claude/skills/ in this project, pinned to the reviewed commit.
Plugin marketplace
/plugin marketplace add anthropics/skills
/plugin install example-skills@anthropic-agent-skillsRun inside Claude Code. Installs the whole example-skills plugin from its default branch, not the pinned commit.
npx skills
npx skills add anthropics/skills@e4bb5d960d87126ff3b3a8af1a104b7db67560ba --skill webapp-testing -a codexInstalls to .agents/skills/, which Codex scans from the working directory up to the repo root.
npx skills
npx skills add anthropics/skills@e4bb5d960d87126ff3b3a8af1a104b7db67560ba --skill webapp-testing -a cursorInstalls to .agents/skills/, one of the folders Cursor reads skills from.
gh skill
gh skill install anthropics/skills skills/webapp-testing --pin e4bb5d960d87126ff3b3a8af1a104b7db67560ba --agent github-copilotNeeds GitHub CLI 2.90.0 or later. Use --scope user to install for every repository.
npx skills
npx skills add anthropics/skills@e4bb5d960d87126ff3b3a8af1a104b7db67560ba --skill webapp-testingPinned to the commit we reviewed. The CLI asks which agents to install for; add -g to install for your user instead of this project.
What it does
A small, practical toolkit. A decision tree helps the agent choose between opening a static HTML file directly and running a server. scripts/with_server.py starts one or more servers, waits for their ports and runs your test script, so the agent does not have to manage background processes. The recommended pattern is reconnaissance first (take a screenshot or dump the DOM, find selectors) and action second. Three example scripts show console logging, element discovery and static HTML automation.
When to use it
Checking a local web app in a real browser from an agent: confirming a fix, reproducing a bug, taking screenshots for review or writing a quick Python Playwright script. The server helper removes the most common failure, an agent starting a dev server and then waiting on it forever.
When to skip it
Large, maintained test suites, which belong in your project’s own Playwright setup with team conventions; see our test conventions recipe. For exploratory testing of what a diff changed, UI test is more thorough.
Try it
Start the dev server with npm run dev, then check the signup flow at
/signup: fill the form with valid and invalid data, screenshot each
result and report any console errors.
What it can touch
- Bundles scripts
- Yes
- Pre-approved tools
- None declared
- Needs
- Python 3 with Playwright; A local browser
- Client-specific fields
- None, spec fields only
Its scripts run with your permissions, and it may have changed since the commit we read. How to check a skill.
with_server.py runs whatever server command you pass it. Fine for your own app, but read the command if the agent constructs it.
At commit e4bb5d9 the SKILL.md is 96 lines long. Alongside it:
examples/(3 entries)scripts/(1 entry)LICENSE.txt
Alternatives
playwright-cli for a CLI-driven approach, browser testing with DevTools for debugging, and our generate Playwright tests with agents workflow.
SKILL.md
The file exactly as published at the reviewed commit, reproduced under its Apache-2.0 licence.
---
name: webapp-testing
description: Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
license: Complete terms in LICENSE.txt
---
# Web Application Testing
To test local web applications, write native Python Playwright scripts.
**Helper Scripts Available**:
- `scripts/with_server.py` - Manages server lifecycle (supports multiple servers)
**Always run scripts with `--help` first** to see usage. DO NOT read the source until you try running the script first and find that a customized solution is abslutely necessary. These scripts can be very large and thus pollute your context window. They exist to be called directly as black-box scripts rather than ingested into your context window.
## Decision Tree: Choosing Your Approach
```
User task → Is it static HTML?
├─ Yes → Read HTML file directly to identify selectors
│ ├─ Success → Write Playwright script using selectors
│ └─ Fails/Incomplete → Treat as dynamic (below)
│
└─ No (dynamic webapp) → Is the server already running?
├─ No → Run: python scripts/with_server.py --help
│ Then use the helper + write simplified Playwright script
│
└─ Yes → Reconnaissance-then-action:
1. Navigate and wait for networkidle
2. Take screenshot or inspect DOM
3. Identify selectors from rendered state
4. Execute actions with discovered selectors
```
## Example: Using with_server.py
To start a server, run `--help` first, then use the helper:
**Single server:**
```bash
python scripts/with_server.py --server "npm run dev" --port 5173 -- python your_automation.py
```
**Multiple servers (e.g., backend + frontend):**
```bash
python scripts/with_server.py \
--server "cd backend && python server.py" --port 3000 \
--server "cd frontend && npm run dev" --port 5173 \
-- python your_automation.py
```
To create an automation script, include only Playwright logic (servers are managed automatically):
```python
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch(headless=True) # Always launch chromium in headless mode
page = browser.new_page()
page.goto('http://localhost:5173') # Server already running and ready
page.wait_for_load_state('networkidle') # CRITICAL: Wait for JS to execute
# ... your automation logic
browser.close()
```
## Reconnaissance-Then-Action Pattern
1. **Inspect rendered DOM**:
```python
page.screenshot(path='/tmp/inspect.png', full_page=True)
content = page.content()
page.locator('button').all()
```
2. **Identify selectors** from inspection results
3. **Execute actions** using discovered selectors
## Common Pitfall
❌ **Don't** inspect the DOM before waiting for `networkidle` on dynamic apps
✅ **Do** wait for `page.wait_for_load_state('networkidle')` before inspection
## Best Practices
- **Use bundled scripts as black boxes** - To accomplish a task, consider whether one of the scripts available in `scripts/` can help. These scripts handle common, complex workflows reliably without cluttering the context window. Use `--help` to see usage, then invoke directly.
- Use `sync_playwright()` for synchronous scripts
- Always close the browser when done
- Use descriptive selectors: `text=`, `role=`, CSS selectors, or IDs
- Add appropriate waits: `page.wait_for_selector()` or `page.wait_for_timeout()`
## Reference Files
- **examples/** - Examples showing common patterns:
- `element_discovery.py` - Discovering buttons, links, and inputs on a page
- `static_html_automation.py` - Using file:// URLs for local HTML
- `console_logging.py` - Capturing console logs during automationRelated skills
Playwright CLI
Microsoft's skill for driving a real browser with playwright-cli: snapshots, clicks, form input, network mocking, tracing and turning sessions into tests.
Accessibility engineering (Addy Osmani)
Audits a running page against WCAG 2.2 AA with pinned axe-core and pa11y, then walks keyboard and screen reader checks before fixing what it finds.
Accessibility review
Runs a WCAG 2.1 AA audit of a page or design: contrast, keyboard navigation, touch targets and screen reader behaviour, with a prioritised fix list.
Guides and recipes that use Web app testing
- Generate Playwright tests with AI agents, then review them
Approve a test plan before any code exists, generate tests from it and review them like production code.
- Run an accessibility audit with an agent
Run an AI accessibility audit against WCAG 2.2 AA with Playwright, axe-core and an agent, add the manual checks scanners miss, and rank fixes by user impact.
- Skill recipe: your test suite conventions
A worked skill that teaches agents your Playwright locator policy, fixtures and assertion rules, so generated tests match your team's and stay stable.
- Playwright
End-to-end testing framework for web apps, with built-in test agents.
- AI in testing
Using AI to plan, generate and maintain tests, and testing AI features themselves.