Free tools Windows power users keep installed
One-click scans. No signup required.
To close a Puppeteer browser and all its associated pages, use await browser.close(). Use await browser.disconnect() instead when you only want Puppeteer to stop controlling a browser that should remain open.
Close the whole browser
Call and await browser.close() when your script is finished with the browser. Puppeteer documents that this closes the browser and all associated pages. Awaiting the promise ensures the asynchronous close operation completes before your code continues.
As an Amazon Associate I earn from qualifying purchases.
import puppeteer from 'puppeteer';
const browser = await puppeteer.launch();
try {
const page = await browser.newPage();
await page.goto('https://example.com');
// Do work with the page.
} finally {
await browser.close();
}
The try/finally pattern makes cleanup run whether the work succeeds or throws. The documented operation is Browser.close().
Choose the right cleanup scope
| What you want to close | Use | Effect |
|---|---|---|
| The browser and its pages | await browser.close() |
Closes the browser and all associated pages. |
| Puppeteer’s connection only | await browser.disconnect() |
Leaves the browser process running and its pages open. |
| One page | await page.close() |
Closes that page; it does not shut down the browser. |
| An isolated browser context | await context.close() |
Closes that context and its pages. The default browser context cannot be closed this way. |
Puppeteer’s browser management guide states: “Unlike browser.close(), browser.disconnect() does not shut down the browser or close any pages.”
#1 Best Overall
Close a page or an isolated context
Close one page
Use await page.close() when the browser should stay available for other tabs. The method also accepts an optional { runBeforeUnload?: boolean } option, and returns a promise; see the Page.close() API.
Close an isolated context
Use await context.close() to close an isolated context and the pages it contains. This is useful when work in one context is finished but other browser contexts should remain. The default browser context cannot be closed using this method; see BrowserContext.close().
Rank #2
When to disconnect instead of close
Puppeteer can connect to a browser launched by another process. If that process owns the browser and should keep it running, call await browser.disconnect() to release Puppeteer’s connection. If your intention is to shut down the browser itself, use await browser.close().
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsDo not rely on browser.process() to obtain a process handle in every case: it returns null when the browser was reached through puppeteer.connect(). See the Browser.process() API.
Close a browser on cancellation or process signals
Puppeteer launch options let you associate browser cleanup with an AbortSignal; aborting that signal closes the browser. The options also document default handling for SIGHUP, SIGINT and SIGTERM, including browser close or kill behavior. These launch-time options are separate from choosing an explicit cleanup call in application code. Consult the LaunchOptions API for the version you use.
Troubleshooting browser cleanup
- Chrome stays open after
disconnect(): this is expected. Disconnecting leaves the browser and its pages running. Useawait browser.close()if your code owns the browser and should shut it down. - Other tabs or pages close unexpectedly:
browser.close()closes the entire browser and its associated pages. Usepage.close()for one tab or close only the relevant isolated context. - You cannot close the default context:
context.close()cannot close the default browser context. Close individual pages, or close the whole browser if that is the intended scope. browser.process()returnsnull: this is documented when Puppeteer connected withpuppeteer.connect(); do not treat it as a local process handle.- Cleanup is skipped when work throws: put the work in a
tryblock and awaitbrowser.close()infinally.
Or skip the browser setup
If your goal is to capture a website rather than automate a browser yourself, ScreenshotNeo returns a screenshot or PDF from one GET request. For example, save a WebP capture with cURL:
Rank #4
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 documentation for request options. Cookie banners are accepted and removed before capture, along with supported newsletter popups and chat widgets. Bot checks, blank pages, failed loads and cache hits are not billed. An MCP server gives AI agents screenshot tools, and the free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for free.
Frequently Asked Questions
Does Puppeteer close Chrome when I call browser.disconnect()?
No. It disconnects Puppeteer but leaves the browser process and pages open. Use browser.close() to shut the browser down.
Can I close just one Puppeteer tab?
Yes. Call await page.close(); the browser remains open.
Quick Recap
Best Value
- Used Book in Good Condition
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.




