Call response.url() on Puppeteer’s HTTPResponse object. For a navigation, check that page.goto() returned a response first; after redirects, that response represents the final URL.
Get the URL from an HTTPResponse
HTTPResponse.url() returns the URL of the response as a string. It is synchronous, so do not use await for this method.
As an Amazon Associate I earn from qualifying purchases.
const url = response.url();
console.log(url);
This works for an HTTPResponse you already have, including one received from a navigation or a response event.
Get the final URL after navigation
page.goto() resolves to the main resource’s HTTPResponse, or null in documented cases such as navigation to about:blank or to the same URL with only a hash change. Guard against null before calling url().
#1 Best Overall
const response = await page.goto('https://example.com');
if (response) {
console.log(response.url());
}
When a navigation follows redirects, page.goto() resolves with the response from the last redirect. Therefore, response.url() gives the final response URL, not necessarily the address originally requested. See the Puppeteer HTTPResponse.url() API and Page.goto() API.
Inspect the original request and redirect history
Puppeteer distinguishes the request URL from the response URL: HTTPRequest.url() returns a request’s URL, while HTTPResponse.url() returns the response URL. To inspect requests preceding the final response, get the response’s request and call redirectChain().
Rank #2
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
const response = await page.goto('http://example.com');
if (response) {
console.log('Response URL:', response.url());
const redirects = response.request().redirectChain();
console.log('Redirected from:', redirects.map(request => request.url()));
}
The redirect chain contains earlier request objects; it is empty when there were no redirects. The final URL is still obtained from response.url(). See the HTTPRequest.url() API and HTTPRequest.redirectChain() API.
Recommended Free Tools
Handle null responses and HTTP error statuses
- No response: A
nullresult has no response URL. Check it before accessing response methods. - 404 or 500: An HTTP error status can still have an
HTTPResponse. If you need to branch on success, inspectresponse.status(); do not treat the existence of a response as proof of a successful status.
For example:
const response = await page.goto('https://example.com/missing');
if (!response) {
console.log('Navigation returned no response');
} else {
console.log('URL:', response.url());
console.log('Status:', response.status());
}
Troubleshoot common mistakes
response.url is not a function: Confirm thatresponseis a PuppeteerHTTPResponse, rather than a URL string or another object.- Cannot read properties of null:
page.goto()can returnnullin documented special cases. Add a null check before callingurl(). - The URL differs from the one passed to
goto(): That is expected after redirects. Useresponse.url()for the final response andresponse.request().redirectChain()for earlier request URLs. - The page returned 404 or 500: A response may still be present. Read
response.status()when status affects your logic.
Method documentation has appeared across Puppeteer versions; consult the documentation matching your installed version when checking version-specific behavior. The API references for HTTPResponse.url() and Page.goto() describe the relevant return values.
Rank #3
Or skip the browser setup
If your goal is a clean screenshot rather than inspecting a Puppeteer response, ScreenshotNeo returns a screenshot or PDF from one GET request. Its API removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are not billed. An MCP server lets AI agents take screenshots, and the free plan includes 1,000 screenshots a month with no 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 options. Sign up for 1,000 free screenshots a month, with no card required.
Quick Recap
Best Value
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
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.

