Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk4 min

How to Get the Frame for a Puppeteer Response

Call response.frame() on Puppeteer’s HTTPResponse to get the frame that initiated it. Handle its null case and use waitForFrame() only when waiting for a frame itself.

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.

Call response.frame() on Puppeteer’s HTTPResponse. It returns the Frame that initiated that response, or null for a response 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:

As an Amazon Associate I earn from qualifying purchases.

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() identifies the frame that initiated the response. It is not a lookup by URL, and the returned frame may not be the main frame: a request can originate from a subframe.

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

Wait for the right response

page.waitForResponse() accepts a URL or a predicate and resolves to the matching HTTPResponse. A predicate is useful when the URL alone is not enough to identify the request. Combine relevant properties such as the URL and status so the wait does not resolve for an unrelated response.

If an action triggers the request, start waiting before performing that action. This avoids missing a quick response:

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

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

if (frame !== null) {
  console.log(frame.url());
}

In Puppeteer 25.12.0, documented on 2026-10-03, the default wait timeout is 30 seconds. Change the default with page.setDefaultTimeout(), or cancel a wait with an AbortSignal. If a wait times out, check that the action actually triggers a matching response and that the predicate matches its URL and other properties.

Use the response event when it is already available

If your code handles responses through the page’s response event, the same method applies to the event’s response object:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
page.on('response', response => {
  const frame = response.frame();
  if (frame !== null) {
    console.log(response.url(), frame.url());
  }
});

The event handler should account for null rather than assuming every response has a usable frame.

Do not confuse a response frame with waiting for a frame

response.frame() answers: “Which frame initiated this response?” page.waitForFrame() solves a different problem: it waits for a frame matching a URL or predicate to appear. Use the latter when the frame itself is what you are waiting for; it is not a substitute for retrieving the initiating frame from a known response.

Account for navigation edge cases

A response’s frame() method can return null for navigation to an error page. Treat that as a distinct outcome and decide how your application should handle it before calling methods such as frame.url().

Also, page.goto() does not always return an HTTPResponse: it returns null for about:blank and same-URL hash navigation. Check the value returned by goto() before calling frame() on it:

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 response = await page.goto('https://example.com');

if (response === null) {
  // No HTTPResponse was returned for this navigation.
} else {
  const frame = response.frame();
  if (frame !== null) {
    console.log(frame.url());
  }
}

Or skip the browser setup

If your task is to capture a website image or PDF rather than inspect a Puppeteer Frame object, ScreenshotNeo offers a screenshot API. A single GET request can return a screenshot or PDF; it does not return Puppeteer’s response or frame objects.

For example, save a WebP screenshot of a page with cURL:

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. Cookie banners, newsletter popups and chat widgets are removed before capture by default, and those steps can be turned off. Bot checks, blank pages, failed loads, timeouts and cache hits are not billed; response headers identify the page verdict and billing status. An MCP server provides screenshot tools for Claude, Cursor and other MCP clients. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots.

Sign up free for 1,000 screenshots a month with no card.

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

Troubleshooting

  • frame.url() throws an error: Check that response.frame() did not return null before calling frame methods.
  • The wait times out: Start waitForResponse() before the triggering action, verify the action sends a request, and make the predicate specific to the response you expect. The default timeout documented for Puppeteer 25.12.0 is 30 seconds; adjust it with page.setDefaultTimeout() or use an AbortSignal when cancellation is needed.
  • page.goto() did not give you a response: Its result can be null for about:blank and same-URL hash navigation. Branch on the return value before using response methods.
  • You need to wait for a newly appearing frame, not identify a response’s source: Use page.waitForFrame() with an appropriate URL or predicate.

Version note

The API references reviewed document Puppeteer 25.12.0 as of 2026-10-03. If your installed version behaves differently, check the API documentation for that version and confirm which version your project uses.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.