puppeteer
TypeScript icon, indicating that this package has built-in type declarations

25.1.0 • Public • Published

Puppeteer

build npm puppeteer package

Puppeteer is a JavaScript library which provides a high-level API to control Chrome or Firefox over the DevTools Protocol or WebDriver BiDi. Puppeteer runs in the headless (no visible UI) by default

Installation

npm i puppeteer # Downloads compatible Chrome during installation.
npm i puppeteer-core # Alternatively, install as a library, without downloading Chrome.

MCP

Install chrome-devtools-mcp, a Puppeteer-based MCP server for browser automation and debugging.

Puppeteer also supports the experimental WebMCP API.

Example

import puppeteer from 'puppeteer';
// Or import puppeteer from 'puppeteer-core';

// Launch the browser and open a new blank page.
const browser = await puppeteer.launch();
const page = await browser.newPage();

// Navigate the page to a URL.
await page.goto('https://developer.chrome.com/');

// Set the screen size.
await page.setViewport({width: 1080, height: 1024});

// Open the search menu using the keyboard.
await page.keyboard.press('/');

// Type into search box using accessible input name.
await page.locator('::-p-aria(Search)').fill('automate beyond recorder');

// Wait and click on first result.
await page.locator('.devsite-result-item-link').click();

// Locate the full title with a unique string.
const textSelector = await page
  .locator('::-p-text(Customize and automate)')
  .waitHandle();
const fullTitle = await textSelector?.evaluate(el => el.textContent);

// Print the full title.
console.log('The title of this blog post is "%s".', fullTitle);

await browser.close();

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
25.1.0
976,660latest

Version History

VersionDownloads (Last 7 Days)Published
25.1.0
976,660
25.0.4
109,295
25.0.3
4,033
25.0.2
95,921
24.43.1
1,277,669
24.43.0
98,321
24.42.0
521,552
24.41.0
118,802
24.40.0
441,378
24.39.1
122,737
24.39.0
30,042
24.38.0
135,642
24.37.5
177,831
24.37.4
11,728
24.37.3
41,859
24.37.2
67,101
24.37.1
19,133
24.37.0
8,079
24.36.1
107,704
24.36.0
44,868
24.35.0
92,668
24.34.0
129,934
24.33.1
14,859
24.33.0
69,775
24.32.1
43,595
24.32.0
68,388
24.31.0
485,445
24.30.0
53,344
24.29.1
30,195
24.29.0
14,189
24.28.0
7,562
24.27.0
18,680
24.26.1
20,237
24.26.0
6,068
24.25.0
39,824
24.24.15,664
24.24.07,683
24.23.12,920
24.23.042,884
24.22.339,208
24.22.25,213
24.22.1822
24.22.029,136
24.21.09,182
24.20.012,146
24.19.090,712
24.18.07,064
24.17.17,970
24.17.020,291
24.16.224,036
24.16.110,948
24.16.067,835
24.15.080,822