
Puppeteer Automation
Automate Chrome/Chromium flows—scraping, screenshots, PDFs, and UI checks—in Node.js with Puppeteer patterns your coding agent can implement reliably.
Install
npx skills add https://github.com/mindrally/skills --skill puppeteer-automationWhat is this skill?
- Async/await Puppeteer patterns with launch options for headless and headful Chrome
- Robust waits, selectors, navigation, screenshots, and PDF generation
- Network interception and page lifecycle handling to limit memory leaks
- Error handling and modular scripts suitable for Jest or Mocha test suites
- Performance and sandbox-oriented launch args for CI and container environments
Adoption & trust: 1.1k installs on skills.sh; 133 GitHub stars; 2/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
Recommended Skills
Journey fit
Browser automation is built when you wire headless Chrome into scrapers, test harnesses, or product workflows—not a journey-wide methodology. Integrations is the canonical shelf for third-party browser control APIs, network interception, and scripted page interaction alongside your app code.
Common Questions / FAQ
Is Puppeteer Automation safe to install?
skills.sh reports 2 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - Puppeteer Automation
# Puppeteer Browser Automation You are an expert in Puppeteer, Node.js browser automation, web scraping, and building reliable automation scripts for Chrome and Chromium browsers. ## Core Expertise - Puppeteer API and browser automation patterns - Page navigation and interaction - Element selection and manipulation - Screenshot and PDF generation - Network request interception - Headless and headful browser modes - Performance optimization and memory management - Integration with testing frameworks (Jest, Mocha) ## Key Principles - Write clean, async/await based code for readability - Use proper error handling with try/catch blocks - Implement robust waiting strategies for dynamic content - Close browser instances properly to prevent memory leaks - Follow modular design patterns for reusable automation code - Handle browser context and page lifecycle appropriately ## Project Setup ```bash npm init -y npm install puppeteer ``` ### Basic Structure ```javascript const puppeteer = require('puppeteer'); async function main() { const browser = await puppeteer.launch({ headless: 'new', args: ['--no-sandbox', '--disable-setuid-sandbox'] }); try { const page = await browser.newPage(); await page.goto('https://example.com'); // Your automation code here } finally { await browser.close(); } } main().catch(console.error); ``` ## Browser Launch Options ```javascript const browser = await puppeteer.launch({ headless: 'new', // 'new' for new headless mode, false for visible browser slowMo: 50, // Slow down operations for debugging devtools: true, // Open DevTools automatically args: [ '--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage', '--disable-accelerated-2d-canvas', '--disable-gpu', '--window-size=1920,1080' ], defaultViewport: { width: 1920, height: 1080 } }); ``` ## Page Navigation ```javascript // Navigate to URL await page.goto('https://example.com', { waitUntil: 'networkidle2', // Wait until network is idle timeout: 30000 }); // Wait options: // - 'load': Wait for load event // - 'domcontentloaded': Wait for DOMContentLoaded event // - 'networkidle0': No network connections for 500ms // - 'networkidle2': No more than 2 network connections for 500ms // Navigate back/forward await page.goBack(); await page.goForward(); // Reload page await page.reload({ waitUntil: 'networkidle2' }); ``` ## Element Selection ### Query Selectors ```javascript // Single element const element = await page.$('selector'); // Multiple elements const elements = await page.$$('selector'); // Wait for element const element = await page.waitForSelector('selector', { visible: true, timeout: 5000 }); // XPath selection const elements = await page.$x('//xpath/expression'); ``` ### Evaluation in Page Context ```javascript // Get text content const text = await page.$eval('selector', el => el.textContent); // Get attribute const href = await page.$eval('a', el => el.getAttribute('href')); // Multiple elements const texts = await page.$$eval('.items', elements => elements.map(el => el.textContent) ); // Execute arbitrary JavaScript const result = await page.evaluate(() => { return document.title; }); ``` ## Page Interactions ### Clicking ```javascript await page.click('button#submit'); // Click with options await page.click('button', { button: 'left', // 'left', 'right', 'middle' clickCount: 1, delay: 100 // Time between mousedown and mouseup }); // Click and wait for navigation await Promise.all([ page.waitForNavigation(), page.click('a.nav-link') ]); ``` ### Typing ```javascript // Type text await page.type('input#username', 'myuser', { delay: 50 }); // Clear and type await page.click('i