Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Puppeteer when the content you need depends on browser-side JavaScript or interaction: it can launch Chrome or Firefox, navigate to a page, wait for content, interact with it, and extract the result. For static pages, a direct HTTP request may be simpler. Puppeteer is a browser automation library—not permission to collect a site’s data.

What Puppeteer does—and when to use it

The Puppeteer project describes it as a JavaScript library with a high-level API for controlling Chrome or Firefox over the DevTools Protocol or WebDriver BiDi. It runs headless by default. That makes it useful when a page renders data in the browser or exposes it only after an interaction, but it does not mean every site needs a browser-based scraper. See the Puppeteer project overview.

A scraper built with Puppeteer is a program you write using browser automation APIs. You decide which pages to visit, what to wait for, what to extract, and how to validate and store the results.

Choose and install the package

Pick the package based on who manages the browser installation:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Package Browser setup Best fit Operational note
puppeteer Downloads a compatible Chrome during installation. You want Puppeteer to manage its browser setup. If an installation script is blocked, the browser may not be downloaded. The official documentation describes npx puppeteer browsers install as a manual installation route.
puppeteer-core Does not download Chrome as part of installing the library. You manage and configure a browser separately. You must provide the browser and configure Puppeteer to use it.

These are the install paths documented by the Puppeteer project. The installed browser version can change; do not assume a particular version without checking your own environment.

Install Puppeteer with its managed browser

npm install puppeteer

Install the library without a browser download

npm install puppeteer-core

Use the second option only when your runtime supplies a compatible browser and you can configure its executable or connection details. For the package-managed browser path, allow the required install script if your package manager blocks scripts, or use the documented browser-install command after installing.

Build a basic scraper

This example follows the documented sequence: launch a browser, create a page, navigate, locate a matching element, and read its text. Replace the example URL and selector with ones appropriate to the site you are allowed to access.

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();

try {
  const page = await browser.newPage();
  const response = await page.goto('https://example.com/', {
    waitUntil: 'domcontentloaded',
  });

  if (!response) {
    throw new Error('Navigation did not return a response');
  }

  console.log('HTTP status:', response.status());

  const heading = page.locator('h1');
  await heading.wait();
  const title = await heading.map(element => element.textContent);

  if (!title?.trim()) {
    throw new Error('The expected heading was empty');
  }

  console.log(title.trim());
} finally {
  await browser.close();
}

The navigation response and extracted text answer different questions: the response reports what navigation returned, while the selector and value checks verify that the page contained the data your script expected. The official getting-started guide shows the launch, page, navigation, interaction, and text-extraction flow; the Page API documents navigation and response behavior.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Find and interact with the right content

For interactions, the current Puppeteer guide recommends locators. A locator waits for the element to be present and for the state needed for the requested action, rather than requiring you to separately query and immediately act on an element. CSS selectors work by default; Puppeteer also documents selector syntax for text, accessibility attributes, XPath, and Shadow DOM. See the page interactions guide.

Read an element’s text

const headline = page.locator('article h2').first();
await headline.wait();
const text = await headline.map(element => element.textContent);
console.log(text?.trim());

Choose a selector based on the page you are actually targeting, then inspect the extracted value. A selector copied from a different page or a stale layout can match nothing—or the wrong element.

Click an element and handle navigation

If clicking a link or button triggers navigation, register the navigation wait at the same time as the click. Otherwise, the page may navigate before your script begins waiting for it.

await Promise.all([
  page.waitForNavigation(),
  page.locator('a.next-page').click(),
]);

For controls that update the page without navigation, wait for the resulting element or state instead of waiting for navigation that will never happen.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Wait for the page state your task needs

Navigation completing does not prove that the content you want has appeared. Select a wait that corresponds to the next step in your script: a selector becoming available, an element becoming visible, a response arriving, or navigation completing. Puppeteer’s Page API documents these waits and a default selector-wait timeout of 30 seconds unless you change it.

Need Use
A specific element to appear Wait for its selector or locator before reading or interacting with it.
An element to become visible Wait for the visible state when visibility matters to the task.
A request to complete Wait for the expected response and inspect it.
A click to cause a new document Wait for navigation alongside the click with Promise.all.
A page transition to reach network idle Use a network-idle wait only when that condition suits the page and task.

