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 DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk5 min

How to Wait for a Selector Before Taking a Browserless Screenshot

Send Browserless REST a URL and a `waitForSelector` condition, then handle timeout errors and use a separate screenshot selector when you need an element crop.

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.

For Browserless’s current REST Screenshot API, send a POST request to /screenshot with the page URL and a waitForSelector condition in the JSON body. The screenshot is taken after the matching CSS selector meets the configured condition. Set visible: true when finding a hidden element in the DOM is not enough, and handle timeout responses: Browserless documents a non-200 response if the selector does not appear in time.

Wait for a selector with Browserless REST

Use the current REST endpoint and put the wait condition alongside the URL and screenshot options. Replace the example URL and selector with the page and readiness marker you need.

As an Amazon Associate I earn from qualifying purchases.

{
  "url": "https://example.com/",
  "waitForSelector": {
    "selector": "h1",
    "timeout": 5000
  },
  "options": {
    "fullPage": true,
    "type": "png"
  }
}

The selector is CSS, and the timeout is in milliseconds. For the endpoint and shared request configuration, see Browserless’s Request Configuration and Screenshot API documentation.

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.

Choose presence or visibility

A selector wait can be satisfied by the element being present in the DOM. If the page inserts the element before displaying it, require visibility explicitly:

#1 Best Overall
"waitForSelector": {
  "selector": "main .report-ready",
  "visible": true,
  "timeout": 10000
}

Use a marker that indicates the content you actually need is ready—for example, a report container or a loaded-results element—not a generic element that appears before asynchronous content is populated.

Handle the HTTP failure path

If the selector does not meet the condition before the timeout, Browserless documents a non-200 response with an error message. Do not treat every response body as an image. Check the HTTP status before saving or forwarding the body as a screenshot, and log the response text for diagnosing failures.

Wait for readiness versus capture one element

waitForSelector controls when screenshot work proceeds; it does not mean the output is cropped to that selector. If you want a full-page screenshot after a readiness marker appears, use the wait condition and full-page option. If the image should contain only one element, use the screenshot-specific top-level selector; Browserless documents that this waits for the element and captures its bounding box.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
{
  "url": "https://example.com/",
  "selector": ".product-card",
  "options": {
    "type": "png"
  }
}

Use these as separate decisions: a readiness selector is a gate, while the screenshot selector identifies the captured element.

Use the right Browserless API generation

Do not mix the current REST request configuration with the legacy BaaS v1 screenshot payload. The current REST docs use waitForSelector; the legacy page documents a waitFor field that can take a selector string, a millisecond delay, or a page-context function. Confirm which endpoint generation your application is calling and follow that generation’s request format. The documentation available here does not establish which endpoint generations are enabled for any particular account. See the legacy BaaS v1 screenshot documentation.

When a selector wait is not the right wait

Use a fixed delay only for genuinely time-based behavior

Browserless also documents timeout waits. A delay can be appropriate when a page action needs a known settling interval, but it does not verify that the desired content arrived. When the page exposes a reliable readiness marker, a selector condition is more directly tied to page state.

Use scroll loading for lazy content

If images or other content are lazy-loaded as the page scrolls, Browserless’s screenshot documentation suggests scrollPage: true, optionally with options.fullPage: true. A selector wait alone does not necessarily cause offscreen lazy content to load.

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

Use connected browser control for custom logic

With local Puppeteer, wait on the page before taking the screenshot. Puppeteer documents that page.waitForSelector() returns immediately if the selector already exists and throws if it does not appear before the timeout. Its documented default timeout is 30 seconds; set an explicit timeout when that default is unsuitable.

const page = await browser.newPage();
await page.goto('https://example.com/');
await page.waitForSelector('main .report-ready', {
  visible: true,
  timeout: 10000
});
await page.screenshot({ path: 'shot.png', fullPage: true });

For a connected Playwright page, current documentation marks Page.waitForSelector as discouraged in many situations and recommends locator-based waits or web-first assertions. These client-library examples apply when your code controls a browser page; they are not substitutes for the JSON configuration of Browserless’s REST endpoint. See Puppeteer’s waitForSelector reference, Puppeteer’s screenshots guide, and Playwright’s Page reference.

Troubleshoot missing or failed screenshots

  • Selector timeout: Confirm the selector is valid CSS and matches the rendered page. Increase the timeout only if the page legitimately needs more time; handle the non-200 response rather than saving its body as an image.
  • The element exists but is hidden: Add visible: true if the screenshot should wait until it is displayed. Browserless describes visibility in terms of CSS visibility and display.
  • The screenshot is cropped unexpectedly—or not cropped: Keep the readiness wait separate from the screenshot-level selector. The former gates capture; the latter targets an element’s bounding box.
  • Lazy images or lower-page content are missing: Try scrollPage: true and, when appropriate, options.fullPage: true to trigger loading while scrolling.
  • The result is blank, blocked, or missing page elements: Browserless identifies bot detection as one possible cause and refers to /unblock for bypassing some bot checks. This is not a guaranteed fix; a selector wait cannot make a blocked page render its intended content.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If you need a screenshot without configuring a browser connection, ScreenshotNeo accepts a URL in one GET request. The example saves a WebP response; its API documentation covers request options.

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

ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, with the result identified in response headers. Its MCP server provides screenshot and page-information tools for AI agents. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.

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

Learn about ScreenshotNeo, or sign up free for 1,000 screenshots a month with no card.

Frequently Asked Questions

Does a Browserless selector timeout return an image?

No. Browserless documents that a selector timeout produces a non-200 response with an error message, so check status and handle the error before treating a response body as an image.

What is the difference between Browserless `waitForSelector` and `selector`?

`waitForSelector` gates when capture proceeds. The screenshot-level `selector` targets an element and captures its bounding box.

Does a selector wait load lazy images?

Not necessarily. Browserless suggests enabling `scrollPage: true`, optionally with `options.fullPage: true`, to trigger lazy loading while scrolling.

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

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.