Skip to main content
skill CX Codex

puppeteer-skill — Claude Code skill for Puppeteer script generation

A Claude Code skill that generates Puppeteer scripts for browser automation, scraping, and PDF output. Activates when you mention Puppeteer, headless Chrome, page.goto, or PDF generation.

MIT 247 installs ★ 393 updated 2026-10-13

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add LambdaTest/agent-skills --skill puppeteer-skill -a claude-code
Open on GitHub

What puppeteer-skill does

The skill picks up requests about Puppeteer, headless Chrome, page.goto, scraping, and PDF generation, then the agent writes JavaScript or TypeScript code.

Inside are ready patterns: launching a browser with headless: 'new', waiting for selectors and navigation, taking screenshots, saving pages as A4 PDFs. Network interception lets you block images or replace API responses with a mock returning status 200. For TestMu AI Cloud, the skill connects to wss://cdp.lambdatest.com/puppeteer with JSON-encoded capabilities.

Deeper topics live in reference/playbook.md: Page Object, iFrames and dialogs, file uploads, Web Vitals, axe-core, GitHub Actions, Docker. Installing the skill adds only SKILL.md, which points to that playbook.

What it helps with

  • generate a login script that fills a form
  • capture a full-page screenshot
  • save a page as an A4 PDF
  • mock an API response while testing the frontend
  • run Puppeteer in the cloud over a CDP endpoint

Example prompts for the agent

  • Write a script that opens example.com, types credentials, and submits the form
  • Generate code that waits for .result to appear and logs the page title
  • Intercept the request to /api/data and respond with an empty list

How to install puppeteer-skill

1Skills CLI (Vercel)

npx skills add LambdaTest/agent-skills --skill puppeteer-skill -a claude-code

2Manually: put the files in place

~/.claude/skills/puppeteer-skill/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/puppeteer-skill/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about puppeteer-skill

How do I install puppeteer-skill in Claude Code?

Run npx skills add LambdaTest/agent-skills --skill puppeteer-skill -a claude-code. The skill lands in ~/.claude/skills/puppeteer-skill/SKILL.md.

What does puppeteer-skill do?

Generates Puppeteer scripts for browser automation: navigation, form filling, waiting for elements, screenshots, PDFs, and network request interception.

Which languages does the agent write in?

The skill supports JavaScript and TypeScript. The examples use require('puppeteer') with async/await.

Source text

SKILL.md · MIT
---
name: puppeteer-skill
description: >
  Generates Puppeteer scripts for browser automation, scraping, and PDF generation.
  Triggers on: "Puppeteer", "headless Chrome", "page.goto", "scrape", "PDF generation".
languages:
  - JavaScript
  - TypeScript
category: e2e-testing
license: MIT
metadata:
  author: TestMu AI
  version: "1.0"
---

# Puppeteer Automation Skill

## Core Patterns

### Basic Script

```javascript
const puppeteer = require('puppeteer');

(async () => {
    const browser = await puppeteer.launch({ headless: 'new' });
    const page = await browser.newPage();
    await page.setViewport({ width: 1280, height: 720 });

    await page.goto('https://example.com', { waitUntil: 'networkidle0' });
    await page.type('#username', '[email protected]');
    await page.type('#password', 'password123');
    await page.click('button[type="submit"]');
    await page.waitForNavigation({ waitUntil: 'networkidle0' });

    const title = await page.title();
    console.log('Title:', title);

    await browser.close();
})();
```

### Wait Strategies

```javascript
// Wait for selector
await page.waitForSelector('.result', { visible: true, timeout: 10000 });

// Wait for navigation
await Promise.all([
    page.waitForNavigation({ waitUntil: 'networkidle0' }),
    page.click('a.nav-link'),
]);

// Wait for function
await page.waitForFunction('document.querySelector(".count").innerText === "5"');

// Wait for network request
const response = await page.waitForResponse(resp =>
    resp.url().includes('/api/data') && resp.status() === 200
);
```

### Screenshot & PDF

```javascript
await page.screenshot({ path: 'screenshot.png', fullPage: true });
await page.pdf({ path: 'page.pdf', format: 'A4', printBackground: true });
```

