Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk7 min

Puppeteer Browser API: How to Launch and Control Chrome

Launch or connect to Chrome with Puppeteer, then manage contexts and pages for navigation, interaction, screenshots and PDFs. Includes package choice, launch options and remote browser code.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Puppeteer’s Browser API lets a JavaScript program launch Chrome, create isolated browser contexts and pages, and automate navigation and page actions. For the least browser-version uncertainty, use the puppeteer package and its bundled Chrome for Testing. Use puppeteer-core when you want to choose and manage the browser yourself; to control a browser that is already running, connect with its WebSocket endpoint.

Install Puppeteer and launch Chrome

The standard Node.js workflow is to launch a browser, open a page, navigate to a URL, interact with the page, and close the browser when the work is finished. The full puppeteer package downloads a compatible Chrome for Testing by default. Its getting-started guide demonstrates navigation, viewport control and page interaction: Puppeteer’s getting-started guide.

As an Amazon Associate I earn from qualifying purchases.

Install the package in a Node.js project with npm install puppeteer, then save this as capture.mjs and run node capture.mjs:

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.
import puppeteer from 'puppeteer';

const browser = await puppeteer.launch({ headless: true });

try {
  const page = await browser.newPage();
  await page.setViewport({ width: 1440, height: 900 });
  await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });

  console.log('Title:', await page.title());
  await page.screenshot({ path: 'page.png', fullPage: true });
} finally {
  await browser.close();
}

puppeteer.launch() resolves to a Browser. Pages are tabs controlled through the Page API, which supports navigation, interaction, screenshots and PDF generation. The API’s exact methods and signatures can vary with the installed Puppeteer version; check the Page API reference for your version.

#1 Best Overall
HP 14" HD Chromebook Laptop for Students, Intel Quad-Core N4120(> N4020), 4GB RAM, 64GB eMMC, WiFi, Webcam, HDMI, USB-A&C, 14 Hours Battery Life, Zoom, Chrome OS, CUE Accessories
  • Intel Celeron N4120: 4 Cores & Threads, 1.1GHz Base Clock, Up to 2.6GHz Boost Clock, 4MB Cache, Intel UHD Graphics 600. The perfect combination of performance, power consumption, and value helps your device handle multitasking smoothly and reliably with four processing cores to divide up the work.

Choose between puppeteer and puppeteer-core

Package Browser provisioning When it fits
puppeteer Downloads a compatible Chrome for Testing by default. Use when you want Puppeteer to provide its recommended browser with minimal setup.
puppeteer-core Does not select or download a browser for you. When launching, supply executablePath or channel. Use when your environment supplies the browser or you need to choose its installation explicitly.

The Puppeteer documentation says its bundled Chrome for Testing works best and does not guarantee compatibility with arbitrary browser versions. Choosing a system Chrome or another custom executable is therefore a compatibility trade-off. The launch reference suggests Chrome Canary or Dev Channel if you specifically use Google Chrome rather than Chrome for Testing.

Configure launch options

launch() accepts a LaunchOptions object. The following options are particularly useful when the default local launch is not the right fit:

Option What it controls
browser Browser type; the current reference lists Chrome as the default.
channel Selects a system Chrome channel at a known location.
executablePath Uses a specific browser executable. You take on the compatibility implications of that choice.
headless Controls headless mode; the current reference lists true as the default.
args Passes command-line arguments to the browser process.
env Sets the browser process environment.
userDataDir Specifies a user data directory for the browser.
timeout Sets the launch timeout; the current reference lists 30,000 milliseconds as the default.
waitForInitialPage Controls whether launch waits for the initial page.

These defaults and option details are from the LaunchOptions reference, which showed Puppeteer 25.12.0 when consulted. Defaults and supported browser channels are version-sensitive; verify the documentation matching the package version installed in your project.

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

For example, use an explicit executable only when your deployment environment manages that Chrome installation:

const browser = await puppeteer.launch({
  executablePath: '/path/to/chrome',
  headless: true,
});

The path is environment-specific; this example is not a portable Chrome location. With puppeteer-core, provide either executablePath or channel when launching.

Use browser contexts to isolate sessions

