The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →After navigating to the page, get its title with await page.title(). Puppeteer returns the title as a string through a Promise.
Get the title after navigating
Use Puppeteer’s dedicated Page.title() method. Its documented signature is title(): Promise<string>, and it is a shortcut for page.mainFrame().title(). See the Puppeteer Page.title() API reference.
import puppeteer from 'puppeteer';
const browser = await puppeteer.launch();
try {
const page = await browser.newPage();
await page.goto('https://example.com');
const title = await page.title();
console.log(title);
} finally {
await browser.close();
}
The navigation happens before the title read, so the result belongs to the destination page. The launch, page creation, and navigation pattern follows Puppeteer’s getting-started guide. That guide also documents importing puppeteer-core instead of puppeteer when that package fits your setup.
Choose an alternative only when you need it
Read the DOM title as part of page-context work
If title retrieval is one part of a larger DOM computation, use page.evaluate():
#1 Best Overall
const title = await page.evaluate(() => document.title);
Page.evaluate() runs the function in the page context and returns its result; if the function returns a Promise, Puppeteer awaits it. For simply retrieving a title, page.title() is shorter and more direct. See the Page.evaluate() API reference.
Select the title element explicitly
Use $eval() if selecting the <title> element is itself part of what you need to do:
Rank #2
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
const titleText = await page.$eval('title', el => el.textContent);
$eval() passes the first matching element to the callback and throws if the selector has no match. Prefer page.title() when the goal is just the document title. See the Page.$eval() API reference.
Handle common issues
- The value is empty or unexpected: confirm that
page.goto()completed before callingpage.title(), and check that the URL is the page you intended to load. - Your script does not receive a string immediately:
page.title()returns a Promise. Useawaitinside an async function or a top-level-await environment. $eval()throws: it throws when notitleelement matches. Usepage.title()for direct title retrieval, or handle the missing selector if using$eval()for another reason.
Or skip the browser setup
If you need a screenshot rather than a Puppeteer title value, ScreenshotNeo can return one from a single GET request. Its pre-capture cleanup accepts cookie/consent banners 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 are not billed. It also provides an MCP server with screenshot and PDF tools for AI agents. The free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
See the ScreenshotNeo API documentation for request details. ScreenshotNeo is a website screenshot API and MCP server from Yorker Media; the call above captures an image, not the page’s title text.
Rank #3
- 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
Sign up for ScreenshotNeo’s free plan: 1,000 screenshots a month, no card required.
Quick Recap
Best Value
Rank #4
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.

