Iván

Puppeteer

開發程式設計v1.0.0
作者:Iván更新於 2026-05-17puppeteer@clawhub_ivangdavila/puppeteer
測試生成指令碼工具#Browser

據 AlphaMoat 統計,截至 2026-09,Puppeteer 累計下載 3,780 次、獲 2 個星標,在全部 5,078 個 AI 技能中排名第 2,801 位,在「開發程式設計」分類(577 個)中排名第 364 位。

累計安裝
127
累計下載
3780
星標
2
全站排名
#2,801
全站前 56% · 「開發程式設計」前 64%
平台累計安裝累計下載星標評論
ClawHub ↗12137151-
SkillHub ↗12737802—

各平台的計數口徑不同,統計時間不一致。

這個技能是做什麼的

可用於網頁抓取、端到端測試、截圖、PDF 生成、頁面導航、元素互動和資料提取。首次使用應先閱讀整合指南;執行前確認目標網站、登入狀態和允許執行的操作,避免訪問或操作未授權資料。 儲存工作流記憶前須取得同意,不儲存憑據或私密瀏覽資訊,不使用反檢測指導。

資料釋出於 2026-10-29

可以用來做什麼

  • 自動化瀏覽器頁面互動
  • 執行測試並生成截圖或 PDF
  • 從網頁提取結構化資訊

什麼時候用

  • 需要自動化 Chrome/Chromium 瀏覽器任務時
  • 執行前檢查整合指南、目標站點、會話許可權和可能產生的副作用

示例提示詞

以下是根據技能文件生成的示例,不代表實際執行結果。

用 Puppeteer 自動化一個獲准頁面的檢查,並列出啟動前應確認的許可權與副作用。

月度資料趨勢

累計下載3780
1913291639182026-03 · 累計下載 20512026-05 · 累計下載 29532026-07 · 累計下載 34552026-08 · 累計下載 36012026-09 · 累計下載 378026-0326-09
星標2
1222026-03 · 星標 12026-05 · 星標 22026-07 · 星標 22026-08 · 星標 22026-09 · 星標 226-0326-09

2026-09 起統計方法調整:同名技能按作者分別統計,並覆蓋全部技能。圖中虛線為調整前的月份,與之後的資料不直接比較,也不計算跨越調整的增長。

月份累計下載環比星標
2026-093780—2
2026-083601+4.2%2
2026-073455—2
2026-052953—2
2026-032051—1

SKILL.md 原文

以下是作者釋出的原始檔案,按純文字顯示,本站未做修改或稽核;其中的連結不可點選,命令請核實後再執行。抓取於 2026-10-23。

4.0 KB · ClawHub v1.0.0
---
name: Puppeteer
slug: puppeteer
version: 1.0.0
homepage: https://clawic.com/skills/puppeteer
description: Automate Chrome and Chromium with Puppeteer for scraping, testing, screenshots, and browser workflows.
metadata: {"clawdbot":{"emoji":"🎭","requires":{"bins":["node"]},"os":["linux","darwin","win32"]}}
---

## Setup
展開全部(共 133 行)

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

## When to Use

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

| Topic | File |
|-------|------|
| Setup process | `setup.md` |
| Memory template | `memory-template.md` |
| Selectors guide | `selectors.md` |
| Waiting patterns | `waiting.md` |

## Core Rules

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

### 2. Use Specific Selectors
Prefer stable selectors in this order:
1. `[data-testid="submit"]` — test attributes (most stable)
2. `#unique-id` — IDs
3. `form button[type="submit"]` — semantic combinations
4. `.class-name` — classes (least stable, changes often)

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

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

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

### 5. Handle Popups and Dialogs
Dismiss dialogs before they block interaction:
```javascript
page.on('dialog', async dialog => {
  await dialog.dismiss(); // or dialog.accept()
});
```
Unhandled dialogs freeze the script.

### 6. Close Browser on Errors
Always wrap in try/finally:
```javascript
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:
```javascript
await page.waitForTimeout(1000 + Math.random() * 2000);
```
Hammering sites triggers CAPTCHAs and IP bans.

## Common Traps

- `page.click()` on invisible element → fails silently, use `waitForSelector` with `visible: true`
- Screenshots of elements off-screen → blank image, scroll into view first
- `page.evaluate()` returns undefined → cannot return DOM nodes, only serializable data
- Headless blocked by site → use `headless: 'new'` or set user agent
- Form submit reloads page → `page.waitForNavigation()` or data is lost
- Shadow DOM elements invisible to selectors → use `page.evaluateHandle()` to pierce shadow roots
- Cookies not persisting → launch with `userDataDir` for session persistence

## Security & Privacy

**Data that stays local:**
- All scraped data in ~/puppeteer/output/
- Browser profile in specified userDataDir

**This skill does NOT:**
- Send scraped data anywhere
- Store credentials (you provide them per-script)
- Access files outside ~/puppeteer/

## Related Skills
Install with `clawhub install <slug>` if user confirms:
- `playwright` — Cross-browser automation alternative
- `chrome` — Chrome DevTools and debugging
- `web` — General web development

## Feedback

- If useful: `clawhub star puppeteer`
- Stay updated: `clawhub sync`

「開發程式設計」分類下的熱門技能

Iván 的其他技能

資料月份:2026-09 · 下載/星標/安裝數聚合自公開技能註冊庫(ClawHub、SkillHub),按月更新。口徑說明見資料方法。