Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk5 min

How to Run Puppeteer in a Browser

Browser-side Puppeteer is a bundled client for controlling a separate, already-running browser over WebSocket—not a way to launch a browser from a web page.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can run Puppeteer API calls from browser-side JavaScript, but you cannot launch the browser from the page. Bundle Puppeteer’s browser-specific puppeteer-core entry point, then connect it to a separate, already-running browser through a valid WebSocket endpoint. The remote browser performs the actual browsing.

What “Puppeteer in a browser” means

In this setup, your web page hosts a bundled Puppeteer client. That client connects over WebSocket to another browser process with an open debugging port. It is not a browser running inside your page, and the page does not start or install the remote browser.

As an Amazon Associate I earn from qualifying purchases.

This distinction determines whether the approach fits: use browser-side Puppeteer when the page itself needs to issue automation calls and can reach an existing browser endpoint. Use Node.js Puppeteer when your application needs to launch or manage the browser process.

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.

What you need before writing the page code

  • A browser process already running with a debugging endpoint that accepts WebSocket connections.
  • A valid WebSocket URL for that browser, available to the client code.
  • puppeteer-core and a bundler configured for browser-targeted code, such as Rollup or Webpack.
  • Compatible Puppeteer and browser versions. Puppeteer releases are tied to browser releases; check the project’s current mapping rather than assuming an arbitrary browser version will work.

The official Puppeteer browser guide describes this as client-page API calls whose automation actions are sent to a separate browser with an open debugging port. Do not expose an unprotected debugging endpoint to the public internet; the guide establishes the endpoint requirement but does not provide deployment security instructions.

Install the browser-side client and bundle it

Install puppeteer-core in the project that builds your page bundle. The browser guide uses the browser-specific entry point below; import it directly rather than assuming the standard Node.js entry point is suitable for browser-side code.

import puppeteer from 'puppeteer-core/lib/puppeteer/puppeteer-core-browser.js';

Configure Rollup, Webpack, or another suitable bundler to produce browser-compatible output. The guide’s Rollup example resolves browser-targeted dependencies. It also notes that the WebDriver BiDi mapper can be excluded to reduce bundle size if you do not need BiDi. That exclusion is an optimization, not a requirement for every project.

Include the generated bundle in your page using your normal asset pipeline. The bundle contains the client API; it does not contain or download the remote browser.

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

Connect to the remote browser

Supply the WebSocket URL for your running browser as wsUrl. The snippet connects, lists open pages, and disconnects the Puppeteer client. Replace the placeholder with an endpoint supplied by your own browser deployment; no universal endpoint can be used for every environment.

import puppeteer from 'puppeteer-core/lib/puppeteer/puppeteer-core-browser.js';

const wsUrl = 'wss://your-browser-host.example/devtools/browser/your-id';

async function inspectBrowser() {
  const browser = await puppeteer.connect({ browserWSEndpoint: wsUrl });

  try {
    const pages = await browser.pages();
    console.log(`Open pages: ${pages.length}`);

    // Use supported page operations against the connected browser.
    // For example, navigate an existing page or evaluate page JavaScript.
  } finally {
    browser.disconnect();
  }
}

inspectBrowser().catch((error) => {
  console.error('Could not connect to the remote browser:', error);
});

browser.disconnect() disconnects this client from the browser; it is not a command to launch the browser, and the remote process must already be reachable. Keep endpoint access under your control: do not put a broadly accessible, unprotected debugging URL into a public page.

What browser-side Puppeteer can do

Once connected, the client can ask the remote browser to perform supported operations. The browser guide lists capabilities including:

  • Open, close, and navigate pages.
  • Evaluate JavaScript in a remote page context.
  • Capture screenshots and generate PDFs.
  • Inspect and modify cookies.
  • Monitor or intercept network activity.

These actions happen in the connected browser. Browser-side code cannot launch or download a browser because those operations rely on Node.js APIs.

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.

Choose the package and runtime that match the job

Approach Where the client runs Who provides the browser Use it when
Browser-side puppeteer-core In a page bundle A separate browser must already be running and reachable through WebSocket The page itself needs to issue automation calls.
Node.js with puppeteer In a Node.js process The package’s default install downloads a compatible Chrome browser Your Node.js application should launch and control a browser.
Node.js with puppeteer-core In a Node.js process You provide or connect to a browser yourself You manage browsers separately or connect to a remote browser; specify an executable path or standard channel when managing a local browser.

The project overview documents npm i puppeteer as the default installation and npm i puppeteer-core as the library without a browser download. These package choices do not remove the WebSocket prerequisite from the browser-side arrangement.

Browser and protocol compatibility

The Puppeteer FAQ displayed version 25.12.0 when checked on October 3, 2026. It states that Puppeteer v23.0.0 onward supports Chrome and Firefox; Chrome uses Chrome DevTools Protocol (CDP) by default, while Firefox uses WebDriver BiDi by default. The FAQ describes BiDi support as production-ready for both and says CDP support for Chrome will continue. Because the FAQ is version-sensitive, check the current supported-browser mapping and documentation before choosing a browser build or protocol.

The configuration guide documents selecting another Chrome or Chromium executable by path, enabling Firefox downloads, and installing multiple browsers. Those configuration options are relevant when you manage browsers from a Node.js environment; they do not enable a page bundle to download a browser.

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

Troubleshooting

  • The bundle fails on Node.js-only modules: Check that the import uses puppeteer-core/lib/puppeteer/puppeteer-core-browser.js and that the bundler is targeting a browser environment. The browser page cannot supply Node.js APIs.
  • The connection fails or times out: Confirm the remote browser is running, its debugging endpoint is open, the WebSocket URL is valid, and the page’s environment can reach that endpoint. A URL for an HTTP page is not a substitute for the browser WebSocket endpoint.
  • The endpoint connects but browser operations behave unexpectedly: Verify the browser version against the Puppeteer release’s supported-browser mapping. Releases are coupled to browser versions for protocol compatibility.
  • The bundle is larger than needed: If the application does not need WebDriver BiDi, follow the browser guide’s bundler guidance for excluding the BiDi mapper.
  • The browser was not downloaded during installation: Package managers may block install scripts. For local or managed browser setup, Puppeteer’s installation guide recommends manually installing with npx puppeteer browsers install or allowing Puppeteer’s install script. This does not remove the need for an already-running, reachable browser when using the browser-side client.

For package installation details, see the official installation guide; for the project’s ordinary Node.js launch workflow, see the Puppeteer overview.

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

Or skip the browser setup

If your goal is to get a website screenshot rather than run arbitrary browser automation from a page, ScreenshotNeo offers a screenshot API and MCP server. One GET request returns an image or PDF without requiring you to bundle Puppeteer or provision a browser endpoint.

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

See the ScreenshotNeo API documentation for request options. Cookie banners, newsletter popups, and chat widgets are removed before the shot; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. An MCP server provides screenshot tools for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots.

Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.

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.

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

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
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

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.