A Browser can contain multiple pages and browser contexts. A context represents a user session and isolates storage such as cookies and localStorage. A newly launched browser has a default context; Chrome’s non-default contexts are incognito. Closing a non-default context closes its pages, while the default context cannot be closed. See the BrowserContext reference.

const context = await browser.createBrowserContext();
try {
  const page = await context.newPage();
  await page.goto('https://example.com');
  // Work in this isolated session.
} finally {
  await context.close(); // Also closes pages in this context.
}

Use separate contexts when tasks need distinct cookies or local storage but can share one browser process. Choose separate browser processes instead when you need separate process lifecycles or browser-level configuration. Context isolation is storage isolation; it does not create a separate browser executable.

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

Navigate and interact with a page

Once you have a Page, use its navigation and interaction APIs for the task. The wait condition matters: domcontentloaded waits for document parsing, but does not guarantee that every later image, script or network request has finished. Choose a wait condition that matches what you need to inspect, and use a selector-based wait when the relevant content appears after initial navigation.

Rank #3
ASUS 2026 15" FHD IPS Chromebook, Intel Processor Up to 2.80GHz, 4GB DDR4, 128GB Storage, HDMI, Super-Fast WiFi, Chrome OS, Pastel Silver (Renewed)
  • Intel Processor Up to 2.80GHz, 4GB DDR4, 128GB Storage
  • 15" FHD IPS Display, Intel UHD Graphics
  • 1x USB Type C, 1 x USB Type A, 1x Headphone/Microphone Combo Jack, HDMI
  • Fast WiFi and Bluetooth, Integrated Webcam
  • Chrome OS, AC Charger Included, Pastel Silver
const page = await browser.newPage();
await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
await page.locator('a').first().click();
await page.screenshot({ path: 'after-click.png' });

Selectors and page state are site-specific. If an element is rendered asynchronously, wait for the actual target or resulting state rather than assuming navigation alone means the page is ready.

Capture screenshots and PDFs

The Page API supports screenshots and PDF output. For a full-page image, set fullPage: true; for an element image, use the element screenshot capability documented by Puppeteer’s screenshot guide.

await page.screenshot({ path: 'full-page.png', fullPage: true });

await page.pdf({ path: 'page.pdf', format: 'A4' });

PDF generation uses print CSS by default. If you need the page’s screen styling instead, switch the page media type before generating the PDF:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
await page.emulateMediaType('screen');
await page.pdf({ path: 'screen-styled.pdf', format: 'A4' });

See the Page API reference for version-specific screenshot and PDF methods.

Rank #4
Lenovo Chromebook 2-in-1 - Lightweight Laptop - Google Gemini - Intel® N150 CPU - 14" WUXGA IPS Touchscreen Display - 4GB RAM - 128GB UFS Storage - Integrated Intel® Graphics - Luna Grey
  • THE BETTER WAY TO LAPTOP – Imagine a Chromebook that’s as flexible as your day: thin and lightweight with built-in Google apps and stress-free security.
  • TAKE HITS KEEP MOVING – Sleek, light, and built to last- the Chromebook 2-in-1 is just 0.69” thick and 3.3lbs. Enjoy long-lasting battery life, fast charging, and military-grade durability for nonstop productivity wherever life takes you.
  • PERFORMANCE THAT MATCHES YOUR HUSTLE – Fuel your ideas with an Intel Core processor and 128GB storage. Boot up in under 10 seconds to start the day powerfully efficient.
  • FLEX YOUR CREATIVITY ANYWHERE, ANYTIME – Create, work, or unwind your way with a versatile 2-in-1 design. Flip easily between laptop, tent, and tablet modes with a responsive touchscreen built for flexibility.
  • BRILLIANT VIEWS AND IMMERSIVE AUDIO – See, hear, and create with awesome clarity. The WUXGA display brings rich detail to your work and play, while audio tuned by Waves MaxxAudio provides immersive, balanced sound.

Connect Puppeteer to a remote browser

If a browser process is already running and exposes a WebSocket endpoint, connect to it instead of launching a local browser. This is useful when another service or your infrastructure manages the browser process. The browser-side guide demonstrates connecting, inspecting pages and disconnecting: Running Puppeteer in the browser.

import puppeteer from 'puppeteer-core';

