Recommended Free Tools
Use page.waitForResponse() to wait for a matching network response in Puppeteer. Start the wait before the click or other action that triggers the request, then await the response promise. This avoids missing a fast response and gives you an HTTPResponse to inspect.
Wait for a response triggered by an action
Register the response wait first, perform the action, then await the saved promise. Use a predicate when you need to identify a particular endpoint or check the response status.
const responsePromise = page.waitForResponse(response =>
response.url() === 'https://example.com/api/data' && response.status() === 200
);
await page.locator('button.load-data').click();
const response = await responsePromise;
const body = await response.json();
console.log(body);
This example assumes page is an already-open Puppeteer page and that the button causes the matching request. The predicate is evaluated against responses; response.url() and response.status() let it distinguish the target from unrelated traffic.
Match the response you actually need
Use a URL string for an unambiguous endpoint
If only one response can match the URL, pass that URL directly:
#1 Best Overall
const responsePromise = page.waitForResponse('https://example.com/api/data');
await page.locator('button.load-data').click();
const response = await responsePromise;
Use a predicate for repeated endpoints or request details
Applications may call an endpoint more than once, append query parameters, or use different methods. A predicate can narrow the match. For example, this waits for a successful response to a POST request at one exact URL:
const responsePromise = page.waitForResponse(response => {
if (response.url() !== 'https://example.com/api/search') return false;
if (response.request().method() !== 'POST') return false;
return response.status() === 200;
});
await page.locator('button.search').click();
const response = await responsePromise;
Receiving a response does not mean the application operation succeeded: an HTTP 404 or 503 is still a response. Check the status or inspect the response body and handle error cases explicitly if your script needs to distinguish success from failure.
Rank #2
Set a timeout and handle a missing match
waitForResponse() uses the page’s default timeout, which is 30 seconds unless changed. You can set a timeout for this wait; timeout: 0 disables it. For routine automation, a finite timeout is usually safer than waiting indefinitely.
const responsePromise = page.waitForResponse(
response => response.url().includes('/api/data'),
{ timeout: 10_000 }
);
await page.locator('button.load-data').click();
const response = await responsePromise;
The wait also accepts a cancellation signal. This is useful when a broader workflow may be abandoned before its response arrives:
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesconst controller = new AbortController();
const responsePromise = page.waitForResponse(
response => response.url().includes('/api/data'),
{ timeout: 10_000, signal: controller.signal }
);
await page.locator('button.load-data').click();
const response = await responsePromise;
Call controller.abort() from the surrounding workflow when you need to cancel the wait. Handle cancellation and timeout errors at the level appropriate to your script.
Choose the wait that matches the condition
| What you need to observe | Puppeteer method | What it gives you |
|---|---|---|
| A matching network response arrived | page.waitForResponse() |
The matched response |
| The page issued a matching request | page.waitForRequest() |
The matched request, not its response |
| An element appeared, became visible, or became hidden | page.waitForSelector() |
An element handle or a null result for a hidden element |
| A custom page-context condition became truthy | page.waitForFunction() |
The function result |
| An element is ready for interaction | A Puppeteer locator action | The action, with automatic waiting for the element to be present and suitable |
Do not substitute a navigation wait for an XHR or fetch response when the action does not navigate. Likewise, a DOM change may be the right condition if the user-visible result matters more than the network event; use the wait that represents what your script needs to know.
Rank #4
Troubleshoot a response wait that times out
- The trigger did not run: confirm the click, submit, or other action completed and that it actually initiates a request.
- The match is too narrow or wrong: temporarily log response URLs, methods, and statuses, then adjust the predicate to match the request the page really makes. Query strings, request method, and status can matter.
- The wait starts too late: create the
waitForResponse()promise before performing the triggering action. - The server returned an error status: the wait can still resolve because an HTTP error is still a response. Inspect the status and handle it rather than assuming a resolved promise means success.
- The response takes longer than expected: choose a realistic finite timeout for the workflow. Disable the timeout only when indefinite waiting is deliberate.
Or skip the browser setup
If the goal is to capture a page image or PDF rather than automate its network response, ScreenshotNeo offers a one-request screenshot API. For example, save a webpage screenshot as WebP:
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 cookie banners, newsletter popups, and chat widgets before the shot; bot checks, blank pages, and failed loads are never billed. Its 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. Sign up for ScreenshotNeo and get 1,000 free screenshots a month, with no card required.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Frequently Asked Questions
Does `waitForResponse()` resolve on a 404 or 503?
Yes. It waits for a received response, not a successful application result. Check the response status when success matters.
Best Value
Can I cancel a pending response wait?
Yes. Pass an `AbortSignal` in the options and abort its controller when the surrounding workflow should stop waiting.
Quick Recap
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.

