Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsCall frame.page() to get the Puppeteer Page that owns a frame:
const page = frame.page();
The call is synchronous. It returns the owning page; it does not turn an iframe into a separate tab. If your task is to read or interact with content inside that iframe, keep using the Frame object.
As an Amazon Associate I earn from qualifying purchases.
What frame.page() returns
Puppeteer’s documented signature is page(): Page. The returned object is “The page associated with the frame.” See the Frame.page() API reference.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →const page = frame.page();
// `page` is the Page that contains `frame`.
// No `await` is needed for frame.page().
A Page represents a browser tab (or an extension background page); a Frame represents a document frame such as an <iframe>. A page can contain a main frame and nested child frames. Getting the page from a frame identifies its owner, but does not make the iframe independently navigable as a tab.
#1 Best Overall
Choose Page or Frame for the operation
| Need | Use | Execution scope |
|---|---|---|
| Page-level controls or the page that owns a frame | frame.page(), then the relevant Page method |
The owning browser page |
| Evaluate JavaScript or query elements inside a particular iframe | frame.evaluate(), frame.$eval(), frame.waitForSelector(), or another Frame method |
That frame’s document context |
| Query the main document | page.$(selector) or another page selector shortcut |
The page’s main frame |
Puppeteer documents Frame.evaluate() as behaving like Page.evaluate(), except that it runs in the selected frame’s context. By contrast, page.$(selector) is a shortcut for page.mainFrame().$(selector); it does not search every child frame. See the Frame API reference and Page API reference.
Find the frame before getting its page
If you already hold the Frame, call frame.page() directly. To locate a frame from a page, inspect all frames with page.frames() or traverse from page.mainFrame() using childFrames().
const frames = page.frames();
for (const frame of frames) {
console.log(frame.url());
// Use frame.evaluate(...) or other Frame methods for this frame's content.
}
You can also traverse the frame tree:
function visit(frame) {
console.log(frame.url());
for (const child of frame.childFrames()) {
visit(child);
}
}
visit(page.mainFrame());
When a frame will appear later, the Page API includes waitForFrame() for waiting until a matching frame is available. Check the current Page API reference for its signature and matcher options for your installed Puppeteer version.
Recommended Free Tools
Identify a frame using its current element attributes
The Frame reference marks frame.name() deprecated: its value is captured when the frame is created and may not reflect later changes to the DOM name attribute. For the current name or ID, read the frame element instead:
Rank #3
for (const frame of page.frames()) {
const element = await frame.frameElement();
const attributes = await element.evaluate(el => ({
name: el.getAttribute('name'),
id: el.id,
}));
console.log(frame.url(), attributes);
}
Use frame.page() after selecting the frame if you need its owning page; use Frame methods for work within its document. The relevant details are in Puppeteer’s Frame API reference.
Or skip the browser setup
If the actual goal is a screenshot rather than DOM-level iframe interaction, ScreenshotNeo offers a website screenshot API and MCP server. One GET request can return an image or PDF. The API handles cookie banners, popups and chat widgets before the shot; bot checks, blank pages and failed loads are never billed. Its MCP server lets AI agents take screenshots, and 1,000 screenshots a month are free with no card; paid plans start at $5 for 3,000.
For example, this cURL request captures a page as WebP:
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 options and response details. Sign up for 1,000 free screenshots a month with no card.
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.




