Use await browser.disconnect() to detach Puppeteer while leaving the browser process and its pages open. Use await browser.close() only when you want to shut down the browser. Save the WebSocket endpoint before disconnecting if you may need to reconnect.
Disconnect Puppeteer without closing the browser
Call disconnect() on the Puppeteer Browser instance. It returns a Promise<void>; await it so your code waits for the client to detach. Puppeteer documents that this leaves the browser process running, and its browser-management guide says the pages are not closed by the disconnect.
As an Amazon Associate I earn from qualifying purchases.
const browser = await puppeteer.launch();
// Keep this if you may reconnect later.
const browserWSEndpoint = browser.wsEndpoint();
// Detach Puppeteer; the browser and its pages remain open.
await browser.disconnect();
The same Browser API applies whether Puppeteer launched the browser or connected to an already-running browser.
Reconnect to the same browser
Capture browser.wsEndpoint() before disconnecting, then pass the saved endpoint as browserWSEndpoint to puppeteer.connect(). This is Puppeteer’s documented reconnect pattern:
#1 Best Overall
const browser = await puppeteer.launch();
const browserWSEndpoint = browser.wsEndpoint();
await browser.disconnect();
const browserAgain = await puppeteer.connect({ browserWSEndpoint });
// Close only when you intend to shut down the browser.
await browserAgain.close();
For an independently running browser, connect with its WebSocket endpoint, use it, and call browser.disconnect() when you want to detach. The endpoint must still be available to the process reconnecting; Puppeteer’s example does not guarantee how long a third-party hosting environment keeps an endpoint valid. See the Browser class reference, the browser-management guide, and the connect() reference.
Choose between disconnect() and close()
| Method | Effect | Use it when |
|---|---|---|
browser.disconnect() |
Detaches Puppeteer; leaves the browser process and its pages open. | You want to stop controlling the browser from this Puppeteer client but keep it running. |
browser.close() |
Closes the browser and its associated pages. | You intend to shut down the browser. |
These behaviors are described in Puppeteer’s Browser.disconnect() reference and Browser.close() reference. Do not substitute close() when your goal is only to detach.
Troubleshooting disconnect and reconnect
- The browser closed unexpectedly: Check that your code called
disconnect(), notclose(). Also account for any separate host or process supervisor; Puppeteer’s documented behavior does not establish how every external environment manages browser processes. - Reconnect fails: Confirm you saved the endpoint before disconnecting and pass it as
browserWSEndpointtopuppeteer.connect(). Verify that the endpoint is still available to the reconnecting process. - You need Puppeteer to keep controlling the browser: Do not disconnect yet. Disconnecting detaches that Puppeteer client; reconnect using the saved endpoint if you later need to attach again.
Or skip the browser setup
If your goal is simply to capture a website rather than manage a browser lifecycle, ScreenshotNeo provides a screenshot API. One GET request returns an image or PDF; for example, this cURL command saves a WebP screenshot:
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11curl -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. It removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are not billed. An MCP server lets AI agents take screenshots, and the free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.
Sign up free for ScreenshotNeo.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Frequently Asked Questions
Does Puppeteer’s disconnect() close pages?
No. Puppeteer documents that disconnecting leaves the browser process running and does not close its pages.
Rank #3
Can I reconnect after disconnecting?
Yes, if you saved the browser’s WebSocket endpoint and it remains available. Pass it to puppeteer.connect({ browserWSEndpoint }).
Quick Recap
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.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minute




