
puppeteer
使用Puppeteer(Google)进行浏览器自动化和PDF生成。支持无头Chrome控制,用于网页爬虫、截图、PDF生成和自动化测试。
- Installs
- 125
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/aidotnet/moyucode --skill puppeteer- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads puppeteer automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Puppeteer Tool
Description
Headless Chrome/Chromium automation for PDF generation, screenshots, web scraping, and testing.
Source
- Repository: puppeteer/puppeteer
- License: Apache-2.0
- Maintainer: Google
Installation
npm install puppeteer
Usage Examples
Generate PDF from HTML
import puppeteer from 'puppeteer';
async function generatePDF(html: string, outputPath: string) {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setContent(html, { waitUntil: 'networkidle0' });
await page.pdf({
path: outputPath,
format: 'A4',
margin: { top: '20mm', right: '20mm', bottom: '20mm', left: '20mm' },
printBackground: true,
});
await browser.close();
}
// Usage
const html = `
<html>
<head><style>body { font-family: Arial; }</style></head>
<body><h1>Invoice #001</h1><p>Total: $100.00</p></body>
</html>
`;
await generatePDF(html, 'invoice.pdf');
Take Screenshot
async function takeScreenshot(url: string, outputPath: string) {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setViewport({ width: 1920, height: 1080 });
await page.goto(url, { waitUntil: 'networkidle2' });
await page.screenshot({
path: outputPath,
fullPage: true,
type: 'png',
});
await browser.close();
}
Web Scraping
async function scrapeData(url: string) {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto(url, { waitUntil: 'domcontentloaded' });
const data = await page.evaluate(() => {
const items = document.querySelectorAll('.product');
return Array.from(items).map(item => ({
title: item.querySelector('h2')?.textContent?.trim(),
price: item.querySelector('.price')?.textContent?.trim(),
}));
});
await browser.close();
return data;
}
Form Automation
async function submitForm(url: string, formData: Record<string, string>) {
const browser = await puppeteer.launch({ headless: false });
const page = await browser.newPage();
await page.goto(url);
// Fill form fields
for (const [selector, value] of Object.entries(formData)) {
await page.type(selector, value);
}
// Submit
await page.click('button[type="submit"]');
await page.waitForNavigation();
await browser.close();
}
PDF Options
interface PDFOptions {
path?: string;
scale?: number; // 0.1 - 2, default 1
displayHeaderFooter?: boolean;
headerTemplate?: string;
footerTemplate?: string;
printBackground?: boolean;
landscape?: boolean;
pageRanges?: string; // '1-5, 8, 11-13'
format?: 'Letter' | 'Legal' | 'A4' | 'A3';
width?: string;
height?: string;
margin?: { top, right, bottom, left };
}
Tags
browser, pdf, screenshot, automation, scraping
Compatibility
- Codex: ✅
- Claude Code: ✅
FAQ
What does the puppeteer skill do?
使用Puppeteer(Google)进行浏览器自动化和PDF生成。支持无头Chrome控制,用于网页爬虫、截图、PDF生成和自动化测试。
How do I install puppeteer?
Run npx skills add https://github.com/aidotnet/moyucode --skill puppeteer in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/puppeteer/ (personal) or .claude/skills/puppeteer/ (project).
Which AI agents can use puppeteer?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is puppeteer safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains puppeteer?
It is published by aidotnet in aidotnet/moyucode. It has 125 recorded installs.
More from aidotnet/moyucode
exceljs
aidotnet/moyucode
在Node.js中读取、操作和写入Excel电子表格(XLSX)。完全支持样式、公式、图表和大文件流式处理。
nodemailer
aidotnet/moyucode
从Node.js应用发送邮件。最流行的邮件发送模块,支持SMTP、OAuth2、附件和HTML模板。
excel-handler
aidotnet/moyucode
读取、写入和操作Excel文件(.xlsx、.xls)。创建电子表格、读取数据并导出为各种格式。
Popular docs & writing skills
grill-with-docs
mattpocock/skills
A relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.
lark-markdown
open.feishu.cn
飞书 Markdown:查看、创建、上传、编辑和比较飞书中的原生 Markdown 文件。当用户要操作飞书 Markdown 文件,或比较其远端版本及本地草稿时使用。纯本地 Markdown 文件操作不触发本 skill。不负责将 Markdown 导入为飞书在线文档,也不负责文件搜索、权限、评论、移动、删除等云空间管理操作。
writing-beats
mattpocock/skills
Writing, exploit; assemble raw material into a journey of beats, grounding each term before a beat leans on it.
writing-shape
mattpocock/skills
Writing, exploit: shape raw material into an article, paragraph by paragraph.
writing-fragments
mattpocock/skills
Writing, explore: mine raw fragments, no structure yet.
writing-for-agents
mattpocock/skills
Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.