Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Listen for the page’s request event and call url() on the HTTPRequest object: page.on('request', request => console.log(request.url())). This logs requests without enabling interception.

Log request URLs in Puppeteer

Here is a complete example using the documented Puppeteer request event pattern:

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();
const page = await browser.newPage();

page.on('request', request => {
  console.log(request.url());
});

await page.goto('https://example.com');
await browser.close();

The page emits request when it issues a request, and the event supplies an HTTPRequest. Its url() method returns the request URL as a string. Puppeteer listens for network requests and responses by default, so observation alone does not require request interception. See the Puppeteer network logging guide and the HTTPRequest.url() API reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Filter for a particular request

Read the URL inside the event callback, then apply the condition your application needs. For example, to log URLs containing /api/:

page.on('request', request => {
  const url = request.url();
  if (url.includes('/api/')) {
    console.log(url);
  }
});

The path fragment is only an example; match a full URL, host, path, or other request property as appropriate for your task.

Request URL and response URL are not the same observation

A request listener receives an HTTPRequest; a response listener receives an HTTPResponse. Both expose url(), but use the object that corresponds to the event you are handling. The API reference documents the page request event and its HTTPRequest object: PageEvent API reference.

What happens with redirects

Puppeteer describes a redirect as one request finishing successfully, followed by a new request to the redirected URL. A request listener can therefore log the original URL and then the destination URL as separate requests. Do not assume the original request object simply changes its URL in place. See the network logging guide.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use interception only to change request behavior

For logging alone, do not call page.setRequestInterception(true). Interception is for workflows that modify, abort, or fulfill requests. Once enabled, each request stalls until it is continued, responded to, aborted, or completed using the browser cache. An inspection-only interception handler must still resolve every intercepted request or navigation can hang. Details are in the setRequestInterception() API reference and network interception guide.

If interception is genuinely needed, a minimal handler that logs and continues looks like this:

await page.setRequestInterception(true);

page.on('request', request => {
  console.log(request.url());
  request.continue();
});

When multiple handlers or asynchronous work may resolve the same intercepted request, check request.isInterceptResolutionHandled() before resolving it, and check again after an await. Another handler may have resolved it in the meantime. See Puppeteer’s network interception guidance.

Troubleshooting

  • No URLs appear: Attach the listener before the navigation or action that triggers requests. The callback only observes requests issued after it is registered.
  • The page hangs after enabling interception: Ensure every intercepted request is continued, responded to, or aborted. Remove interception entirely if you only need to log URLs.
  • You see multiple URLs for a navigation: These may be distinct requests, including a redirect destination or page subresources. Log each event and interpret it as a request, not necessarily as the main document only.
  • You need the URL associated with a response: Handle the response event and read its HTTPResponse.url(), rather than treating the request event as a response.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is a clean screenshot rather than request-level debugging, ScreenshotNeo is a website screenshot API and MCP server. A single GET request can return an image or PDF; cookie banners, newsletter popups, and chat widgets are removed before capture. Bot checks, blank pages, and failed loads are never billed, and an MCP server lets AI agents take screenshots.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

cURL example (see the ScreenshotNeo API documentation):

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo’s free plan.

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.