Browser Infrastructure for AI Agents with Browser Cloud

Give Your AI Agents Real Cloud Browsers with Session Persistence, a Localhost Tunnel, and Session Replay.

puppeteer-core: What It Is, When to Use It and How to Connect It

puppeteer-core is Puppeteer without a bundled browser. Learn when to use it, how to set executablePath, attach to Chrome, and connect to a cloud browser.

Published

Summarise with AI

puppeteer-core is Puppeteer without the bundled browser. It has the same API as Puppeteer, but installing it downloads no Chrome and sets no defaults. You have to point it at a browser in one of several ways: a local binary via executablePath or channel, a running Chrome via browserURL or a remote browser via browserWSEndpoint.

TL;DR

puppeteer-core is the Puppeteer library without a bundled browser: npm i puppeteer-core downloads no Chrome, and launch() with no options throws an error. Use it when your Dockerfile, CI image or a cloud provider owns the browser, and point it at one with executablePath, channel, browserURL or browserWSEndpoint.

Puppeteer vs puppeteer-core

  • Puppeteer: Installs the library plus Chrome for Testing and chrome-headless-shell, about 170 MB on macOS and 282 MB on Linux, and launches that bundled browser when you call launch() with no options.
  • puppeteer-core: The same API with no browser download and no defaults. Calling launch() with no options throws "An executablePath or channel must be specified for puppeteer-core".
  • Node.js 22.12+: puppeteer-core 25.0.2 and later, including 26.0.0, require Node.js 22.12 or later. On Node 18 or 20, stay on puppeteer-core 24.43.1, the last release that supports them.

How to Give puppeteer-core a Browser

  • executablePath or channel: Launches a local Chrome, Chrome for Testing or Edge binary. Read the path from an environment variable such as CHROME_PATH so the same script runs on laptops and in CI.
  • browserURL: Attaches to a running Chrome started with --remote-debugging-port=9222. Since Chrome 136, that switch also needs a non-default --user-data-dir.
  • browserWSEndpoint: Connects to a remote browser over ws:// or wss://. The TestMu AI Browser Cloud Node SDK is built on puppeteer-core and returns a standard Puppeteer Browser, so no Chrome downloads to your machine.

What Is the Difference Between Puppeteer and puppeteer-core?

The difference between Puppeteer and puppeteer-core is the browser download and the defaults. The Puppeteer docs describe Puppeteer as a ready-to-run product and puppeteer-core as a bare library.

Puppeteer installs Chrome for Testing plus chrome-headless-shell and then launches it. Puppeteer-core "will not download Chrome when installed" and assumes nothing.

DifferencePuppeteerpuppeteer-core
What npm installsThe library plus Chrome for Testing and chrome-headless-shell (since v21.6.0)The library only
Browser download sizeAbout 170 MB (macOS), 282 MB (Linux), 280 MB (Windows)None
Where the browser goes$HOME/.cache/puppeteer by defaultNowhere; you supply it
puppeteer.launch() with no optionsLaunches the bundled ChromeThrows: "An executablePath or channel must be specified for puppeteer-core"
Importimport puppeteer from 'puppeteer'import puppeteer from 'puppeteer-core'
Node.js (25.0.2 and later)22.12 or later22.12 or later (24.43.1 is the last release for Node 18/20)
Best forLocal development and tests where a matching Chrome is wantedDocker images, serverless functions, CI runners and agents that bring their own browser or connect to a remote one

Sizes and paths are from the Puppeteer installation guide.

Node versions are from the npm registry (the engines field in the package.json), which moved from Node 18 to Node 22.12 at puppeteer-core 25.0.2 (May 15, 2026), and the current release is 26.0.0 (December 2, 2026). Puppeteer is built on top of puppeteer-core, so the API you call is the same either way.

puppeteer-core is also the package that cloud browser services connect through. If you're using one of those cloud browser services, then TestMu AI has a head-to-head comparison of Browserbase and TestMu Browser Cloud on pricing, session limits and SDKs.

