puppeteer-core
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
@puppeteer/browsers | 1.7.1 | 58.93 kB | Apache-2.0 | prod | |
chromium-bidi | 0.4.26 | 480.99 kB | Apache-2.0 | prod | |
cross-fetch | 4.0.0 | 21.36 kB | MIT | prod | |
debug | 4.3.4 | 12.94 kB | MIT | prod | |
devtools-protocol | 0.0.1159816 | 381.9 kB | BSD-3-Clause | prod peer | |
ws | 8.14.1 | 31.85 kB | MIT | prod |
Puppeteer-core is a Node.js library providing a high-level API to control Chrome or Chromium browsers over the DevTools Protocol. This powerful tool enables you to programmatically manipulate the browser to automate tasks such as form submissions, UI testing, PDF and screenshot generation, server-side rendering for Single-Page Applications (SPAs), and much more. To ensure seamless operation, puppeteer-core doesn't make assumptions about any defaults and will not download Chrome or any other browser upon installation.
Using puppeteer-core in your JavaScript project conveniently affords you the power of full browser automation. First, start by installing puppeteer-core in your project using npm:
npm i puppeteer-core
Once installed, you can start utilizing its functions. Here is a brief example of how to use puppeteer-core to automate a task:
const puppeteer = require('puppeteer-core');
(async () => {
const browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});
const page = await browser.newPage();
await page.goto('https://example.com');
await page.screenshot({path: 'example.png'});
await browser.close();
})();
In this example, we first import the puppeteer-core library. We then launch the browser, open a new page, navigate to an example website, take a screenshot of the page, and finally close the browser.
Remember, for puppeteer-core
, you need to provide the path to the browser executable in the launch
method. The above example also implies that you have already installed a compatible browser in your system.
You can explore the rich features of puppeteer-core further by accessing its complete documentation and API at https://pptr.dev/api. This site provides comprehensive guides, usage examples, and a helpful FAQ section to assist you in making the most of this powerful browser automation library.