The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Call transport.close() to close an implementation of Puppeteer’s ConnectionTransport interface. It is a synchronous method returning void. If you mean the browser session rather than the transport, use browser.disconnect() to detach Puppeteer while leaving the browser running, or browser.close() to shut down the browser and its pages.
Choose what you want to close
| Goal | Operation | Effect |
|---|---|---|
| Close a custom transport | transport.close() |
Synchronous void method on ConnectionTransport. Puppeteer API reference |
| Stop Puppeteer controlling a browser but keep the browser alive | await browser.disconnect() |
Detaches Puppeteer; the browser process remains running. Puppeteer Browser API reference |
| Shut down the managed browser | await browser.close() |
Closes the browser and its associated pages. Puppeteer Browser API reference |
| Close an isolated browser context | await context.close() |
Closes that context and its pages. The default context cannot be closed. Puppeteer BrowserContext API reference |
| Close one page | await page.close() |
Returns a promise; optionally accepts { runBeforeUnload?: boolean }. Puppeteer Page.close() API reference |
Close a ConnectionTransport implementation
When your code owns an object implementing ConnectionTransport, call its close() method:
As an Amazon Associate I earn from qualifying purchases.
transport.close();
The interface also exposes optional onclose and onmessage callbacks and a send(message) method. The documented signature for close() is close(): void, so do not await it as though it returned a promise. ConnectionTransport API reference
What the interface does not specify
The interface signature identifies close() as the transport’s shutdown hook, but does not define whether a particular implementation must close a socket, notify listeners, be idempotent, or release additional resources. Follow and document the lifecycle contract of your transport implementation for those details.
#1 Best Overall
Disconnect or close the browser session
Detach and leave the browser running
Use browser.disconnect() when Puppeteer should stop controlling the browser but another process or later Puppeteer connection should be able to use the still-running browser.
await browser.disconnect();
Shut down the browser
Use browser.close() when Puppeteer should close the browser it manages and the pages associated with it.
Rank #2
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
await browser.close();
The browser API reference demonstrates disconnecting and reconnecting through the browser WebSocket endpoint before closing the browser. The browser-management guide is published under Puppeteer’s next documentation path, so check the stable API reference and your installed version when behavior is version-sensitive. Browser management guide
Recommended Free Tools
Close a context or a single page instead
If the browser should stay open but only a portion of its work should end, close the narrower target:
Rank #3
- One page:
await page.close(). It returns a promise and can take{ runBeforeUnload: true }when the page’s before-unload behavior should run. Page.close() API reference - An isolated context:
await context.close()closes the context and all its pages. Puppeteer’s default context cannot be closed. BrowserContext API reference
Common mistakes and fixes
- Awaiting
transport.close(): it is documented as returningvoid, not a promise. Call it directly. - Using
browser.close()when the browser must remain available: usebrowser.disconnect()to detach Puppeteer without shutting down the browser process. - Using
browser.disconnect()when the browser must stop: disconnecting leaves the browser process running; usebrowser.close()to shut it down. - Trying to close the default context: the default context cannot be closed. Close an isolated context or close individual pages instead.
- Assuming the interface defines socket or event cleanup: it does not specify those implementation details. Check the transport’s own lifecycle documentation and handle its resources accordingly.
Or skip the browser setup
If your goal is simply to capture a website rather than manage a Puppeteer browser session, ScreenshotNeo returns a screenshot or PDF from one GET request. Its API removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are never billed. An MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000.
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, then sign up for 1,000 free screenshots a month, with no card.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Version note
Puppeteer’s stable API references surfaced in versions 25.3.0 through 25.12.0. Confirm the method signatures and version-specific behavior against the documentation for the version installed in your project.
Quick Recap
Best Value
Rank #4
- 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
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.