When Should You Use puppeteer-core Instead of Puppeteer?

Use puppeteer-core when something other than npm owns the browser. Four situations cover most teams:

  • Docker images where Chrome was installed in its own layer so the browser version was pinned in the Dockerfile rather than by npm install.
  • Serverless functions where you want a deployment bundle that contains absolutely no browser at all and the browser runs somewhere else.
  • CI runners that already ship Chrome or Edge so a second download is just wasted time on every job.
  • AI agents and scrapers that connect to a remote browser (which never actually launches Chrome on the local machine).

Stay on Puppeteer for local scripts and test suites where you want "install and run" with a Chrome version Puppeteer has tested against.

The BYOB Check: Four Questions Before You Switch

Run this "bring your own browser" (BYOB) check before replacing Puppeteer with puppeteer-core:

  • Which browser binary will run? Name the exact path or channel, or the remote endpoint.
  • Who updates it? Your Dockerfile, the CI image or a cloud provider. Someone must own version drift.
  • Does the Node version match? puppeteer-core 25.0.2 and later (including 26.0.0) require Node 22.12+; on Node 18 or 20, stay on 24.43.1.
  • How do you know the browser started? Add a check that fails the job (a title or element assertion), not just a log line.

If you can't answer the first two, keep Puppeteer.

How Do You Install puppeteer-core and Get a Browser?

Install the library, then get a browser in one of three ways.

npm i puppeteer-core

Option A: download Chrome for Testing yourself. The @puppeteer/browsers CLI installs a browser on demand, which is ideal for Dockerfiles and CI caches:

npx @puppeteer/browsers install chrome@stable

Option A2: download chrome-headless-shell instead. The same CLI will install the lighter headless-only binary. Puppeteer's headless modes guide will tell you that it doesn't behave exactly like regular Chrome, so use this for automation that doesn't need all the full Chrome features:

npx @puppeteer/browsers install chrome-headless-shell@stable
const browser = await puppeteer.launch({ executablePath: process.env.CHROME_PATH, headless: 'shell' });

Option B: use a browser that's already installed. Pass its path as executablePath or use channel if it's in the standard location. For Chrome in the standard location, await puppeteer.launch({ channel: 'chrome' }) is all you need. Microsoft's Puppeteer guide for Edge uses puppeteer-core in that way and recommends you just copy the path from edge://version.

Option C: don't run a browser at all locally. Just connect to a remote one via puppeteer.connect() (discussed below).

puppeteer-core can launch a local browser, attach to a running Chrome or connect to a cloud browser

How Do You Set executablePath in puppeteer-core?

Set executablePath in puppeteer.launch() to the browser binary and read it from an environment variable so the same script will work on laptops and in CI. The script will exit with code 1 if the variable is missing or the page title is incorrect:

// local-launch.mjs - run: CHROME_PATH=/path/to/chrome node local-launch.mjs <url> "<expected title>"
import puppeteer from 'puppeteer-core';

// puppeteer-core never downloads a browser, so tell it which one to drive.
const executablePath = process.env.CHROME_PATH;
if (!executablePath) {
  console.error('Set CHROME_PATH to a Chrome, Chrome for Testing or Edge binary.');
  process.exit(1);
}

const targetUrl = process.argv[2] ?? 'https://example.com';
const expectedTitle = process.argv[3] ?? 'Example Domain';

const browser = await puppeteer.launch({ executablePath, headless: true });
try {
  const page = await browser.newPage();
  await page.goto(targetUrl, { waitUntil: 'domcontentloaded' });
  const title = await page.title();
  if (title !== expectedTitle) {
    throw new Error(`Expected title "${expectedTitle}" but got "${title}"`);
  }
  console.log(`PASS: ${targetUrl} has title "${title}"`);
} finally {
  await browser.close();
}

