Recommended Free Tools
Read the frame’s detached property: if (frame.detached) { ... }. It is a boolean indicating whether that Frame reference has been detached. The older frame.isDetached() method is obsolete; use the property instead. Puppeteer Frame API
Check a known frame reference
Use the property wherever you already have a Puppeteer Frame:
As an Amazon Associate I earn from qualifying purchases.
if (frame.detached) {
console.log('The frame has been detached');
}
In TypeScript, the same check applies:
if (frame.detached) {
// Do not use this Frame for further frame work.
}
The property is a point-in-time read. A page can change after the check, so check close to the frame operation and handle errors from operations that race with navigation or removal.
Free tools Windows power users keep installed
One-click scans. No signup required.
React when a frame detaches
To respond to a detachment transition, listen for the page’s framedetached event:
#1 Best Overall
page.on('framedetached', detachedFrame => {
console.log('Frame detached:', detachedFrame.url());
});
The event supplies the detached Frame. Register the listener before the action that might remove or replace the iframe; otherwise, that transition may already have happened. Puppeteer PageEvent API
Confirm whether a saved reference is still attached
page.frames() returns the frames currently attached to the page. You can corroborate a saved reference against that list:
Rank #2
const stillAttached = page.frames().includes(frame);
For a direct check of the known frame’s state, prefer frame.detached. Puppeteer Page.frames API
Checks that can mislead
frame.parentFrame() === nulldoes not prove detachment: Puppeteer documents that it is also true for the main frame.- A stale element handle or JavaScript handle is not a substitute for checking
frame.detached. Handles may be disposed when their associated frame navigates away or its parent execution context is destroyed; that concerns execution-context lifetime, not a definitive frame-detachment test. Puppeteer JSHandle API - A successful property check does not guarantee a later operation will succeed. The frame may be removed between the check and use.
Which approach should you use?
| Approach | Use it for | Limitation |
|---|---|---|
frame.detached |
Checking a known frame reference now | It reports state only when read; the page can change afterward. |
page.on('framedetached', handler) |
Reacting to a detachment transition | The listener must be registered before the transition. |
Version note
The current Puppeteer Frame API documents detached as a read-only boolean property and marks isDetached() obsolete. Check the API reference for the Puppeteer version installed in your project if version compatibility matters. Frame API reference
Or skip the browser setup
If your goal is to capture a page rather than manage a Puppeteer frame, ScreenshotNeo provides a screenshot API and MCP server. A single request can return a screenshot or PDF:
Quick Recap
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 API documentation for request options. Cookie banners, newsletter popups and chat widgets are removed before capture; bot checks, blank pages and failed loads are not billed. Its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up for free.
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.
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 →




