Table of contents

What are the prerequisites for using Puppeteer?

Puppeteer is a Node.js library that provides a high-level API to control Chrome or Chromium over the DevTools Protocol. Puppeteer runs headless by default but can be configured to run full (non-headless) Chrome or Chromium.

Here are the prerequisites you need to fulfill before using Puppeteer:

  1. Node.js: Puppeteer is a Node library. To use Puppeteer, you need to have Node.js installed on your machine. You can download Node.js from its official website. Node.js version 10.18.1 or above is recommended for Puppeteer.

  2. npm (Node Package Manager): npm is bundled and installed automatically with Node.js. You will use npm to install Puppeteer.

  3. Chrome or Chromium Browser: Although Puppeteer downloads a version of Chromium by default, you may prefer to use a full version of Chrome. You can download Chrome from its official website.

  4. Understanding of JavaScript: Since Puppeteer is a JavaScript library, having a basic knowledge of JavaScript is required.

Once you have all these prerequisites, you can install Puppeteer using npm.

Here is an example of how to install puppeteer:

npm i puppeteer

This command installs Puppeteer and also downloads a recent version of Chromium, a version of Chrome that Puppeteer controls.

If you want to use Puppeteer with a different version of Chrome or Chromium, you can use the PUPPETEER_EXECUTABLE_PATH environment variable to point to a different browser binary location.

Here is an example:

PUPPETEER_EXECUTABLE_PATH=/usr/bin/google-chrome npm i puppeteer

This command tells Puppeteer to use the Chrome browser located at /usr/bin/google-chrome when running scripts.

Remember, Puppeteer scripts are written in JavaScript, so you'll need to have a basic understanding of JavaScript to write scripts that control the browser.

Try WebScraping.AI for Your Web Scraping Needs

Looking for a powerful web scraping solution? WebScraping.AI provides an LLM-powered API that combines Chromium JavaScript rendering with rotating proxies for reliable data extraction.

Key Features:

  • AI-powered extraction: Ask questions about web pages or extract structured data fields
  • JavaScript rendering: Full Chromium browser support for dynamic content
  • Rotating proxies: Datacenter and residential proxies from multiple countries
  • Easy integration: Simple REST API with official SDKs for Python, JavaScript, PHP, Ruby, Go, Java, and C#/.NET — plus an MCP server for AI assistants
  • Reliable & scalable: Built for developers who need consistent results

Getting Started:

Get page content with AI analysis:

curl "https://api.webscraping.ai/ai/question?url=https://example.com&question=What is the main topic?&api_key=YOUR_API_KEY"

Extract structured data:

curl "https://api.webscraping.ai/ai/fields?url=https://example.com&fields[title]=Page title&fields[price]=Product price&api_key=YOUR_API_KEY"

Try in request builder

📖 Related Blog Guides

Expand your knowledge with these comprehensive tutorials:

Web Scraping with JavaScript

Complete JavaScript scraping guide including Puppeteer

JavaScript Scraping Libraries

Compare Puppeteer with other JavaScript tools

Get Started Now

WebScraping.AI provides rotating proxies, Chromium rendering and built-in HTML parser for web scraping
Icon