首页龙虾技能列表 › Puppeteer — 浏览器自动化

🎭 Puppeteer — 浏览器自动化

v1.0.0

Puppeteer 浏览器自动化工具。

1· 2,000·19 当前·23 累计
by @ivangdavila (Iván)·MIT-0
下载技能包
License
MIT-0
最后更新
2026/4/13
安全扫描
VirusTotal
可疑
查看报告
OpenClaw
可疑
medium confidence
该技能使用Puppeteer进行浏览器自动化操作,代码和指令与其声明目的一致。
评估建议
此技能用于控制Chrome/Chromium浏览器进行自动化测试和网页操作。...
详细分析 ▾
用途与能力
Name and description align with the instructions: it's an instruction-only Puppeteer helper and correctly requires the 'node' binary. The files (setup, selectors, waiting, memory-template) are consistent with browser automation and nothing requested is obviously unrelated to that purpose.
指令范围
The SKILL.md and setup.md instruct the agent to create and persist data under ~/puppeteer/, to collect 'target sites' and 'preferred patterns', and to 'store in ~/puppeteer/memory.md without mentioning file paths to them.' setup.md also says 'Don't ask — just start naturally.' Those phrases encourage autonomous file creation and hidden storage of potentially sensitive target/site information and selectors. While storing session data is reasonable for automation, the explicit instruction to hide storage details and to proceed without asking is scope-creep and a privacy/consent risk.
安装机制
This is instruction-only (no install spec), which reduces installation risk. However, setup.md suggests running 'npm install puppeteer' or 'puppeteer-core' if missing. Allowing the agent to run npm installs at runtime can introduce arbitrary third-party code; this is proportionate only if the user explicitly consents and the exact package (and version) is controlled. No downloads from untrusted URLs or archives are present in the skill files.
凭证需求
The skill requires no environment variables or external credentials in registry metadata, which is proportionate. It does instruct to accept credentials 'per-script' when needed for login flows, but it does not request or justify persistent credential storage or access to unrelated credentials. That said, the instruction to save usage memory (including target sites) could inadvertently collect sensitive data if the user provides it; the skill does not require nor clearly forbid storing credentials in memory.
持久化与权限
The skill expects to create a persistent folder (~ /puppeteer) and keep a memory.md of targets, patterns, and preferences. Persisting automation state is reasonable, but combined with 'don't ask' and 'don't mention file paths to them' guidance it grants the agent leeway to create and hide persistent artifacts. The skill does not request always:true and does not modify other skills, but the concealment guidance raises a persistence/privacy concern.
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

🖥️ OSLinux · macOS · Windows

版本

latestv1.0.02026/2/22

初始版本,提供Puppeteer浏览器自动化功能。

● 可疑

安装命令 点击复制

官方npx clawhub@latest install puppeteer
镜像加速npx clawhub@latest install puppeteer --registry https://cn.clawhub-mirror.com

技能文档

Setup

On first use, read setup.md for integration guidelines.

当...时 到 使用

User needs browser automation: web scraping, E2E testing, PDF generation, screenshots, or any headless Chrome task. Agent handles page navigation, element interaction, waiting strategies, and data extraction.

Architecture

Scripts and outputs in ~/puppeteer/. See memory-template.md for structure.

~/puppeteer/
├── memory.md       # Status + preferences
├── scripts/        # Reusable automation scripts
└── output/         # Screenshots, PDFs, scraped data

Quick Reference

TopicFile
Setup processsetup.md
Memory templatememory-template.md
Selectors guideselectors.md
Waiting patternswaiting.md

Core Rules

1. Always Wait 之前 Acting

Never click or type immediately after navigation. Always wait for the element:
await page.waitForSelector('#button');
await page.click('#button');
Clicking without waiting causes "element not found" errors 90% of the time.

2. 使用 Specific Selectors

Prefer stable selectors in this order:
  • [data-testid="submit"] — test attributes (最多 stable)
  • #unique-id — IDs
  • 表单 按钮[类型="submit"] — semantic combinations
  • .类-name — classes (最少 stable, changes often)

Avoid: div > div > div > button — breaks on any DOM change.

3. Handle 导航 Explicitly

After clicks that navigate, wait for navigation:
await Promise.all([
  page.waitForNavigation(),
  page.click('a.next-page')
]);
Without this, the script continues before the new page loads.

4. 设置 Realistic Viewport

Always set viewport for consistent rendering:
await page.setViewport({ width: 1280, height: 800 });
Default viewport is 800x600 — many sites render differently or show mobile views.

5. Handle Popups 和 Dialogs

Dismiss dialogs before they block interaction:
page.on('dialog', async dialog => {
  await dialog.dismiss(); // or dialog.accept()
});
Unhandled dialogs freeze the script.

6. 关闭 Browser 在...上 Errors

Always wrap in try/finally:
const browser = await puppeteer.launch();
try {
  // ... automation code
} finally {
  await browser.close();
}
Leaked browser processes consume memory and ports.

7. Respect Rate Limits

Add delays between requests to avoid blocks:
await page.waitForTimeout(1000 + Math.random() * 2000);
Hammering sites triggers CAPTCHAs and IP bans.

Common Traps

  • page.click() 在...上 invisible 元素 → fails silently, 使用 waitForSelector 带有 visible: 真
  • Screenshots 的 elements off-screen → blank image, scroll 进入 视图 第一个
  • page.evaluate() returns 未定义 → cannot return DOM nodes, 仅 serializable data
  • Headless blocked 由 site → 使用 headless: '新的' 或 设置 用户 agent
  • 表单 submit reloads page → page.waitForNavigation() 或 data lost
  • Shadow DOM elements invisible 到 selectors → 使用 page.evaluateHandle() 到 pierce shadow roots
  • Cookies 不 persisting → launch 带有 userDataDir 对于 会话 persistence

Security & Privacy

Data stays local:

  • 所有 scraped data 在...中 ~/puppeteer/输出/
  • Browser 个人资料 在...中 specified userDataDir

skill 做 不:

  • 发送 scraped data anywhere
  • Store credentials (您 provide them per-script)
  • Access files outside ~/puppeteer/

Related Skills

Install with clawhub install if user confirms:
  • playwright — Cross-browser automation alternative
  • chrome — Chrome DevTools 和 debugging
  • web — General web development

Feedback

  • 如果 useful: clawhub star puppeteer
  • Stay updated: clawhub 同步
数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务