Use await frame.title() to read the title of a specific Puppeteer frame. For the page’s main frame, use await page.title(); it does not return a child iframe’s title.
Get the title from a specific frame
Once you have the Puppeteer Frame object, call its asynchronous title() method and await the returned promise:
As an Amazon Associate I earn from qualifying purchases.
const title = await frame.title();
The method returns a Promise<string>. The Puppeteer Frame API reference documents Frame.title() as returning the frame’s title.
Get the main page’s title instead
If you want the title of the top-level page rather than an iframe, use:
#1 Best Overall
const title = await page.title();
Puppeteer documents Page.title() as a shortcut for page.mainFrame().title(). It therefore reads the main frame, not an arbitrary child frame. See the Page.title() reference.
Find the frame you need
A page can contain multiple frames, including nested frames. Use page.frames() to inspect attached frames, or traverse from page.mainFrame() with childFrames(). Choose a condition that uniquely identifies the frame for your page; the URL substring below is only an example.
Rank #2
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
const frame = page.frames().find(frame => frame.url().includes('/embedded/'));
if (!frame) {
throw new Error('Target frame not found');
}
const title = await frame.title();
console.log(title);
The Frame API reference describes frame relationships and shows how to inspect a frame’s associated iframe element. A frame’s name or the iframe element’s selector is not itself the frame’s title: first identify the right Frame, then call title().
Wait when the frame appears later
If the target frame is added after navigation or page setup, wait for it rather than searching too early. page.waitForFrame() resolves with a matching frame:
Rank #3
const frame = await page.waitForFrame(frame => frame.url().includes('/embedded/'));
const title = await frame.title();
Replace the URL test with the condition that fits your page. Consult the Page.waitForFrame() reference for the method’s current API details.
Use frame-scoped evaluation only when needed
You can also read the document title in that frame’s execution context:
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
const title = await frame.evaluate(() => document.title);
Frame.evaluate() runs in the selected frame. For this specific task, frame.title() is clearer and avoids writing a separate DOM evaluation.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchTroubleshoot common mistakes
- You got the outer page’s title.
page.title()reads the main frame. Find the child frame and callframe.title(). - The value is a promise, not a string. Both title methods are asynchronous; use
awaitor handle the returned promise before using the value. - The frame lookup returns nothing. The frame may not be attached yet, or the matching condition may not uniquely match it. Verify the frame URLs with
page.frames(), refine the condition, or wait withpage.waitForFrame(). - The title is from the wrong embedded document. Pages can have nested frames. Search all attached frames or traverse the frame tree instead of assuming the iframe is a direct child.
Match the documentation to your Puppeteer version
The current official reference pages surfaced for this API do not all show the same version: Frame.title() is documented on a page identifying Puppeteer 25.8.0, Page.title() and the Frame class pages identify 25.12.0, and Page.waitForFrame() identifies 25.9.0. Check the documentation for the version installed in your project before relying on version-specific details.
Best Value
Or skip the browser setup
If you need a screenshot rather than programmatic access to a frame title, ScreenshotNeo provides a website screenshot API. See the ScreenshotNeo documentation for parameters and options.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and responses include X-Page-Verdict and X-Billed headers. Its MCP server includes tools for AI agents to take screenshots, get page information, and capture PDFs. The free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots.
Sign up for 1,000 free screenshots a month, with no card required.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesQuick 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.

