browser-automation
它能做什么
这项技能指导你的智能体使用 Playwright 和 Puppeteer 编写不易出错的浏览器自动化脚本。适合测试或自动化网站的开发人员和质量保证团队。
适用场景
- ✓想为网站编写不易失效的端到端测试的时候。
- ✓需要抓取网页,或在智能体任务中控制浏览器的时候。
- ✓浏览器测试时好时坏,想改进选择器和等待策略的时候。
技能链接
https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/utilities/browser-automation/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我为我们的结账页面编写一个可靠的 Playwright 测试,不要依赖固定的超时时间。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体在 Playwright 中使用面向用户的定位器和自动等待,并让每个测试相互独立,从而让测试更可靠。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Browser Automation
You are a browser automation expert who has debugged thousands of flaky tests and built scrapers that run for years without breaking. You've seen the evolution from Selenium to Puppeteer to Playwright and understand exactly when each tool shines.
Your core insight: Most automation failures come from three sources - bad selectors, missing waits, and detection systems. You teach people to think like the browser, use the right selectors, and let Playwright's auto-wait do its job.
For scraping, yo
Capabilities
- browser-automation
- playwright
- puppeteer
- headless-browsers
- web-scraping
- browser-testing
- e2e-testing
- ui-automation
- selenium-alternatives
Patterns
Test Isolation Pattern
Each test runs in complete isolation with fresh state
User-Facing Locator Pattern
Select elements the way users see them
Auto-Wait Pattern
Let Playwright wait automatically, never add manual waits
Anti-Patterns
❌ Arbitrary Timeouts
❌ CSS/XPath First
❌ Single Browser Context for Everything
⚠️ Sharp Edges
| Issue | Severity | Solution |
|---|---|---|
| Issue | critical | # REMOVE all waitForTimeout calls |
| Issue | high | # Use user-facing locators instead: |
| Issue | high | # Use stealth plugins: |
| Issue | high | # Each test must be fully isolated: |
| Issue | medium | # Enable traces for failures: |
| Issue | medium | # Set consistent viewport: |
| Issue | high | # Add delays between requests: |
| Issue | medium | # Wait for popup BEFORE triggering it: |
Related Skills
Works well with: agent-tool-builder, workflow-automation, computer-use-agents, test-architect
常见问题
浏览器测试为什么会不稳定?
该技能说明,大多数失败来自糟糕的选择器、缺少等待,以及检测机制。
它也涵盖 Puppeteer 吗?
涵盖。该技能推荐 Playwright,同时也涵盖 Puppeteer。
它只用于测试吗?
不是。它也涵盖抓取和由智能体驱动的浏览器控制。
详情
作者的原始描述
Browser automation powers web testing, scraping, and AI agent interactions. The difference between a flaky script and a reliable system comes down to understanding selectors, waiting strategies, and anti-detection patterns. This skill covers Playwright (recommended) and Puppeteer, with patterns for testing, scraping, and agentic browser control. Key insight: Playwright won the framework war. Unless you need Puppeteer's stealth ecosystem or are Chrome-only, Playwright is the better choice in 202
热度
- GitHub 星标
- 33k
- 排名
- #9087
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
owasp-security
33k教你的智能体掌握面向网页应用、API、移动端、容器和 AI 智能体的 OWASP 安全指南,以便发现常见弱点并提出修复建议。
agent-management
33k让你的智能体使用 AI Maestro 命令行工具创建、列出、休眠、唤醒、重命名和删除 AI 智能体,管理每个智能体的生命周期。
agent-messaging
33k让你的智能体使用智能体消息协议,在 AI 智能体之间发送、接收和回复带签名的消息,大部分在你自己的电脑上完成。
docs-search
33k让你的智能体搜索自动生成的代码文档,查找函数签名、类定义和注释,从而在修改代码之前核对真实的 API。