
webapp-testing
Skill用 Python Playwright 脚本驱动本地 Web 应用做功能验证、界面调试、截图与浏览器日志查看,自带管理开发服务器启停的辅助脚本。Anthropic 官方技能。
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:
python scripts/with_server.py --server "npm run dev" --port 5173 -- python your_automation.py
Multiple servers (e.g., backend + frontend):
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):
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
-
Inspect rendered DOM:
page.screenshot(path='/tmp/inspect.png', full_page=True) content = page.content() page.locator('button').all() -
Identify selectors from inspection results
-
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--helpto 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()orpage.wait_for_timeout()
Reference Files
- examples/ - Examples showing common patterns:
element_discovery.py- Discovering buttons, links, and inputs on a pagestatic_html_automation.py- Using file:// URLs for local HTMLconsole_logging.py- Capturing console logs during automation
相關資源

Playwright
CLI微软官方的跨浏览器端到端测试框架:一套 API 驱动 Chromium、Firefox 与 WebKit,npx playwright test 并行隔离跑测,自带自动等待与 Trace 回放排查失败。
microsoft/playwright97.5k
Playwright MCP
MCP让 agent 通过无障碍树操作真实浏览器:导航、点击、填表、截图,不依赖视觉模型。微软官方维护。
microsoft/playwright-mcp38.1k
Playwright Skill
Plugin让 agent 现写现跑 Playwright 脚本完成浏览器自动化:页面测试、UX 校验、多步流程,默认弹出可见浏览器并自动探测本地开发服务器。插件安装后需在技能目录执行 npm run setup。
lackeyjb/playwright-skill3.2k
Playwright CLI
SkillPlaywright 官方 CLI 的配套技能:用简短命令打开页面、点击填表、快照与截图,也能编写和调试 Playwright 测试,比 MCP 方式更省上下文。微软官方维护,需要 Node.js。
microsoft/playwright-cli13.6k
Frontend Testing Debugging
Skill测试与调试本地运行的前端页面:优先用 Codex 的 Browser 插件、没有则用 Playwright,检查空白页、框架报错与控制台错误,截图取证,改完重载复查并输出 QA 报告。OpenAI 官方维护,原 openai/skills 中的 playwright-interactive。
openai/plugins7.2k
Playwright Skill
Skill让 agent 即时编写并执行 Playwright 脚本完成浏览器测试与自动化:自动探测本地开发服务器,支持截图、响应式检查、登录流程与链接检查。安装后需在技能目录运行 npm run setup。
lackeyjb/playwright-skill3.2k