跳到正文
Skillpedia
测试33k · #9087

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/utilities/browser-automation/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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

repo: davila7/claude-code-templates

热度

GitHub 星标
33k
排名
#9087
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能