We ran this on 4th December 2026 with Node 22.23.5, puppeteer-core 26.0.0 and Chrome for Testing 158. The test with the matching title printed PASS and the test with the incorrect expected title exited with code 1.

puppeteer-core Errors and What They Mean

These are the exact messages puppeteer-core 26.0.0 printed in that run:

Error messageCauseFix
An `executablePath` or `channel` must be specified for `puppeteer-core`launch() called with no browserPass executablePath or channel
Browser was not found at the configured executablePath (/path)Wrong or missing binaryCheck the path; in Docker, confirm the Chrome layer is installed
Failed to fetch browser webSocket URL from http://127.0.0.1:9222/json/version: fetch failedconnect({ browserURL }) but nothing is listeningStart Chrome with remote debugging, or fix the port
Could not find Chrome (ver. …)You're on Puppeteer, and install scripts were blocked so the download was skippedRun npx puppeteer browsers install, or switch to puppeteer-core with your own browser

The last row comes from the installation guide, which notes that package managers that block install scripts skip the Chrome download.

puppeteer-core 26 error messages for a missing executablePath, a wrong path and no debugging endpoint

How Do You Connect puppeteer-core to an Existing Browser?

puppeteer.connect() "attaches" Puppeteer to an existing browser instance rather than launching one. You give it either a browserURL (an HTTP debugging URL such as http://127.0.0.1:9222) or a browserWSEndpoint (the browser's ws:// or wss:// WebSocket endpoint). The ConnectOptions object contains the other options that are relevant here:

OptionDefaultUse it to
browserURLnoneAttach to a local Chrome started with remote debugging
browserWSEndpointnoneAttach to a known WebSocket endpoint, local or remote
defaultViewport800 × 600Set null to keep the browser's own window size
protocolTimeout180,000 msRaise it for slow remote browsers
wsOptions.headersnoneWebSocket headers (replaces the deprecated headers option)

Since Chrome 136, --remote-debugging-port is ignored in the default profile directory. Google's remote-debugging change notice says the switch must be paired with --user-data-dir pointing to a non-standard directory. Start Chrome like this, then attach:

google-chrome --remote-debugging-port=9222 --user-data-dir="$(mktemp -d)"
// attach-existing.mjs
import puppeteer from 'puppeteer-core';

const browserURL = process.env.CHROME_DEBUG_URL ?? 'http://127.0.0.1:9222';
const browser = await puppeteer.connect({ browserURL });
try {
  const pages = await browser.pages();
  console.log(`Attached. Open tabs: ${pages.length}`);
  for (const page of pages) console.log(' -', page.url());
} finally {
  // disconnect() leaves the browser you started running; close() would shut it down.
  await browser.disconnect();
}

Use browser.disconnect() if you didn't start the browser (according to the Puppeteer API reference, it "leaves the process running"). Use browser.close() if your script owns the browser.

How Do You Run puppeteer-core Against a Cloud Browser?

Browser Cloud from TestMu AI runs the browser remotely and passes you a standard Puppeteer Browser object. The Node SDK (@testmuai/browser-cloud) is built on puppeteer-core.

Version 1.0.1 on npm lists puppeteer-core >=20.0.0 as a dependency and the Puppeteer adapter in the SDK calls into puppeteer-core's connect(). Nothing at all downloads Chrome onto your machine.

Note

Note: Try it: Browser Cloud has a free plan which gives you 100 automation minutes and 2 parallel sessions (pricing page as at 4th December 2026). Create a free account and run the script below.

1. Install the SDK (Node 22.12+, or pin puppeteer-core 24.x; see the version note below):

npm install @testmuai/browser-cloud

2. Provide your credentials as environment variables named LT_USERNAME and LT_ACCESS_KEY (the username and access key from your TestMu AI account). That way they're not in your source code or in your repository. In GitHub Actions you'd map them from your repository secrets:

env:
  LT_USERNAME: ${{ secrets.LT_USERNAME }}
  LT_ACCESS_KEY: ${{ secrets.LT_ACCESS_KEY }}

3. Create a session, connect and assert. That's the way it's laid out in the connect to session docs. Exits 1 if the check fails:

// cloud-check.mjs - run: node cloud-check.mjs <url> "<expected title>"
import { Browser } from '@testmuai/browser-cloud';

// Fail fast: the SDK gives you no prevention against creating a session without credentials.
for (const name of ['LT_USERNAME', 'LT_ACCESS_KEY']) {
  if (!process.env[name]) {
    console.error(`Missing ${name}. Export it before running this script.`);
    process.exit(1);
  }
}

const targetUrl = process.argv[2] ?? 'https://example.com';
const expectedTitle = process.argv[3] ?? 'Example Domain';

const client = new Browser();
const session = await client.sessions.create({
  adapter: 'puppeteer',
  lambdatestOptions: {
    build: 'puppeteer-core checks',
    name: `Title check: ${targetUrl}`,
    'LT:Options': {
      username: process.env.LT_USERNAME,
      accessKey: process.env.LT_ACCESS_KEY,
    },
  },
});

let failed = false;
try {
  const browser = await client.puppeteer.connect(session);
  // connect() fills in the dashboard link; never log session.websocketUrl or the session object.
  console.log(`Session viewer: ${session.sessionViewerUrl}`);
  const page = (await browser.pages())[0];
  await page.goto(targetUrl, { waitUntil: 'domcontentloaded' });
  const title = await page.title();
  if (title !== expectedTitle) {
    console.error(`FAIL: expected "${expectedTitle}", got "${title}"`);
    failed = true;
  } else {
    console.log(`PASS: ${targetUrl} has title "${title}"`);
  }
  await browser.close();
} finally {
  await client.sessions.release(session.id);
}
process.exit(failed ? 1 : 0);

4. Run it with test data as arguments: node cloud-check.mjs https://your-app.example/login "Sign in".

TestMu AI Browser Cloud session replay of a puppeteer-core title check

Four details from the docs and the SDK source are worth knowing:

  • The SDK will put your credentials in a URL for you. SDK 1.0.1 will pull LT_USERNAME and LT_ACCESS_KEY from the environment and build an authenticated wss:// endpoint which is stored as session.websocketUrl. The LT:Options values are also passed in the capabilities query string of that URL. Treat that URL as a secret - never log session.websocketUrl, the entire session object or raw connection errors and always mask both of those variables in CI.
  • Release every session. The docs state that sessions remain active until they are released or have timed out, so client.sessions.release(session.id) goes in the finally block.
  • Puppeteer doesn't do auto-wait. Auto-wait is listed as being built in for Playwright only in the docs. With Puppeteer you have to wait for selectors yourself.
  • Stealth is on the default path. In SDK 1.0.1 the adapter will use puppeteer-extra with the stealth plugin (i.e. stealth enabled) unless you set stealthConfig.skipFingerprintInjection: true in which case it will use plain puppeteer-core. The Browser Cloud stealth doc (updated 2nd Dec 2026) refers to it as best effort and states that some sites may still detect you as an automation. Our Playwright stealth guide goes into what those patches do and what they don't do.

For a quick visual walkthrough of what stealth patches hide from bot detection, and what they can't, watch the video below from TestMu AI.

Youtube thumbnail

Subscribe to the TestMu AI YouTube channel for more tutorials on testing and automation.

If you can't use the SDK (i.e. you're using some other language or a raw CDP client) then the Chrome DevTools Protocol guide will show you the puppeteer.connect({ browserWSEndpoint }) route. That route will build the exact same kind of authenticated WebSocket URL by hand from the same environment variables. The same rule applies in that case: don't put that URL in your logs, your screenshots or your error reports.

