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

Call response.frame() on the Puppeteer HTTPResponse. It returns the frame that initiated the response, or null if the response is associated with navigation to an error page. Check for null before using frame methods.

Get the frame from an HTTPResponse

For a response returned by page.waitForResponse(), call frame() directly on that response:

const response = await page.waitForResponse(response =>
  response.url().includes('/api/data') && response.status() === 200
);

const frame = response.frame();
if (frame === null) {
  // Handle a response associated with navigation to an error page.
} else {
  console.log('Initiating frame URL:', frame.url());
}

HTTPResponse.frame() returns “A Frame that initiated this response, or null if navigating to error pages.” See the Puppeteer HTTPResponse.frame() API reference.

Wait for the response without missing it

If a user action triggers the request, start waiting before performing the action. Then await the response promise and get its frame:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const responsePromise = page.waitForResponse(response =>
  response.url().includes('/api/data')
);

await page.click('button.load-data');
const response = await responsePromise;
const frame = response.frame();

if (frame === null) {
  // Decide how the caller should handle this case.
} else {
  console.log(frame.url());
}

page.waitForResponse() accepts a URL or a predicate and resolves to the matching HTTPResponse. Puppeteer 25.12.0 documents a default timeout of 30 seconds; configure it with Page.setDefaultTimeout(), or cancel the wait with an AbortSignal. See the waitForResponse() API reference.

Choose a predicate that identifies the response

Match a distinguishing URL, status, or other response property. A broad substring can match an unrelated request if several URLs share that text. Puppeteer’s documented example uses response URL and status; adjust the predicate to the request your page action actually produces.

Handle responses from an event listener

If you receive the response through the page’s response event instead, use the same method on the event’s response object:

page.on('response', response => {
  const frame = response.frame();
  if (frame) {
    console.log(response.url(), frame.url());
  }
});

The null check matters here too: a response can have no initiating frame when it is associated with navigation to an error page.

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

Do not confuse a response frame with waiting for a frame

Use response.frame() to identify the frame that initiated a response you already have. Use page.waitForFrame() when your goal is to wait for a frame matching a URL or predicate to appear. These methods answer different questions; waiting for a frame is not a replacement for looking up the frame associated with a particular response. See the waitForFrame() API reference.

Other response and navigation cases

Get the request’s frame

An HTTPResponse exposes its corresponding request through response.request(). The HTTPRequest also has a frame() method, with the same documented null condition for navigation to error pages. See the HTTPResponse.request() reference and HTTPRequest.frame() reference.

Do not assume every page.goto() returns a response

page.goto() returns the main resource’s response, but returns null for about:blank and same-URL hash navigation. Check the result before calling frame():

const response = await page.goto('https://example.com');

if (response === null) {
  // No HTTPResponse was returned for this navigation.
} else {
  const frame = response.frame();
  // Check frame for null before calling Frame methods.
}

See the page.goto() API reference.

Troubleshooting

  • response.frame is not a function: Confirm that the value is a Puppeteer HTTPResponse, not a URL string, request, or other object. A request uses request.frame().
  • frame is null: Do not call methods such as frame.url() on it. Handle the null case as an error-page navigation outcome.
  • waitForResponse() times out: Check that the predicate matches the actual response URL and properties, that the triggering action occurs, and that the wait is started before the action. The documented default timeout for Puppeteer 25.12.0 is 30 seconds; a page-level default timeout can change it.
  • page.goto() produced no response: The result may be null for about:blank or same-URL hash navigation. Guard the result before accessing response methods.
  • The frame is not the one expected: Verify that the response predicate selects the intended request. response.frame() identifies the frame that initiated that specific response; it does not wait for a different frame to appear.

Version note

The cited official Puppeteer API pages reported version 25.12.0 on October 3, 2026. If your installed version behaves differently, check the documentation for that version.

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

Or skip the browser setup

If you need a website screenshot rather than Puppeteer-level frame information, ScreenshotNeo provides a screenshot API and MCP server. A single GET request can return a PNG, JPEG, WebP, or PDF; it does not provide Puppeteer response-frame lookup.

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 API documentation for request options. It removes known cookie and consent banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. Its MCP server offers screenshot tools for AI agents. The free plan includes 1,000 screenshots per 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.