DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk4 min

Puppeteer Getting Started: Run Your First Browser Script

Install Puppeteer and run a first Node.js script that launches Chrome, opens a page, reads its title, and closes the browser.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

To run your first Puppeteer browser script, install the puppeteer package, then launch its bundled browser, open a page, navigate to a URL, and close the browser when you are done. Puppeteer scripts use this launch–page–navigate workflow to automate browser tasks through JavaScript.

How Puppeteer scripts work

Puppeteer launches or connects to a browser, creates pages, and controls them through its API. A page is a browser tab: you can navigate it, inspect its content, and interact with elements. The basic lifecycle is launch, create a page, navigate, interact or read, then close the browser.

This guide follows Puppeteer’s official getting-started workflow. The current documentation is labelled Puppeteer 25.12.0; browser compatibility is release-specific, so check the official supported browsers table when choosing a browser version.

Install Puppeteer

For the simplest local first run, use puppeteer. Installing it downloads a compatible Chrome for Testing browser and a chrome-headless-shell binary. The official installation guide lists commands for npm, Yarn, pnpm, and Bun; for npm, run:

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.
npm install puppeteer

The documentation’s approximate download estimates are 170 MB on macOS, 282 MB on Linux, and 280 MB on Windows. These are estimates, not fixed requirements. Check the current package’s Node.js engine requirement rather than assuming a minimum version.

When to use puppeteer-core

puppeteer-core provides the library without downloading a browser. Choose it when you explicitly manage the browser yourself or connect to a remote browser. That flexibility means you must provide a compatible browser setup; for a first local script, puppeteer is simpler.

Run your first browser script

Save this as first-script.mjs after installing Puppeteer:

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();
try {
  const page = await browser.newPage();
  await page.goto('https://developer.chrome.com/');
  console.log(await page.title());
} finally {
  await browser.close();
}

Run it with Node.js:

node first-script.mjs

The script prints the page title to the terminal. The try/finally ensures that the browser is closed even if navigation or reading the title fails.

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

What each awaited operation does

  • puppeteer.launch() starts a browser process. By default, it runs headless, without a visible window.
  • browser.newPage() creates a new tab and returns a page object.
  • page.goto(url) navigates that tab to the URL and waits for navigation according to the method’s default behavior.
  • page.title() reads the page’s title after navigation.
  • browser.close() ends the browser process and its pages.

The official guide also demonstrates setting a viewport, locating elements by accessible name or text, interacting with them, waiting for a result, and reading text from the page. Prefer Puppeteer’s locator API for element interactions in fuller scripts.

Choose the browser setup that fits

Bundled browser or system browser

The bundled Chrome for Testing is the best baseline because Puppeteer releases are paired with browser versions. The supported-browsers page currently pairs Puppeteer 25.12.0 with Chrome for Testing 154.0.8037.57 and Firefox 156.0.1. Puppeteer’s launch documentation says it works best with the bundled Chrome for Testing and does not guarantee compatibility with other Chrome versions.

If you need a system browser, configure an explicit executablePath or channel in the launch options. This gives you more control over which browser is used, but it is a compatibility trade-off: a browser version outside the documented pairing may not work as expected.

Headless or visible window

Headless is the default and is useful for scripts that run in the background. To watch the browser while learning or debugging, launch it with headless: false:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const browser = await puppeteer.launch({ headless: false });

The optional headless: 'shell' selects the separate chrome-headless-shell binary. Puppeteer describes it as a potentially more performant automation option when full Chrome behavior is unnecessary; use regular Chrome if you need its full behavior.

Troubleshoot common first-run problems

“Could not find Chrome (ver. …)”

A package manager may have skipped Puppeteer’s install script, so the package was installed but the browser was not downloaded. Install the browser explicitly:

npx puppeteer browsers install

The official installation guide gives corresponding commands for Yarn, pnpm, and Bun. Alternatively, allow Puppeteer’s install script under your package-manager policy.

The browser does not start on Linux

Linux browser startup can fail when system dependencies are missing. Puppeteer’s FAQ links to operating-system-specific troubleshooting. Its browser-management documentation provides a command to install Chrome dependencies on Ubuntu and Debian; it requires root privileges and should not be treated as a universal fix for every Linux distribution.

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

A different Chrome version fails

Check the Puppeteer release against the supported browser table. For a clean baseline, use the browser downloaded with the puppeteer package before trying a system browser.

You expected a visible browser

Normal launch is headless. Set headless: false in the launch options to show a browser window.

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

Or skip the browser setup

If your goal is to capture a website rather than automate a browser interaction, ScreenshotNeo is a website screenshot API and MCP server: one GET request can return a PNG, JPEG, WebP, or PDF. For example, use cURL to save a WebP screenshot:

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

See the ScreenshotNeo API documentation for setup and options. It accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and the response includes X-Page-Verdict and X-Billed headers. Its MCP server lets AI agents use take_screenshot, get_page_info, and capture_pdf. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots.

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

Sign up free for 1,000 screenshots a month, with no card required.

Where to go next

Once the first script works, add a locator-based interaction and wait for the expected page result before reading it. Puppeteer documents Chrome automation through CDP by default and production-ready WebDriver BiDi support for Chrome and Firefox from v23.0.0 onward; the supported APIs differ. See the getting-started guide for the current interaction examples and the FAQ for automation boundaries.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.