October 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 PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Capture a Puppeteer Screenshot After Selecting a Dropdown Option

Use Puppeteer’s page.select() for a native dropdown, wait for any asynchronous result, then capture the page or the relevant element.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a native HTML dropdown, await page.select() with the option’s value, wait for any page content that updates asynchronously, then save the screenshot with page.screenshot(). The example below uses Puppeteer 25.12.0; the documented behavior is described in the Page API.

Capture a native dropdown selection

Use page.select(selector, value) for a native <select> element. It selects the matching option and triggers the input and change events. Await the call before taking the screenshot.

As an Amazon Associate I earn from qualifying purchases.

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();
try {
  const page = await browser.newPage();
  await page.goto('https://example.com');

  // Use the option's value attribute, not necessarily its visible label.
  await page.select('select#country', 'CA');

  // Wait for the page's result if selection causes an asynchronous update.
  await page.waitForFunction(() =>
    document.querySelector('#selected-country')?.textContent?.trim() === 'Canada'
  );

  await page.screenshot({ path: 'selected.png' });
} finally {
  await browser.close();
}

Replace the example URL, selector, option value, and result condition with the ones used by the page you are automating. If changing the dropdown does not trigger an asynchronous update, you can omit the result wait and capture immediately after page.select().

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

Wait for the state you want to show

Selection completing does not guarantee that application code has finished updating the page. If the screenshot must show a result, wait for an observable state that represents that result rather than adding an arbitrary delay.

Wait for a result element

If a result element is added after selection, wait for it to appear:

await page.select('select#country', 'CA');
await page.waitForSelector('#result', { visible: true });
await page.screenshot({ path: 'selected.png' });

waitForSelector() can wait for an element to be present and, with visible: true, visible. Its documented default timeout is 30 seconds; see the waitForSelector API.

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

Wait for particular content

If the element already exists but its text changes, wait for the expected value instead:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
await page.select('select#country', 'CA');
await page.waitForFunction(() =>
  document.querySelector('#selected-country')?.textContent?.trim() === 'Canada'
);
await page.screenshot({ path: 'selected.png' });

This is a pattern, not a guarantee about how any particular site updates. Choose a condition tied to the content you need in the image. Puppeteer documents waitForFunction() for waiting until a page function evaluates truthily. For general interaction, Puppeteer recommends locators, which include automatic precondition checks.

Handle custom dropdowns differently

page.select() is for a real HTML <select>, not every control that looks like a dropdown. A custom menu may be built from buttons, list items, or other elements. Inspect its markup and interact with the actual controls using locators or another appropriate input method.

For a native select, a locator can also fill the selection:

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
await page.locator('select#country').fill('CA');

Use the method that matches the page and test. See Puppeteer’s Page API and interaction guide.

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

Choose the screenshot area

page.screenshot() saves the image and returns a promise. PNG is the default image type. Pick the capture scope according to what the reader needs to see; the available screenshot options are documented in ScreenshotOptions.

  • Viewport: await page.screenshot({ path: 'selected.png' }); captures the current viewport.
  • Entire page: await page.screenshot({ path: 'selected.png', fullPage: true }); captures the full page.
  • Region: use the clip option to capture a specified rectangle.
  • One element: capture that element with ElementHandle.screenshot(); Puppeteer’s guide notes that it scrolls the element into view if needed.

The official Screenshots guide recommends Page.screenshot() for page captures and documents element screenshots.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Common failures and fixes

  • The select does not change: confirm the selector matches a native <select> and that CA is the option’s actual value, not just its displayed text. Use the page’s real option value.
  • The screenshot shows the old result: await the selection call, then wait for a result-specific condition such as changed text or a visible result element.
  • The selector wait times out: check that the target selector exists and that the condition can become true after this selection. A wait is only useful when it represents a state the page actually reaches.
  • page.select() cannot operate on the menu: the control may be custom markup rather than a native select. Interact with the menu’s actual buttons or options instead.
  • The output misses content: determine whether you need the viewport, the full page, a clipped region, or an element-only image, and choose the corresponding screenshot method.
  • The script exits before the image is saved: await page.screenshot() and keep the browser open until it completes; the example closes the browser in a finally block so it also closes after an error.

Or skip the browser setup

ScreenshotNeo can capture a URL with one GET request; the parameters used by other screenshot APIs also work, which can make switching easier. Create an API key and see the ScreenshotNeo documentation.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

ScreenshotNeo removes cookie and consent banners, newsletter popups, and chat widgets before capture. Bot checks, blank pages, failed loads, timeouts, and cache hits cost nothing; response headers report the page verdict and billing status. Its MCP server offers screenshot tools for AI agents, and the free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. For dropdown-driven pages, use the browser method above when you need to perform page interactions before capture; ScreenshotNeo is a direct URL capture API.

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.

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

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
Windows Errors? Fix Them Before They SpreadFree repair scan
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.