Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk3 min

How to List Frames on a Page with Puppeteer

List attached Puppeteer frames with page.frames(), get their URLs with frame.url(), or recursively traverse childFrames() to retain the nested frame tree.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use page.frames() to get every frame currently attached to a Puppeteer Page, then call frame.url() for each frame’s URL. If you need to preserve nested parent-child relationships, start at page.mainFrame() and recursively walk each frame’s childFrames().

List every frame and its URL

For a flat array of frames on the current page, use page.frames(). Map over the returned Frame objects to read their URLs:

As an Amazon Associate I earn from qualifying purchases.

const frames = page.frames();
console.log(frames.map(frame => frame.url()));

This includes the main frame as well as attached child frames. The result is a snapshot of frames attached when the method is called; it is not a browser-wide list of tabs. See Puppeteer’s Page API.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep nested frames in a tree

A flat list is convenient when you only need frame objects or URLs. To see which frames are nested under others, begin with the page’s main frame and recurse through childFrames():

function dumpFrameTree(frame, indent = '') {
  console.log(`${indent}${frame.url()}`);

  for (const child of frame.childFrames()) {
    dumpFrameTree(child, `${indent}  `);
  }
}

dumpFrameTree(page.mainFrame());

Each level is indented beneath its parent. This follows the recursive traversal pattern in Puppeteer’s official Frame API. A frame represents a DOM frame, comparable to an <iframe>; frames can contain nested frames.

Choose the right method

Need Use Result
A quick list of frames page.frames() Flat array of attached Frame objects
Each frame’s URL frame.url() URL string for that frame; see Frame.url()
Parent-child nesting page.mainFrame() and recursive frame.childFrames() Frame tree in parent-first order
Open pages in the browser browser.pages() Pages (tabs), not frames; by default, non-visible pages such as background pages are omitted. See Browser.pages()

Account for frames changing over time

Frame enumeration describes the current attached frames, and pages may change after navigation or other activity. Puppeteer documents frame-attached, frame-navigated, and frame-detached events on the parent page. If you need a later state, enumerate again; if you need to react as changes happen, track those lifecycle events using the page’s event API as documented in the Frame API.

Keep the scope clear: page.frames() inspects one page’s frame tree. To enumerate browser pages, use browser.pages() instead.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshooting frame lists

  • The list is empty or incomplete: Check that you are querying the intended Page and that its content has reached the point where the frames are attached. For a dynamic page, enumerate again after the relevant navigation or track frame lifecycle events.
  • You see URLs but not nesting: page.frames() returns a flat array. Traverse from page.mainFrame() through childFrames() when the parent-child structure matters.
  • You expected other tabs: Frames belong to a page. Use browser.pages() for the browser’s pages; its default behavior omits non-visible pages such as background pages.
  • A frame URL changes or a frame disappears: The frame may have navigated or detached since an earlier enumeration. Take a fresh snapshot or respond to the documented lifecycle events.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is to capture a page rather than inspect Puppeteer’s frame objects, ScreenshotNeo offers a one-request screenshot API. It is not a replacement for frame enumeration; use it when you need the rendered page as an image or PDF.

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. It accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server provides screenshot tools for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000.

Sign up free for 1,000 screenshots a month with no card.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.