const browser = await puppeteer.connect({ browserWSEndpoint: process.env.BROWSER_WS_ENDPOINT });
try {
  const pages = await browser.pages();
  const page = pages[0] ?? await browser.newPage();
  await page.goto('https://example.com');
  console.log(await page.title());
} finally {
  browser.disconnect();
}

Set BROWSER_WS_ENDPOINT to the endpoint supplied by the browser host; do not publish a real endpoint or its credentials in source code. Disconnecting your Puppeteer client is distinct from closing the remote browser process. Browser-side Puppeteer can connect and control pages, but launching or downloading a browser there is unsupported because those operations rely on Node.js APIs.

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 task is simply to fetch a clean website screenshot, ScreenshotNeo provides a one-request alternative to managing a Chrome process. This Node.js example follows the API pattern shown in the ScreenshotNeo documentation:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo accepts cookie and consent banners like a visitor and removes 60+ known consent platforms, newsletter popups and chat widgets before capture; each of those steps can be turned off. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.

Learn about ScreenshotNeo, or sign up for 1,000 free screenshots a month with no card.

Best Value
HP Chromebook 14 Laptop, Intel Celeron N4120, 4 GB RAM, 64 GB eMMC, 14" HD Display, Chrome OS, Thin Design, 4K Graphics, Long Battery Life, Ash Gray Keyboard (14a-na0226nr, 2022, Mineral Silver)
  • FOR HOME, WORK, & SCHOOL – With an Intel processor, 14-inch display, custom-tuned stereo speakers, and long battery life, this Chromebook laptop lets you knock out any assignment or binge-watch your favorite shows..Voltage:5.0 volts
  • HD DISPLAY, PORTABLE DESIGN – See every bit of detail on this micro-edge, anti-glare, 14-inch HD (1366 x 768) display (1); easily take this thin and lightweight laptop PC from room to room, on trips, or in a backpack.
  • ALL-DAY PERFORMANCE – Reliably tackle all your assignments at once with the quad-core, Intel Celeron N4120—the perfect processor for performance, power consumption, and value (2).
  • 4K READY – Smoothly stream 4K content and play your favorite next-gen games with Intel UHD Graphics 600 (3) (4).
  • MEMORY AND STORAGE – Enjoy a boost to your system’s performance with 4 GB of RAM while saving more of your favorite memories with 64 GB of reliable flash-based eMMC storage (5).

Troubleshoot common launch and control problems

  • Chrome is not found when using puppeteer-core: this package does not provide a selected browser. Supply a valid executablePath or a supported channel, and confirm the executable is available in the runtime environment.
  • The browser fails to launch with a custom executable: confirm the path exists and is executable in the process environment. If the browser version is not Puppeteer’s bundled Chrome for Testing, account for the documented lack of compatibility guarantees with arbitrary browser versions.
  • Launch times out: the current LaunchOptions reference gives a 30,000-millisecond default. Check whether Chrome can start in that environment and whether the selected executable or startup conditions are delaying launch; only raise timeout when a longer startup is expected.
  • A page action runs before content is ready: navigation completion may precede client-rendered content. Wait for the specific selector or page state your next action requires.
  • A PDF does not match the on-screen appearance: PDF output uses print CSS by default. Set screen media before page.pdf() if screen styling is the requirement.
  • Cookies or local storage leak between tasks: use a separate browser context per isolated session and close each non-default context when its work ends.
  • Browser-side code cannot launch Chrome: launch and download depend on Node.js APIs and are unsupported in the browser environment. Connect to an existing browser through a WebSocket endpoint instead.
  • Closing a remote connection also shuts down the browser: use browser.disconnect() to detach the client. Use browser closure only when you own the browser process and intend to terminate it.

Version and compatibility notes

The official Puppeteer references consulted showed version 25.12.0. Launch option defaults, API signatures and browser compatibility can change, so check the live documentation for the version installed in your project rather than assuming the values above apply indefinitely.

Frequently Asked Questions

Can Puppeteer launch Chrome in a browser-side JavaScript app?

No. Browser-side Puppeteer can connect to and control an existing browser, but it cannot launch or download Chrome because those operations require Node.js APIs.

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

Can I use Puppeteer with Firefox?

The launch options reference lists Chrome as the default browser, but the sources cited here do not establish Firefox setup or compatibility details. Check the documentation for the exact Puppeteer version and browser combination you intend to use.

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. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver 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.