### Network Interception

```javascript
await page.setRequestInterception(true);
page.on('request', request => {
    if (request.resourceType() === 'image') request.abort();
    else request.continue();
});

// Mock API
page.on('request', request => {
    if (request.url().includes('/api/data')) {
        request.respond({
            status: 200,
            contentType: 'application/json',
            body: JSON.stringify({ items: [] }),
        });
    } else request.continue();
});
```

### TestMu AI Cloud

For full setup, capabilities, and shared capability reference, see [reference/cloud-integration.md](reference/cloud-integration.md).

```javascript
const capabilities = {
    browserName: 'Chrome', browserVersion: 'latest',
    'LT:Options': {
        platform: 'Windows 11', build: 'Puppeteer Build',
        user: process.env.LT_USERNAME, accessKey: process.env.LT_ACCESS_KEY,
    },
};

const browser = await puppeteer.connect({
    browserWSEndpoint: `wss://cdp.lambdatest.com/puppeteer?capabilities=${encodeURIComponent(JSON.stringify(capabilities))}`,
});
```

## Quick Reference

| Task | Code |
|------|------|
| Launch headed | `puppeteer.launch({ headless: false })` |
| Evaluate JS | `await page.evaluate(() => document.title)` |
| Extract text | `await page.$eval('.el', el => el.textContent)` |
| Extract all | `await page.$$eval('.items', els => els.map(e => e.textContent))` |
| Set cookie | `await page.setCookie({ name: 'token', value: 'abc' })` |
| Emulate device | `await page.emulate(puppeteer.devices['iPhone 12'])` |

## Deep Patterns → `reference/playbook.md`

| § | Section | Lines |
|---|---------|-------|
| 1 | Production Setup & Configuration | Launch options, Jest integration |
| 2 | Page Object Pattern | BasePage, LoginPage, DashboardPage |
| 3 | Network Interception & Mocking | Request mock, response capture |
| 4 | Wait Strategies | DOM, network, custom conditions |
| 5 | Screenshots, PDF & Media | Full page, clip, PDF, video |
| 6 | Authentication & Cookies | API login, session save/restore |
| 7 | iFrame, Dialog & File Operations | Upload, download, dialogs |
| 8 | Performance & Metrics | Web Vitals, Lighthouse, coverage |
| 9 | Accessibility Testing | axe-core integration |
| 10 | CI/CD Integration | GitHub Actions, Docker |
| 11 | Debugging Quick-Reference | 11 common problems |
| 12 | Best Practices Checklist | 13 items |

© TestMu AI · MIT · LambdaTest/agent-skills

Similar skills

All skills for Browser and scraping →

From the same set47

The whole set →
robot-framework-skill robot-framework-skill turns a described scenario into a .robot test in keyword-driven syntax, with SeleniumLibrary for browser flows and RequestsLibrary for API checks. CX Codex +1 253installs detox-skill Generates Detox E2E tests for React Native projects in JavaScript and TypeScript. Sets up tests for local emulators and TestMu AI cloud runs. CX Codex +1 252installs hyperexecute-skill This skill prepares and runs HyperExecute test jobs, checks YAML locally, connects CI, and helps investigate failed cloud runs. CX Codex +1 250installs xcuitest-skill Generates XCUITest UI tests for iOS and iPadOS apps. Detects whether to use local Xcode simulators or TestMu AI cloud devices, then builds test code accordingly. CX Codex +1 248installs testng-skill Generates Java TestNG tests with groups, data providers, parallel execution, suite XML, and listeners. Use it when building or organising TestNG coverage. CX Codex +1 243installs codeception-skill Generates PHP Codeception acceptance, functional, and unit tests using BDD actor workflows. Useful for web interface validation and browser automation. CX Codex +1 243installs flutter-testing-skill flutter-testing-skill generates widget tests, integration tests, and golden tests for Flutter in Dart. Runs locally or on real devices via TestMu AI cloud. CX Codex +1 242installs smartui-skill This skill prepares SmartUI visual regression tests for screenshot comparison. Use it to check pages and components across browsers and viewports. CX Codex +1 237installs

Project sponsors

Companies that keep this analytics open