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

Listen for Puppeteer page changes by attaching a callback to the Page object: use page.on('eventName', handler) for a persistent listener, page.once('eventName', handler) for a one-time listener, and page.off('eventName', handler) to remove a listener. Use lifecycle events for document milestones, framenavigated for URL changes in frames, popup for new tabs or windows, and request/response events to observe network activity.

Register and remove a Page event listener

Puppeteer’s Page is an EventEmitter. Register a callback with the event name and handler; you do not need to enable request interception just to observe ordinary traffic. The Page API reference for Puppeteer 25.12.0 documents these listener patterns. Check the API reference matching your installed version for event availability and payload details: Puppeteer Page API.

Persistent listener

function logRequest(request) {
  console.log('A request was made:', request.url());
}

page.on('request', logRequest);

// Later, when the listener is no longer needed:
page.off('request', logRequest);

Keep the same function reference for page.off. Passing a newly written anonymous function will not remove the handler registered earlier.

One-time listener

page.once('load', () => console.log('Page loaded!'));

The callback runs for the next matching event and is then removed. Use page.on when the callback should continue to run on subsequent occurrences.

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

Choose the event that matches the change

Page events describe different kinds of activity. The event catalogue lists names and payloads, but its surfaced reference is the next-version PageEvent reference; verify the matching release documentation before relying on a particular event.

What you need to detect Event or API What the callback receives or tells you
Document load milestone load Page lifecycle event
DOM content ready domcontentloaded Page lifecycle event
Frame URL change or frame addition/removal framenavigated, frameattached, framedetached A Frame object
Page opens a new tab or window popup The popup’s Page
Page JavaScript logs or warns console A ConsoleMessage
Uncaught page exception pageerror Error data
Observe network traffic request, response, requestfinished, requestfailed An HTTPRequest or HTTPResponse, depending on event
Control or block network traffic setRequestInterception(true) with a request handler Requests that must be resolved safely

Detect document and frame changes

Document lifecycle milestones

load and domcontentloaded are Page events for document lifecycle milestones. They are not interchangeable: choose the milestone that matches what your next step needs. For example, DOM content being ready does not itself establish that every resource or later page script has finished.

Frame navigation, including URL changes

Listen for framenavigated when you need to know that a frame navigated, then inspect the provided frame rather than assuming every event represents the main document:

Rank #2
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option
page.on('framenavigated', frame => {
  console.log('Frame navigated to:', frame.url());
});

This can report navigation in an iframe as well as the main frame. For frame creation or removal, use frameattached or framedetached where supported by your installed version.

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

Wait for navigation without racing it

If a click is expected to navigate, start waiting for the navigation and trigger the click together. Starting the wait only after the click can miss a fast navigation.

const [response] = await Promise.all([
  page.waitForNavigation(),
  page.click('a.next-page'),
]);

console.log('Navigated to:', page.url());

waitForNavigation() is a wait API, not an event listener. Likewise, networkidle0 and networkidle2 are navigation wait conditions, not Page event names. They refer to active connection limits held for at least 500 ms; choose lifecycle events or wait conditions according to the condition your task actually needs. See the Page interactions guide.

Listen for popups, console output, and page errors

New tabs and windows

The popup event is emitted on the page that opens the new tab or window. Its callback receives the new popup’s Page; the popup belongs to the parent’s browser context.

page.on('popup', popup => {
  console.log('Popup opened at:', popup.url());
});

Browser-side diagnostics

Use console to inspect messages generated by page JavaScript and pageerror to observe uncaught exceptions:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
page.on('console', message => {
  console.log('Page console:', message.type(), message.text());
});

page.on('pageerror', error => {
  console.error('Uncaught page error:', error);
});

A console event provides a ConsoleMessage, while a dialog event provides a dialog object that Puppeteer can accept or dismiss. Consult the version-matched API reference for the exact event payload types in your release.

Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • 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

Observe network requests and responses

Puppeteer emits request and response events during ordinary page activity. A request passes through distinct stages: request fires when the page issues it, response when a response arrives, and requestfinished when the response body has been downloaded and the request completes. If the request fails, requestfailed replaces requestfinished.

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

page.on('response', response => {
  console.log('Response:', response.url(), response.status());
});

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

page.on('requestfailed', request => {
  console.log('Failed:', request.url(), request.failure()?.errorText);
});

The official network logging guide covers these events and their sequence.

HTTP error status versus network failure

An HTTP 404 or 503 is still a response: it normally produces response and then requestfinished, not requestfailed. The latter indicates a network-level failure, not merely an unsuccessful HTTP status. Redirects finish one request and issue another request for the redirected URL.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use request interception only when changing traffic

Interception is for controlling requests, not a prerequisite for observing them. After page.setRequestInterception(true), requests stall until they are continued, answered with a response, aborted, or completed using the browser cache. An unresolved intercepted request can hold up page activity.

await page.setRequestInterception(true);

page.on('request', request => {
  if (request.isInterceptResolutionHandled()) return;

  if (request.url().endsWith('/blocked-resource.js')) {
    request.abort();
  } else {
    request.continue();
  }
});

When other listeners or integrations may also handle the request, check isInterceptResolutionHandled() immediately before resolving it. Keep the check and resolution together synchronously; if your handler performs asynchronous work first, another handler could resolve the request in the meantime. See the request interception guide.

Troubleshoot common Page event mistakes

  • A listener never fires: confirm the event name and payload against the documentation for your installed Puppeteer version. For navigation-triggered events, register the wait before or alongside the action that causes navigation.
  • page.off does not remove the listener: pass the exact same callback function reference used with page.on.
  • A 404 does not trigger requestfailed: that is expected; inspect the HTTP response status because an HTTP error is still a completed response.
  • Intercepted requests hang: ensure every request is continued, responded to, or aborted, and guard against a request another handler has already resolved.
  • networkidle0 is not firing as an event: use it as a navigation wait condition, not as an argument to page.on.
  • A navigation event seems unrelated to the main page: inspect the event’s Frame; frame navigation events can involve an iframe.

Or skip the browser setup

If your goal is simply to capture a website rather than build a Puppeteer event workflow, ScreenshotNeo is a website screenshot API and MCP server. Its one-call GET request returns a PNG, JPEG, WebP, or PDF. See the ScreenshotNeo API docs for 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 or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; those steps can be turned off. Bot checks, blank pages, and failed loads are not billed, and responses identify page verdict and billing status in headers. Its MCP server lets AI agents use screenshot tools, and the free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up for 1,000 free screenshots a month, with no card required.

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

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.