puppeteer

A high-level API to control headless Chrome over the DevTools Protocol

< 24.15.0 is no longer supported
Last updated 9 years ago by aslushnikov .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ npm install puppeteer 
SYNC missed versions from official npm registry.

Puppeteer

build npm puppeteer package

Puppeteer is a Node.js library which provides a high-level API to control Chrome/Chromium over the DevTools Protocol. Puppeteer runs in headless mode by default, but can be configured to run in full ("headful") Chrome/Chromium.

Get started | API | FAQ | Contributing | Troubleshooting

Example

import puppeteer from 'puppeteer';

(async () => {
  // 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 screen size
  await page.setViewport({width: 1080, height: 1024});

  // Type into search box
  await page.type('.devsite-search-field', 'automate beyond recorder');

  // Wait and click on first result
  const searchResultSelector = '.devsite-result-item-link';
  await page.waitForSelector(searchResultSelector);
  await page.click(searchResultSelector);

  // Locate the full title with a unique string
  const textSelector = await page.waitForSelector(
    'text/Customize and automate'
  );
  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();
})();

Current Tags

  • 1.0.0                                ...           chrome-65 (9 years ago)
  • 1.1.1                                ...           chrome-66 (9 years ago)
  • 1.3.0                                ...           chrome-67 (9 years ago)
  • 1.4.0                                ...           chrome-68 (9 years ago)
  • 1.6.2                                ...           chrome-69 (8 years ago)
  • 1.7.0                                ...           chrome-70 (8 years ago)
  • 1.9.0                                ...           chrome-71 (8 years ago)
  • 1.11.0                                ...           chrome-72 (8 years ago)
  • 1.12.2                                ...           chrome-73 (8 years ago)
  • 1.13.0                                ...           chrome-74 (8 years ago)
  • 1.15.0                                ...           chrome-75 (8 years ago)
  • 1.17.0                                ...           chrome-76 (8 years ago)
  • 1.19.0                                ...           chrome-77 (7 years ago)
  • 1.20.0                                ...           chrome-78 (7 years ago)
  • 2.0.0                                ...           chrome-79 (7 years ago)
  • 2.1.0                                ...           chrome-80 (7 years ago)
  • 3.0.0                                ...           chrome-81 (7 years ago)
  • 3.1.0                                ...           chrome-83 (7 years ago)
  • 5.1.0                                ...           chrome-84 (6 years ago)
  • 5.2.1                                ...           chrome-85 (6 years ago)
  • 5.3.1                                ...           chrome-86 (6 years ago)
  • 25.16.0                                ...           latest (a month ago)

1013 Versions

Downloads
Total 2,281
Today 152
This Week 187
This Month 179
Last Day 27
Last Week 266
Last Month 1,042
Dependencies (8)
Dev Dependencies (18)

© 2010 - cnpmjs.org x YWFE | Home | YWFE