puppeteer

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

< 22.8.2 is no longer supported
Last updated 7 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 (7 years ago)
  • 1.1.1                                ...           chrome-66 (7 years ago)
  • 1.3.0                                ...           chrome-67 (7 years ago)
  • 1.4.0                                ...           chrome-68 (7 years ago)
  • 1.6.2                                ...           chrome-69 (6 years ago)
  • 1.7.0                                ...           chrome-70 (6 years ago)
  • 1.9.0                                ...           chrome-71 (6 years ago)
  • 1.11.0                                ...           chrome-72 (6 years ago)
  • 1.12.2                                ...           chrome-73 (6 years ago)
  • 1.13.0                                ...           chrome-74 (6 years ago)
  • 1.15.0                                ...           chrome-75 (6 years ago)
  • 1.17.0                                ...           chrome-76 (6 years ago)
  • 1.19.0                                ...           chrome-77 (5 years ago)
  • 1.20.0                                ...           chrome-78 (5 years ago)
  • 2.0.0                                ...           chrome-79 (5 years ago)
  • 2.1.0                                ...           chrome-80 (5 years ago)
  • 3.0.0                                ...           chrome-81 (5 years ago)
  • 3.1.0                                ...           chrome-83 (5 years ago)
  • 5.1.0                                ...           chrome-84 (4 years ago)
  • 5.2.1                                ...           chrome-85 (4 years ago)
  • 5.3.1                                ...           chrome-86 (4 years ago)
  • 23.10.3                                ...           latest (15 days ago)

913 Versions

Downloads
Total 178
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 175
Dependencies (8)
Dev Dependencies (18)

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