A fixed sleep may be useful for a known delay in a specific workflow, but it is a poor default: it can waste time on fast loads and still be too short on slow ones. Prefer a meaningful event or element state, and give waits a timeout that fits your task.

Extract and validate data

Make the expected data shape explicit before collecting it. For each page, check that the target exists, the extracted text is nonempty where required, and the response status is acceptable for your workflow. A successful navigation is not proof that a page rendered the expected content.

const response = await page.goto('https://example.com/catalog', {
  waitUntil: 'domcontentloaded',
});

if (!response || response.status() >= 400) {
  throw new Error(`Unexpected navigation status: ${response?.status()}`);
}

const item = page.locator('.product-name').first();
await item.wait();
const name = await item.map(element => element.textContent);

if (!name?.trim()) {
  throw new Error('Product name was missing');
}

The selector is only an example: use the target site’s actual structure, and decide which status codes and missing fields should fail your job rather than silently producing incomplete data.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Frames and Shadow DOM

If the expected content is not found in the main document, it may be in a frame or inside a component’s Shadow DOM. Inspect the page structure before concluding that the content is absent. Puppeteer documents frame handling in its Page API and Shadow DOM selector support in the page interactions guide. Choose the appropriate frame or selector mechanism for the page structure you find.

Capture a screenshot or create a PDF

Screenshots can help you debug what the browser rendered. Puppeteer also supports creating a PDF from a page with page.pdf(). By default, PDF generation uses print CSS, so the output may differ from the page’s screen appearance. Creating a PDF from an HTML page is not the same as downloading or parsing an existing PDF document. The Page API also notes that headless shell cannot navigate directly to a PDF document.

await page.screenshot({ path: 'page.png', fullPage: true });
await page.pdf({ path: 'page.pdf', format: 'A4' });

For API details and supported options, see the Page API.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common failures

Symptom Likely cause What to check or change
Browser launch fails because no browser is available An install script was blocked, or the project uses puppeteer-core without a configured browser. Allow the needed install script or run npx puppeteer browsers install; for puppeteer-core, provide and configure a browser yourself. See the project overview.
Selector wait times out The page has not reached the expected state, the selector does not match, or the element is in a frame or Shadow DOM. Inspect the rendered page, verify the selector, wait for the relevant state, and check frames and Shadow DOM.
Navigation returns but extracted data is empty The page loaded without the expected element or the script read too soon. Wait for the target element, verify its selector against the live page, and validate the returned text.
The click finishes but the next page is not ready The script started waiting for navigation after the click, or the control updated content without a navigation. For navigation, register click and navigation wait together with Promise.all. For an in-page update, wait for the new element or state instead.
The script treats an error page as a successful scrape The navigation response was not inspected. Check the response returned by navigation and decide how your job should handle unsuccessful status codes.
Browser processes remain after an exception Cleanup was skipped when an operation failed. Put browser closure in a finally block, as in the example.

Handle target sites responsibly

Puppeteer automates a browser; it does not grant authorization or override a site’s access rules. Before collecting data, check the specific site’s published rules and the requirements that apply to your data, access method, and jurisdiction. Minimize what you collect, and do not treat browser automation as a way to bypass a restriction.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Or skip the browser setup

If your task is to capture a page rather than build custom browser automation, ScreenshotNeo offers a screenshot API and MCP server. A single GET request can return an image or PDF; the API docs are at screenshotneo.com/docs.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

ScreenshotNeo accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and responses identify the page verdict and billing status in headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for AI agents and other MCP clients. The free plan includes 1,000 shots a month with no card; paid plans start at $5 for 3,000 shots. Sign up for free.

Frequently Asked Questions

Does Puppeteer scrape a page without JavaScript?

It can, but a direct HTTP request may be a simpler fit when the needed content is available in the response without browser execution or interaction.

Can Puppeteer read content inside an iframe?

Yes. Puppeteer supports working with frames; identify the frame that contains the content and use its page context rather than assuming the main document contains it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can Puppeteer download and parse an existing PDF?

The documented page.pdf() behavior creates a PDF from a rendered page. It is not a PDF download or parsing API.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.