puppeteer
Skill15 starsChanged 46 days agoMITView on GitHub
Expert Puppeteer automation covering headless Chrome, PDF generation, web scraping, and performance tracing. Use when generating screenshots/PDFs, automating browser interactions, or crawling JavaScript web apps.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- pencil20388-eng/browser-automation-skillstheir own version, first seen May 22, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- pencil20388-eng/browser-automation-skills★ 5same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository350 other files it gives its agents.
- airflowSkill
- catboostSkill
- claudeSkill
- comfyuiSkill
- cursor-aiSkill
- dalleSkill
- daskSkill
- dbtSkill
- deepseekSkill
- fastaiSkill
- geminiSkill
- github-copilotSkill
- huggingfaceSkill
- jaxSkill
- jupyterSkill
- kerasSkill
- langchainSkill
- lightgbmSkill
- llamaindexSkill
- llamaSkill
- matplotlibSkill
- midjourneySkill
- mistralSkill
- mlflowSkill
- nltkSkill
- numpySkill
- ollamaSkill
- openai-gptSkill
- opencvSkill
- pandasSkill
- perplexitySkill
- plotlySkill
- polarsSkill
- pytorchSkill
- raySkill
- scikit-learnSkill
- seabornSkill
- spacySkill
- sparkSkill
- stable-diffusionSkill
- tensorflowSkill
- vaexSkill
- weights-biasesSkill
- whisperSkill
- xgboostSkill
- api-gatewaySkill
- clean-architectureSkill
- cqrsSkill
- domain-driven-designSkill
- event-drivenSkill
- event-sourcingSkill
- graphqlSkill
- grpcSkill
- hexagonalSkill
- microservicesSkill
- modular-monolithSkill
- monolithSkill
- rest-apiSkill
- sagaSkill
- serverlessSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 108
Use headless: 'new': Leverage Chrome's modern native headless mode for identical rendering to headful Chrome.
- Very specific: line 109
Always Close Browsers in finally Blocks: Wrap browser actions in try/finally to prevent orphaned Chrome zombie processes.
- Very specific: line 111
Use waitUntil: 'networkidle0' for SPAs: Ensure all client-side JavaScript hydration requests finish before taking screenshots.
- Distinctive: line 117
Run Chrome as root without sandboxing precautions: Follow secure Docker non-root user setup guidelines.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Puppeteer
Puppeteer is a Node library which provides a high-level API to control Chrome or Chromium over the DevTools Protocol.
When to Use
- Headless Chrome Automation & Scraping: High-performance headless browser control for web scraping, automation, and crawling.
- Server-Side PDF & Screenshot Generation: Rendering HTML templates into pixel-perfect PDFs and high-resolution screenshots.
- Single-Page App Prerendering: Pre-rendering client-side SPAs into static HTML for SEO indexing.
- Chrome DevTools Protocol (CDP) Access: Tapping directly into raw Chrome DevTools Protocol events, performance profiling, and heap snapshots.
Quick Start
import puppeteer from "puppeteer";
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto("https://developer.chrome.com/");
await page.pdf({ path: "dv.pdf", format: "A4" });
await browser.close();
})();Core Concepts
Browser & Page Architecture over CDP
Puppeteer manages Chrome processes over WebSocket connections using the Chrome DevTools Protocol:
import puppeteer from "puppeteer";
const browser = await puppeteer.launch({
headless: "new",
args: ["--no-sandbox", "--disable-setuid-sandbox"],
});
const page = await browser.newPage();
await page.setViewport({ width: 1920, height: 1080 });
await page.goto("https://example.com", { waitUntil: "networkidle0" });PDF Generation with CSS Print Styles
Renders printable documents directly from HTML:
await page.pdf({
path: "invoice.pdf",
format: "A4",
printBackground: true,
margin: { top: "20mm", bottom: "20mm", left: "15mm", right: "15mm" },
});Page Evaluation in Browser Context
Executes JavaScript inside the browser context and serializes results back to Node:
const articleTitles = await page.evaluate(() => {
return Array.from(document.querySelectorAll("h2.article-title")).map((el) =>
el.textContent?.trim(),
);
});
console.log("Scraped Titles:", articleTitles);Common Patterns
PDF Generation with Clean Print Styles
Problem: Screen styles and dynamic elements render poorly when converting web pages to PDFs.
Solution: Emulate print media before generating high-res PDF:
import puppeteer from "puppeteer";
async function generateInvoicePdf(url, outputPath) {
const browser = await puppeteer.launch({ headless: "new" });
const page = await browser.newPage();
await page.goto(url, { waitUntil: "networkidle0" });
await page.emulateMediaType("print");
await page.pdf({
path: outputPath,
format: "A4",
printBackground: true,
margin: { top: "20mm", bottom: "20mm", left: "15mm", right: "15mm" },
});
await browser.close();
}Best Practices
Do:
- Use
headless: 'new': Leverage Chrome's modern native headless mode for identical rendering to headful Chrome. - Always Close Browsers in
finallyBlocks: Wrap browser actions intry/finallyto prevent orphaned Chrome zombie processes. - Block Unnecessary Assets during Scraping: Block images, fonts, and tracking scripts via
page.setRequestInterception(true)to speed up scraping 3-5x. - Use
waitUntil: 'networkidle0'for SPAs: Ensure all client-side JavaScript hydration requests finish before taking screenshots.
Don't:
- Pass raw browser DOM elements back to Node: Serialize return values to JSON or extract primitive values inside
page.evaluate(). - Launch a new browser instance for every request: Reuse a single browser instance and create/close lightweight
pagecontexts. - Run Chrome as root without sandboxing precautions: Follow secure Docker non-root user setup guidelines.
Troubleshooting
| Error | Cause | Solution |
Error: Failed to launch the browser process! | Missing shared library dependencies (libnss3, libasound2) in Linux environment. | Install required dependencies or use chrome-aws-lambda in serverless. |
Execution context was destroyed, most likely because of a navigation | Attempting to interact with an element after page redirected. | Re-query locator after page.waitForNavigation() resolves. |
TimeoutError: Navigation timeout of 30000 ms exceeded | Network request still open preventing networkidle0. | Use networkidle2 or set custom timeout in page.goto(url, { timeout: 60000 }). |
References
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