Version Note: The SDK Installs puppeteer-core 26 by Default

The SDK's own engines field states Node 18+, but its puppeteer-core >=20.0.0 range resolves to the latest version. A fresh install on 4th December 2026 pulled in puppeteer-core 26.0.0. All puppeteer-core releases from 25.0.2 (15th May 2026) onwards require Node 22.12+.

Either run Node 22.12+ or, if you're on Node 18 or 20, pin the last compatible version in your own package.json with "puppeteer-core": "^24.43.1". You can check any release out via npm view puppeteer-core@<version> engines.

Should You Use puppeteer-core in Docker or a Serverless Function?

Yes, in most cases, because it keeps the browser out of npm install. The choice is where the browser comes from:

SetupWhere the browser comes fromWhat you maintain
Puppeteer in Dockernpm download at build timeImage size; Chrome system libraries
puppeteer-core + Chrome layer in Dockernpx @puppeteer/browsers install chrome@stable or your base imageChrome version and system libraries (see the Puppeteer system requirements page)
puppeteer-core + a Lambda-packaged ChromiumA Chromium build made for serverless, such as @sparticuz/chromium (158.0.0 on npm, November 24, 2026)Bundle size and matching Chromium to puppeteer-core versions
puppeteer-core in a serverless function, remote browserA remote browser via connect()The endpoint, credentials and session cleanup
puppeteer-core + Browser Cloud SDKTestMu AI Browser CloudSession release and your Node version

