The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Use Puppeteer’s synchronous page.url() method to get the current URL of the page’s main frame:
const currentUrl = page.url();
console.log(currentUrl);
It returns a string; you do not need await. For an iframe, get its Frame and call frame.url() instead.
As an Amazon Associate I earn from qualifying purchases.
Get the main page URL
page.url() is a shortcut for page.mainFrame().url(), so it reports the URL of the main frame—not the URL of an embedded iframe. See the Puppeteer Page API.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
const currentUrl = page.url();
console.log(currentUrl);
The call is synchronous. Add await only to the action or wait that must finish before you read the URL, not to page.url() itself.
#1 Best Overall
Read the URL after navigation
If a click triggers a navigation, start waiting for that navigation at the same time as the click. Otherwise, the click could navigate before the wait is registered.
const [response] = await Promise.all([
page.waitForNavigation(),
page.click('a.my-link'),
]);
const currentUrl = page.url();
console.log(currentUrl);
waitForNavigation() resolves with the main-resource response, or null when there is no such response. You can still read the current URL with page.url() afterward. See the Puppeteer navigation API.
Rank #2
Single-page applications and History API changes
Puppeteer treats URL changes through anchor navigation and the History API as navigation, including changes made with pushState. Wait for the action or URL-changing operation to finish, then call page.url(). The same concurrent-wait pattern is useful when that operation is triggered by a click. See the Puppeteer navigation FAQ.
Free tools Windows power users keep installed
One-click scans. No signup required.
Get a URL from an iframe
Use the relevant Frame object’s url() method. Identify the frame using a stable property of your application, such as a known URL pattern:
const frame = page.frames().find(frame => frame.url().includes('/embedded/'));
const frameUrl = frame?.url();
console.log(frameUrl);
page.frames() returns the page’s current frame tree, and Frame.url() returns the URL for that specific frame. The optional chaining above leaves frameUrl undefined if no matching frame is found; handle that case if your code requires a URL. See the Puppeteer Frame API.
Don’t confuse reading a URL with navigating
page.url()reads the main frame’s current URL.frame.url()reads the URL of a specific frame.page.goto(url)navigates to a URL; it is not a getter. It returns a response ornull. In documented cases such as navigating toabout:blankor changing only the URL hash, it can returnnull. See the Puppeteer Page.goto API.
Troubleshooting
The value is the old URL
You may be reading it before the navigation or URL-changing operation has completed. For a click that navigates, register waitForNavigation() alongside the click with Promise.all(), then call page.url().
Rank #4
The URL is for the page, not the embedded content
page.url() returns the main frame URL. Find the relevant frame in page.frames() and use that frame’s url().
waitForNavigation() returned null
A null navigation response does not prevent checking the resulting URL. Read page.url() after the wait and action have completed.
Best Value
The code says page.url is not a function
Check that page is the Puppeteer Page object returned by your browser or context setup, rather than a URL string or another object. Also check the Puppeteer documentation for the version installed in your project; the published API pages may describe different versions.
Or skip the browser setup
If you need a screenshot rather than a Puppeteer-controlled browser page, ScreenshotNeo returns a capture from one GET request. For example, with cURL:
Quick Recap
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 documentation for setup and options. It removes cookie banners, newsletter popups, and chat widgets 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 a month with no card; paid plans start at $5 for 3,000. Sign up for free.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesProduct 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.




