DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
browser automation

How to Wait for Network Requests After `page.select()` in Puppeteer

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

Start the wait before changing the dropdown, then await the wait and page.select() together. This removes the race in which a fast API response arrives before Puppeteer begins listening.

const responsePromise = page.waitForResponse(
  response =>
    response.url().includes('/api/options') && response.status() === 200,
  { timeout: 30000 }
);

await Promise.all([
  responsePromise,
  page.select('#country', 'us'),
]);

const response = await responsePromise;
const data = await response.json();

Use waitForRequest() when proving that the browser sent the request, and wait for a DOM state when proving that the results are visible. Use network-idle only when broad inactivity is genuinely your completion condition.

Why the wait must be registered first

page.select() changes a matching HTML <select> and triggers both change and input events after the supplied options are selected. Applications commonly handle one of those events by issuing an asynchronous fetch. If you write await page.select(...); await page.waitForResponse(...), a quick response can complete before the listener exists, leaving the test waiting until its timeout.

Create the promise first. Creating a Puppeteer wait does not block the page; it installs the listener and returns a promise. Promise.all() then starts the selection and waits for the matching network event concurrently.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

Wait for the specific response (the usual choice)

A response predicate should identify the endpoint and a success condition. Matching only any response is unsafe on pages that load analytics, images, polling data, or several APIs at once.

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://example.test/form', { waitUntil: 'domcontentloaded' });

// Ensure the select exists before starting the workflow.
await page.waitForSelector('select#country', { visible: true });

const responsePromise = page.waitForResponse(
  async response => {
    if (!response.url().includes('/api/options')) return false;
    if (response.status() !== 200) return false;
    // Optional: inspect headers or content type when several calls share a path.
    return response.headers()['content-type']?.includes('application/json');
  },
  { timeout: 30000 },
);

await Promise.all([
  responsePromise,
  page.select('select#country', 'us'),
]);

const response = await responsePromise;
const payload = await response.json();
console.log(payload);
await browser.close();

waitForResponse() accepts a URL or an AwaitablePredicate<HTTPResponse>. The predicate may be asynchronous, so you can inspect headers or parse a body when URL and status are not enough. Its documented default timeout is 30 seconds; pass a workflow-appropriate value explicitly, or use timeout: 0 only when an intentionally unbounded wait is safe.

Match the endpoint narrowly

Prefer a stable path fragment, query parameter, HTTP method (available through the response’s request), status, and, where useful, response content. Avoid a predicate such as response => response.status() === 200; unrelated successful requests can satisfy it.

const responsePromise = page.waitForResponse(response => {
  const request = response.request();
  return request.method() === 'GET'
    && new URL(response.url()).pathname === '/api/options'
    && response.status() === 200;
});

await Promise.all([
  responsePromise,
  page.select('#country', 'us'),
]);

Wait for the outgoing request instead

Use waitForRequest() when the assertion is that selecting the option emitted the expected request. This proves transmission, not server success or UI rendering.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
const requestPromise = page.waitForRequest(
  request => request.url().includes('/api/options')
);

await Promise.all([
  requestPromise,
  page.select('#country', 'us'),
]);

const request = await requestPromise;
console.log('Sent:', request.method(), request.url());

The documented default timeout for waitForRequest() is also 30 seconds, and timeout: 0 disables it. If your test must know that the server completed successfully, wait for the response instead. If it must know that the resulting data was rendered, add a UI assertion.

Wait until the results are actually rendered

A successful response can arrive before framework code updates the DOM. Assert the state the user needs after the network wait.

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

await Promise.all([
  responsePromise,
  page.select('#country', 'us'),
]);

await page.waitForSelector('[data-testid="results-loaded"]', {
  visible: true,
  timeout: 30000,
});

Current Puppeteer guidance recommends locators for interactions because they automatically wait for an element to be present and in the right state. A lower-level waitForSelector() remains useful when no suitable locator operation exists.

Using a locator for readiness

const country = page.locator('select#country');
await country.click(); // Locator checks readiness before acting.

const responsePromise = page.waitForResponse(
  response => response.url().includes('/api/options') && response.status() === 200
);
await Promise.all([
  responsePromise,
  page.select('select#country', 'us'),
]);

Do not replace the selection with a click unless the application requires a user-like interaction. page.select() directly sets option values and dispatches the documented input and change events.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

When network idle is appropriate

If you do not know the endpoint and the real requirement is that the page has stopped making requests, select first and then wait for network idle:

await page.select('#country', 'us');
await page.waitForNetworkIdle({
  idleTime: 500,
  timeout: 30000,
});