On AWS Lambda the standard pattern is puppeteer-core plus @sparticuz/chromium, which is launched in the README with executablePath: await chromium.executablePath() and headless: "shell". The compressed chromium is over 50MB, so on some platforms you'll need to use the -min variant. You can of course connect to a remote browser to avoid shipping any browser at all.

Whatever you do, do have the check that fails the job. A green pipeline that never gets to the page tells you absolutely nothing.

Where to Go Next

Conclusion

Run your puppeteer-core scripts without having to ship Chrome. Browser Cloud provides each script with a remote browser via client.puppeteer.connect(session), complete with session replay and network/console logs. Start free with Browser Cloud.

Giving an AI agent a browser? TestMu AI's Browser Cloud runs each task in a real, isolated Chrome session in the cloud, so the browser stays off your laptop.

To run your first session, start free, or
for a full walkthrough of the product.

Was this helpful?

Authors

Sri Harsha

Sri Harsha

Author · 20 posts

Sri Harsha is Engineering Manager of the Open Source Program Office at TestMu AI, where he leads open-source engineering behind the Selenium and Appium automation grid and builds agentic AI systems for quality engineering. He is a member of the Selenium Technical Leadership Committee and a committer to WebdriverIO and Appium, and was recognized with the LambdaTest Delta Award 2023 for Best Contributor in open-source testing. He brings over 10 years of experience in software testing and automation, with earlier roles at EPAM Systems and ZenQ. Sri Harsha holds a B.Tech in Computer Science from Jawaharlal Nehru Technological University.

Mayank Bhola

Mayank Bhola

Reviewer

Mayank Bhola is Co-Founder and Head of Products at TestMu AI, where he leads the entire product portfolio across KaneAI, Kane CLI, HyperExecute, SmartUI, the Real Device Cloud, Accessibility, and other software testing product lines. As an early Lead Architect he designed and built the company's flagship Tunnel technology from scratch, created the React-based automation platform, and architected the data-intensive pipelines and FAAS services that scale it. He brings more than 10 years of experience in software development and product engineering, with earlier roles as Head of Technology at Juggernaut Books and Senior Software Engineer at PressPlay TV and Zomato. Mayank holds a B.Tech in Computer Engineering from JIIT Noida.

puppeteer-core FAQs

TestMu AI forEnterprise

Get access to solutions built on Enterprise
grade security, privacy, & compliance

  • Advanced access controls
  • Advanced data retention rules
  • Advanced Local Testing
  • Premium Support options
  • Early access to beta features
  • Private Slack Channel
  • Unlimited Manual Accessibility DevTools Tests