ScreenshotNeo

BlogHow-to

How to Capture a Webpage After It Finishes Loading in Urlbox

Use Urlbox’s wait_until option for page readiness, then add a selector wait or delay when the page needs more time before capture.

By the ScreenshotNeo team4 October 20266 min read

To capture a webpage after it finishes loading in Urlbox, set wait_until to the readiness signal that fits the page. The documented default is loaded, which waits for the browser’s load event. For pages that finish rendering later, combine that setting with a fixed delay, wait for a readiness element with wait_for, or wait for a loading indicator to disappear with wait_to_leave.

These settings control different things: a browser event, network activity, a page element, or elapsed time. Choose the signal that matches what “finished” means for the target page.

1. Choose the page-ready signal

Option What it waits for Use it when
domloaded The DOMContentLoaded event The needed content is available once the initial HTML has been parsed and you want to capture before other page resources finish.
loaded The browser load event; this is the documented default The page’s normal load event is an appropriate readiness signal.
mostrequestsfinished A network-settling condition based on how many connections remain and for how long You need a network-based signal and the page may have outstanding requests after the load event.
requestsfinished A stricter network-settling condition based on remaining connections and duration The page’s relevant requests are expected to finish before capture.

The network modes are not equivalent to “the application is ready.” Some pages keep requests open or make requests in the background. If the content you need has a clear DOM signal, waiting for that element is often a closer match to the page’s actual behavior.

2. Configure Urlbox’s render options

Use this options payload as a starting point, replacing the selector and timing for your page:

{
  "url": "https://example.com",
  "wait_until": "loaded",
  "wait_for": "main article",
  "wait_timeout": 30000
}

This is an options example, not a complete signed Urlbox API request. The available source material documents these option names but does not specify an API endpoint, authentication scheme, or request signature, so those details should come from your Urlbox account’s integration instructions.

Wait for a page element

wait_for waits for the chosen CSS selector to appear in the DOM. Use it when a specific element signals that the content you want is present, such as main article or a results container. The selector must match the page’s markup.

Use wait_for_state to specify whether the selector only needs to be attached to the DOM or must be visible. This distinction matters when an element is inserted early but remains hidden while the page renders.

Wait for a loading indicator to disappear

If a spinner or loading overlay is a better readiness signal, use wait_to_leave with its selector. This waits for the selected element to disappear. Set wait_timeout to bound the wait.

By default, Urlbox proceeds with capture if a selector condition is not met before the timeout. If continuing would produce an unusable screenshot, use the documented failure options so a missed condition fails the request instead of silently capturing.

Add a fixed delay

delay adds a fixed wait in milliseconds before capture; its documented default is zero. Use a delay when the page consistently needs a known amount of time after the selected readiness condition—for example, a short animation or client-side update. A delay alone does not confirm that the expected content appeared, so prefer a selector condition when one is available.

3. Pick a condition that matches the page

  1. Start with loaded. It is the documented default and waits for the browser’s load event.
  2. Inspect what appears late. If a particular result, chart, or article body marks completion, wait for that element. If a spinner marks ongoing work, wait for it to leave.
  3. Choose timeout behavior. Decide whether a missed selector should still produce a capture or fail the request, based on whether a partial screenshot is useful.
  4. Add a small delay only when needed. Use it for a known post-condition pause, not as a substitute for a meaningful readiness signal.
  5. Check full-page behavior separately. Urlbox normally scrolls the page before capture to trigger lazy-loaded content and measure the final scrollable height. Set skip_scroll=true to disable that behavior.

4. Use the Urlbox CLI

The Urlbox CLI exposes the corresponding --wait-until and --delay controls. Use the wait-until flag for the general page-ready condition and the delay flag for an additional pause:

urlbox --wait-until loaded --delay 1000

This shows the documented flags; supply the URL and any required account configuration according to the CLI setup for your installation. Explicit CLI flags or JSON options override presets.

5. Full-page capture and lazy-loaded content

Waiting for the initial page load does not necessarily mean content below the fold has loaded. Urlbox normally scrolls down before a full-page capture so lazy-loaded elements can load and the final scrollable height can be measured. If you set skip_scroll=true, that preparatory scrolling is disabled. Consider this when a screenshot is missing images or sections that only load as the page is scrolled.

6. Troubleshooting

Symptom Likely cause What to change
The screenshot misses content that appears after navigation. The selected readiness event occurs before the application has rendered that content. Wait for a selector representing the finished content, or add a delay if the remaining wait is predictable.
The screenshot contains a spinner. The capture condition does not account for the loading indicator. Use wait_to_leave for the spinner selector and set an appropriate wait_timeout.
The capture proceeds even though the selector never appeared. Selector waits proceed after timeout by default. Use the failure option when a missing selector should make the request fail.
The selector wait times out on a page that looks ready. The selector may not match, or it may be attached but not visible when visibility is required. Check the CSS selector and choose the appropriate wait_for_state.
Full-page output omits lazy-loaded images or sections. The content loads only after scrolling, or preparatory scrolling was disabled. Check whether skip_scroll=true is set; Urlbox normally scrolls before full-page capture.
The capture takes longer than expected. A network-settling condition, selector timeout, and added delay can all extend the wait. Use the least strict readiness condition that still captures the needed content, and avoid stacking waits without a page-specific reason.

7. Performance and reliability

Readiness settings trade capture time for confidence that the page is ready. domloaded can proceed before the full load event; network-settling modes can wait for activity to subside; selectors check for application-specific state; and delay always adds its configured time. Actual completion time depends on the target page.

For repeatable captures, prefer a stable selector over a long arbitrary delay when the page exposes one. Set a finite selector timeout and decide explicitly whether timeout should allow a partial result or fail the request. For full-page screenshots, account for Urlbox’s normal scrolling behavior and the possibility that lazy content appears during that step.

Or skip the browser setup

ScreenshotNeo captures a URL through one API request, so you do not need to configure browser readiness in your own browser automation. Its clean-shot flow accepts cookie and consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed; response headers report the page verdict and billing status. Its MCP server gives AI agents screenshot, page-info, and PDF capture tools.

For example, this cURL request saves a WebP screenshot of Stripe:

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 and setup. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. Sign up for free and start with 1,000 screenshots a month, no card required.

FAQ

Is loaded the same as network idle?

No. loaded waits for the browser’s load event. The network-settling options use remaining connections and time as their signal.

Should I use a delay or a selector wait?

Use a selector when a particular element indicates the page is ready. Use a delay when you know a fixed post-load pause is needed and no better page-specific signal is available.

Does a full-page screenshot wait for lazy-loaded content?

Urlbox normally scrolls the page before capture to trigger lazy loading and measure its height. skip_scroll=true disables this behavior.