Free tools Windows power users keep installed
One-click scans. No signup required.
Call session.connection() to get the underlying Puppeteer connection. The method returns Connection | undefined, so check for undefined before using the result.
Get the connection from an existing CDPSession
Use the documented connection() accessor:
const connection = client.connection();
if (!connection) {
throw new Error('This CDPSession has no underlying connection');
}
The return value is optional: Puppeteer documents it as the underlying connection “if any.” Do not assume every session has one. See the CDPSession.connection() API reference for the method signature matching the documentation version reviewed on October 3, 2026; consult the API reference for the version installed in your project if it differs.
As an Amazon Associate I earn from qualifying purchases.
Create a session from a page first
If you have a Puppeteer page rather than a session, create a page-attached CDP session and then call the same accessor:
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC 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 & 11const client = await page.createCDPSession();
const connection = client.connection();
if (!connection) {
throw new Error('This CDPSession has no underlying connection');
}
Page.createCDPSession() returns a Promise<CDPSession>. The official Page.createCDPSession() documentation describes creating a session attached to the page.
#1 Best Overall
What the session and connection are for
A CDPSession is Puppeteer’s interface for communicating with the raw Chrome DevTools Protocol. Use send() to issue protocol commands and on() to listen for protocol events. Obtain sessions through Puppeteer APIs; the CDPSession constructor is marked internal, so application code should not instantiate or subclass it. See Puppeteer’s CDPSession API source.
Puppeteer’s implementation also exposes Connection.fromSession(session), which delegates to session.connection(). For ordinary application code, calling the documented method directly is the simple route; there is no need to reach into a private field. The Connection implementation shows that delegation.
Rank #2
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
Handle a missing connection safely
Because connection() may return undefined, narrow the type before calling methods on the result. Throwing, returning an optional result, or taking a fallback path are all reasonable choices depending on whether a connection is required for the operation:
const connection = client.connection();
if (connection === undefined) {
return; // Or handle the session without a connection.
}
// Use documented Connection methods here.
The accessor documents the value it returns, but it does not promise that every internal property or behavior of Connection is stable. Prefer its documented public API. If your code depends on implementation details, verify them against the exact Puppeteer version in your dependency lockfile and consult that version’s documentation.
Rank #3
Troubleshooting
- TypeScript says the connection may be undefined: That is expected. Check for
undefinedbefore using the value, or use an explicit guard that throws when your code requires a connection. - You have a page, not a session: Call
await page.createCDPSession()first, then callconnection()on the returned session. - You are trying to construct a CDPSession yourself: Its constructor is internal. Get the session from a Puppeteer API such as
page.createCDPSession()instead. - Code relies on undocumented connection internals: Check the API and source for your installed Puppeteer version. Repository
maincan change and is not a guarantee for a different release.
Or skip the browser setup
If the goal is simply to capture a website rather than use the Chrome DevTools Protocol directly, ScreenshotNeo offers a one-request screenshot API:
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. Before a capture, it accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets; these steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status. ScreenshotNeo also provides an MCP server with tools for AI agents, including take_screenshot, get_page_info, and capture_pdf.
The free plan includes 1,000 screenshots per month with no card required; paid plans start at $5 for 3,000 screenshots. Learn more at ScreenshotNeo or sign up for 1,000 free screenshots a month with no card.
Recommended Free Tools
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.