Puppeteer defines this as waiting for the network to be idle and guarantees that the promise waits at least the configured idle time. It does not identify which request caused the idle period. Analytics, polling, service workers, long-lived connections, and unrelated resources can delay or prevent idle, while a page can become idle before a framework finishes rendering. A specific response predicate or a visible application-state check is usually more diagnostic.

Combining request, response, and UI checks

For a high-value end-to-end test, make each completion condition explicit:

const requestPromise = page.waitForRequest(
  request => request.url().includes('/api/options')
);
const responsePromise = page.waitForResponse(
  response => response.url().includes('/api/options')
    && response.status() === 200
);

await Promise.all([
  requestPromise,
  responsePromise,
  page.select('#country', 'us'),
]);

await page.waitForSelector('[data-testid="results-loaded"]', {
  visible: true,
  timeout: 30000,
});

Usually a response plus a UI assertion is sufficient. Add the request wait when the outbound URL, method, or payload is itself part of the contract.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

Common failures and precise fixes

The response wait times out

  • Listener attached too late: create the wait promise before page.select() and use Promise.all().
  • Wrong endpoint: log response.url(), then match a stable path, method, status, or content type rather than a guessed URL.
  • No request was triggered: verify that the selected value differs from the current value and that the page’s handler listens for the event dispatched by page.select().
  • Server error: inspect status and body; a predicate requiring 200 will correctly reject a 4xx or 5xx response.

page.select() throws

Puppeteer throws when no matching <select> exists. Wait for the element, check the selector and frame, and confirm that the page has finished navigating. If the control is inside an iframe, obtain its frame and call frame.select() (or use a frame locator) rather than querying the top-level page.

The wrong request satisfies the predicate

Several calls may share a domain or path. Include the exact pathname, query value, request method, status, and a response header or body property. Never use a generic “first response” listener on a busy page.

The test hangs with network idle

Look for polling, streaming connections, service-worker traffic, or third-party scripts. Replace idle with a known response predicate or a DOM state. Keep a finite timeout so a broken page produces a useful failure instead of an infinite wait.

The response arrives but the assertion still fails

Network completion and rendering completion are separate events. Wait for a result row, loading indicator removal, enabled button, URL change, or application-specific test identifier. If the UI is driven by an animation or microtask, assert the final state rather than inserting an arbitrary sleep.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Timeouts, reliability, and diagnostics

  • Use bounded waits, commonly 30 seconds for ordinary test environments, and choose a larger value only for a known slow backend.
  • Include the URL and status in timeout diagnostics by logging requests and responses in a temporary debugging listener.
  • Clean up pages and browsers in finally blocks so a failed wait does not leak processes.
  • Keep predicates deterministic: do not depend on response ordering when multiple requests can legitimately run in parallel.
  • For retries, create a fresh wait promise for every selection attempt; a settled promise cannot observe a later request.
try {
  const responsePromise = page.waitForResponse(
    response => response.url().includes('/api/options')
      && response.status() === 200,
    { timeout: 30000 }
  );
  await Promise.all([responsePromise, page.select('#country', 'us')]);
} finally {
  await browser.close();
}

Or skip the browser setup

If your goal is a clean screenshot after a page change rather than a browser test, ScreenshotNeo provides a website screenshot API. It can wait for a selector, delay, or network idle, and supports custom JavaScript when a dropdown must be changed before capture. Its cleanup removes cookie banners, newsletter popups, and chat widgets before capture.

One GET request returns an image or PDF. See the ScreenshotNeo documentation for all options:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

Only clean shots are billed: bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers identify the page verdict and billing result. ScreenshotNeo also offers an MCP server with take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 screenshots each month with no card; paid plans start at $5 for 3,000. Sign up free to try it.

Practical decision guide

What you need to prove Best wait Why
The browser emitted the API call waitForRequest() Confirms transmission, not server success.
A particular API completed successfully waitForResponse() Matches endpoint and status.
The user can see updated results Response wait plus DOM assertion Separates transport from rendering.
No known endpoint and true inactivity is required waitForNetworkIdle() Broad heuristic; sensitive to background traffic.

Frequently Asked Questions

Does `page.select()` wait for the API response automatically?

No. It waits for the selection operation and dispatched events, not application-specific network or rendering work.

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

Should I wait for a request or a response?

Wait for the request to verify emission; wait for the response to verify server completion. Add a DOM assertion when visible results matter.

What is Puppeteer’s default wait timeout?

The documented default for `waitForRequest()` and `waitForResponse()` is 30 seconds.

The Bottom Line

Register a targeted request or response wait before page.select(), await both concurrently, and assert the resulting UI when that is the real completion condition. Reserve network idle for workflows where broad inactivity—not a particular API—is what you need.

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.

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

Leave a Reply

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

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.

Read next

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.