# Web 应用测试 (webapp-testing)

> 编写原生 Python Playwright 脚本测试本地 Web 应用，可截图、查看浏览器日志并验证前端功能。

- 分类: [测试与调试](https://www.myskills.tools/zh/categories/testing-debugging/)
- 来源: 官方 · Anthropic
- 代码仓库: https://github.com/anthropics/skills/tree/main/skills/webapp-testing (commit b9e19e6)
- SKILL.md: https://github.com/anthropics/skills/blob/main/skills/webapp-testing/SKILL.md
- 安装命令: `npx skills add anthropics/skills --skill webapp-testing`
- 许可证: Apache-2.0
- 兼容工具: Claude Code
- 权限: read-repo ✓, write-files ✓, shell ✓, network ✗
- 状态: 扫描通过
- 规则扫描无法覆盖所有风险，安装前请阅读此技能的 SKILL.md，确认权限后再使用。

## 核心规则

在动态应用上检查 DOM 之前，必须先等待 networkidle。

## 执行阶段

1. **选择方式** — 静态 HTML 直接读文件找选择器；动态应用则先看服务器是否已在运行。
2. **启动服务** — 先运行 scripts/with_server.py --help，再用它启动一个或多个服务并运行自动化脚本。
3. **侦察页面** — 打开页面并等待 networkidle，截图或检查渲染后的 DOM，从中找出选择器。
4. **执行操作** — 在无头 Chromium 中用找到的选择器执行操作，必要时记录控制台日志，结束后关闭浏览器。

## 权限说明（据 SKILL.md 整理）

| 能力 | 是否需要 | 说明 |
|---|---|---|
| 文件写入 | 需要 | 编写 Playwright 自动化脚本，并把截图保存到本地。 |
| 命令执行 | 部分需要 | 运行 Python Playwright 脚本，并用 with_server.py 启动本地服务。 |
| 网络外发 | 不需要 | 只访问本地运行的应用（localhost 或 file://），不访问外部网络。 |

## SKILL.md 头部信息（YAML）

```yaml
---
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
---
```

首页: https://www.myskills.tools/zh/ · URL: https://www.myskills.tools/zh/skills/webapp-testing/
