October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Check Whether a Puppeteer Browser Process Has Closed

Use the child process returned by browser.process() to detect actual exit. Learn why Puppeteer disconnects and closed pages are different signals.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a browser launched with puppeteer.launch(), call browser.process() and listen for the returned Node.js child process’s exit event. That confirms the operating-system process exited. Puppeteer’s disconnected event only means its connection ended; it does not prove that the browser process stopped.

Check for actual browser process exit

Install the listener immediately after launching the browser so you can observe an early exit:

As an Amazon Associate I earn from qualifying purchases.

const puppeteer = require('puppeteer');

async function main() {
  const browser = await puppeteer.launch();
  const child = browser.process();

  if (!child) {
    throw new Error('No child process handle: was this browser launched with puppeteer.launch()?');
  }

  child.once('exit', (code, signal) => {
    console.log('Browser process exited', { code, signal });
  });

  // Use the browser here. For example:
  // const page = await browser.newPage();
  // await page.goto('https://example.com');
}

main().catch(console.error);

browser.process() returns the associated ChildProcess for a browser Puppeteer launched. Its exit event is the relevant process-level signal. The callback’s code and signal are the values emitted by that child-process event; do not assume a particular exit cause from the event alone.

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

Some Puppeteer versions also expose hasClosed() on the browser-process wrapper. Check the API reference for the version installed in your project before relying on that method or version-specific launch options.

Choose the signal for the lifecycle you mean

Question Use What it tells you
Did a page close? page.isClosed() Whether that page is closed, not whether the browser process exited.
Did Puppeteer lose its connection? browser.connected or the browser’s disconnected event Connection state only. The browser may still be running.
Did a Puppeteer-launched browser process exit? browser.process() and its exit event OS process termination.
Did Puppeteer request browser shutdown? browser.close() Closes the browser and its associated pages; observe the process separately if you need confirmation of OS-level exit.
Do you only want to detach Puppeteer? browser.disconnect() Ends Puppeteer’s connection without shutting down the browser or closing its pages.

Launched browsers and connected browsers differ

Browser launched by this Puppeteer process

After puppeteer.launch(), browser.process() gives you the process handle to monitor. Keep the handle and attach the listener promptly. If you call browser.close(), that requests shutdown; the child-process event is the separate confirmation that the process exited.

Browser attached with puppeteer.connect()

For a browser attached using puppeteer.connect(), browser.process() returns null. The connected Puppeteer client does not own the launcher’s child-process handle, so it cannot use this browser object to observe that process’s OS exit. Monitor it in the code or service that launched the browser. The connected client can still observe its Puppeteer connection state, but that is not process-exit proof.

Rank #2
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

Close the browser or disconnect?

Use await browser.close() when your code should shut down the browser and its pages. Use await browser.disconnect() when Puppeteer should detach while leaving the browser running. A disconnect can therefore happen without process exit; do not treat the browser’s disconnected event as a substitute for the child process’s exit event. See the Puppeteer browser management guide and Browser API.

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.

Common mistakes and fixes

  • Using disconnected as proof Chrome exited: it records Puppeteer connection loss. To confirm exit for a launched browser, watch its child process.
  • Checking page.isClosed(): that reports only the page’s state. Use the browser process handle for process exit.
  • Expecting a process handle after puppeteer.connect(): browser.process() is null for a connected browser. Monitor the process where it was launched.
  • Calling browser.close() when you meant to detach: close shuts down the browser and pages; disconnect detaches Puppeteer and leaves them running.
  • Adding the listener late: a process may exit before a late listener is attached. Register it as soon as you have the browser object and process handle.

Launch and shutdown options

Puppeteer’s launch options document handling for SIGHUP, SIGINT, and SIGTERM, as well as an AbortSignal option that closes the browser when aborted. The onExit option appears in the next documentation; verify that it exists in the installed Puppeteer version before using it. These options concern shutdown behavior, not a replacement for observing the child process when you need confirmation of actual exit. See the LaunchOptions API.

Or skip the browser setup

If your goal is to capture a website rather than manage a Puppeteer process, ScreenshotNeo provides a screenshot API and MCP server. A single GET request returns an image or PDF; the example below saves a WebP screenshot:

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. ScreenshotNeo accepts cookie and consent banners and removes more than 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 cost nothing, and responses include X-Page-Verdict and X-Billed headers. Its MCP server offers take_screenshot, get_page_info, and capture_pdf tools for AI agents. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots.

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

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Frequently Asked Questions

Does the Puppeteer `disconnected` event mean Chrome has exited?

No. It signals that Puppeteer’s connection ended; the browser process may still be running.

What does `browser.process()` return after `puppeteer.connect()`?

It returns `null`; the connected client does not hold the external launcher’s child-process handle.

Does `page.isClosed()` check whether the browser process is closed?

No. It reports whether that individual page is closed.

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
Outdated Drivers Are Slowing You DownFree scan - exact matches
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.