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 desk5 min

How to Make a Screenshot API Wait for a CSS Selector

Use Browserless’s current waitForSelector configuration or await a selector in Puppeteer before capture. Learn how visibility, timeouts, endpoint versions, and navigation readiness differ.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To make Browserless’s current shared REST API wait for an element, include a waitForSelector object in the JSON request. Set its required selector to a CSS selector and, when needed, set visible: true and a finite timeout. The field names and behavior are Browserless-specific: check the endpoint and version for any other screenshot API before reusing this payload.

Configure Browserless to wait for the selector

Browserless’s current general REST request configuration accepts waitForSelector. For example, this request waits up to five seconds for an h1 to be visible:

{
  "url": "https://example.com/",
  "waitForSelector": {
    "selector": "h1",
    "timeout": 5000,
    "visible": true
  }
}

Send this JSON using the request format and endpoint required by your Browserless REST integration. The example shows the selector-wait configuration, not a universal screenshot API payload. Browserless documents selector as required; timeout, visible, and hidden are optional. It returns immediately if the selector already exists. If the selector does not appear before the timeout, Browserless documents a non-200 response. See Browserless Request Configuration.

Choose presence or visibility deliberately

A selector can match an element in the DOM even when that element is hidden. Use visible: true if the screenshot depends on the element being rendered visibly, rather than merely having been added to the page. Pick a stable selector for the content you intend to capture; an overly broad selector can match the wrong element, while a selector tied to an unstable implementation detail may break when the page changes.

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

Give the wait a finite timeout

Choose a timeout appropriate to the page’s expected rendering time and your request budget. The five-second value above is an example, not a documented performance guarantee. Treat a non-200 response as a failed wait: check whether the selector is correct, whether the page reached the expected state, and whether the timeout is long enough for that page. Do not assume a screenshot contains the requested content just because the API call was made.

Use the selector condition that matches the capture

Navigation readiness and content readiness are different. A navigation condition such as load, domcontentloaded, or network idle describes a navigation or network state; it does not prove that a particular application element has appeared. Browserless documents navigation lifecycle settings separately from selector waits. Its current request configuration also documents waitForFunction for custom conditions and waitForTimeout for a fixed delay. Prefer a condition that expresses the page state you need over an arbitrary sleep. Browserless documents these request controls.

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
Wait strategy What it establishes When it fits
waitForSelector A CSS selector matches; with visible: true, the matched element must be visible. Capture when a particular page element is ready.
waitForFunction A custom page condition succeeds. The required state cannot be expressed as a selector alone.
waitForTimeout A fixed amount of time has elapsed. Use only when elapsed time itself is the intended wait; it does not confirm that content loaded.
Navigation lifecycle or network-idle condition A navigation or network condition has been reached. Useful for navigation readiness, but not proof that a specific element is present.

Do it directly with Puppeteer

If you control the browser with Puppeteer rather than a hosted screenshot API, await the selector before calling page.screenshot():

await page.goto('https://example.com/');
await page.waitForSelector('h1', { visible: true, timeout: 10000 });
await page.screenshot({ path: 'shot.png' });

This is the equivalent sequence: navigate, wait for the desired element state, then capture. Puppeteer documents a default 30-second selector-wait timeout and supports visibility and hidden-state options. Its screenshot guide also demonstrates waiting for an element before taking an element screenshot. See Puppeteer’s waitForSelector reference and screenshot guide.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
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.

Capture the element after it appears

For an element-level capture, obtain the element handle after the wait and use its screenshot method:

const element = await page.waitForSelector('h1', {
  visible: true,
  timeout: 10000
});
if (!element) throw new Error('The target element was not found');
await element.screenshot({ path: 'heading.png' });

Use a full-page or viewport screenshot instead when the desired output is the whole page. The wait condition and capture scope are separate decisions.

Rank #4
Sale
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

Check endpoint version before copying a payload

Browserless’s older BaaS v1 /screenshot API documents a waitFor property. It can represent a CSS selector, a millisecond delay, or a page-context function. That BaaS v1 documentation is marked no longer actively supported and directs users to updated BaaS v2 or BrowserQL documentation. The current shared REST request configuration instead names the selector condition waitForSelector. Do not treat the older field as interchangeable with the current configuration; verify the endpoint, request schema, and support status in the documentation for the version you actually use. Browserless BaaS v1 screenshot documentation.

Troubleshoot selector waits

  • The API returns a non-200 error: Browserless documents this outcome when the selector does not appear before its timeout. Confirm the URL and selector against the rendered page, then adjust the finite timeout if the page legitimately needs longer.
  • The screenshot is taken with the element still hidden: DOM presence is not the same as visibility. Set visible: true when the element must be visibly rendered.
  • The wait succeeds but the screenshot shows the wrong content: Make the selector more specific and confirm that it identifies the content you intend to capture, not an earlier or hidden match.
  • The page is loaded but the application content is missing: Navigation completion does not establish that a selector is ready. Wait for the actual element or use a documented custom condition appropriate to the page.
  • The request rejects the wait field: Check that you are using the current Browserless request configuration rather than copying the older BaaS v1 waitFor shape, and confirm your service’s own field names.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. Make a screenshot with one GET request; the example saves the returned image as WebP:

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.
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.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

See the ScreenshotNeo API documentation for request options and the ScreenshotNeo website for the service overview. Cookie banners and consent prompts, newsletter popups, and chat widgets are removed before the shot; each cleanup step can be turned off. Bot checks, blank pages, timeouts, and failed loads are not billed, and cache hits cost nothing. Responses identify the page verdict and billing status in headers. Its MCP server lets AI agents use screenshot, page-info, and PDF-capture tools. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Sign up free for 1,000 screenshots a month, with no card required.

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.