ScreenshotNeo

BlogHow-to

How to Set a Screenshot API to Capture a Page After a Delay

Set a provider-specific delay or wait for a reliable page element before capturing. See runnable examples, timing limits, troubleshooting, and a one-call option.

By the ScreenshotNeo team4 October 20266 min read

Direct answer: Add the delay option supported by your screenshot API, using that provider’s documented unit and limit. There is no universal parameter name: one API may expect milliseconds, another seconds. When the page has a dependable element that marks content readiness, wait for that element and use a short fixed delay only if the page still needs time to settle.

A fixed delay is measured from a provider-defined point in the page load process. It does not necessarily mean every asynchronous request, image, animation, or client-side update has finished. Check the API’s current documentation for the endpoint, timing behavior, maximum delay, and timeout rules before copying an example.

1. Choose a fixed delay or a readiness condition

Pattern Use it when Trade-off
Fixed delay The content appears after a known, fairly consistent interval. Simple to configure, but a short wait can capture too early and a long wait adds latency.
Selector or readiness wait A stable element appears when the content you need is ready. More targeted, but the selector must be reliable; its appearance does not guarantee every visual change is finished.

Prefer a readiness condition when the page exposes a stable marker, such as a report container or rendered result. Add a brief delay after that condition only if the page’s visual state continues to settle. Avoid choosing a large arbitrary delay as a universal default.

2. Check the provider’s parameter, unit, and limit

These examples are provider-specific and are not interchangeable:

Provider Documented timing option Behavior and limits
ScreenshotAPI.net delay Integer milliseconds after page load; default 0; documented range 0–10,000 ms. ScreenshotAPI.net documentation.
Capture.page delay Seconds; its timing page gives delay=3 as three seconds and documents 0–60 seconds. Its options also include waitFor (CSS selector) and waitForId. It says requests likely to take over 60 seconds should use its edge endpoint rather than CDN endpoint. Capture.page documentation.
Cloudflare Browser Rendering waitForSelector The screenshot API reference documents selector waiting and timeout options; use its request structure rather than assuming a query-string delay. Cloudflare Browser Rendering documentation.
ScreenshotEngine waitFor or wait_for Described as an optional post-load delay in milliseconds, with 0–30,000 ms documented for GET requests. ScreenshotEngine parameter documentation.

Confirm the precise endpoint and current reference for your account before relying on a parameter. A parameter with the same name at another provider may use a different unit or lifecycle point.

3. Example: ScreenshotAPI.net fixed delay

The following snippets show the documented millisecond parameter. Replace the URL and API key with your values; keep the delay within the documented 0–10,000 ms range.

cURL

curl -G "https://shot.screenshotapi.net/screenshot" \
  --data-urlencode "token=YOUR_API_KEY" \
  --data-urlencode "url=https://example.com" \
  --data-urlencode "delay=2000" \
  -o page.png

Python

import requests

params = {
    "token": "YOUR_API_KEY",
    "url": "https://example.com",
    "delay": 2000,  # milliseconds for this provider
}
response = requests.get(
    "https://shot.screenshotapi.net/screenshot",
    params=params,
    timeout=90,
)
response.raise_for_status()
with open("page.png", "wb") as image_file:
    image_file.write(response.content)

Node.js

const params = new URLSearchParams({
  token: 'YOUR_API_KEY',
  url: 'https://example.com',
  delay: '2000', // milliseconds for this provider
});

const response = await fetch(
  `https://shot.screenshotapi.net/screenshot?${params}`
);
if (!response.ok) {
  throw new Error(`Screenshot request failed: ${response.status} ${await response.text()}`);
}
const image = Buffer.from(await response.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('page.png', image));

Endpoint paths and authentication fields can depend on the provider’s current API version or account configuration. Treat the documented timing semantics as the key point and verify the request shape against your provider’s reference.

4. Example: wait for a selector when readiness is visible

Capture.page documents selector-based waits through waitFor or waitForId. The API accepts a selector wait, while this example illustrates a CSS-selector request shape; confirm the exact endpoint and required authentication parameters in the current Capture.page documentation before use.

https://capture.page/?url=https%3A%2F%2Fexample.com&waitFor=%23report-ready

Choose a selector tied to the desired content, not a generic element that exists before rendering begins. If the selector appears while charts or fonts are still settling, add a small provider-supported delay after the wait, or select a stronger readiness marker.

5. Tune timing without making captures unnecessarily slow

  1. Identify what must be present in the image: a chart, search result, dashboard panel, or other specific content.
  2. Check whether the page has a stable selector that appears only when that content is rendered.
  3. Use a selector wait when available; otherwise start with a short fixed delay based on the page’s known behavior.
  4. Inspect captures across representative page states, including slower responses and empty states. Adjust the wait based on what the image needs to include.
  5. Set request timeouts to allow for navigation plus the wait and rendering time, within your provider’s limits.

Longer waits generally increase end-to-end latency and can consume more of a provider’s execution window. They do not by themselves make a capture reliable: a page can fail, show a bot check, or never produce the desired content. If an API offers response metadata or job status, use it to distinguish a successful capture from a failed or incomplete one.

6. Common problems and fixes

Symptom Likely cause Fix
The screenshot is still too early The delay is measured from a load event that happens before the page’s asynchronous content is ready. Use a selector or other readiness condition if supported. Otherwise increase the fixed delay in small increments and inspect the result.
The request rejects the delay The value is outside the provider’s range, malformed, or expressed in the wrong unit. Check the current parameter reference, integer requirements, and maximum. Convert seconds to milliseconds only when that API requires milliseconds.
The wait seems far too long or short A copied parameter uses another provider’s unit or lifecycle point. Verify whether the provider expects seconds or milliseconds and when it starts counting.
The selector wait times out The selector is wrong, appears only in another state, or the page never rendered the content. Check the selector in the target page, handle alternate or empty states, and inspect the provider’s timeout response.
The marker is present but the screenshot is incomplete The marker appears before images, fonts, charts, or transitions finish. Wait for a more specific marker or add a short additional delay if supported.
The request exceeds the endpoint timeout Navigation, waiting, and rendering together exceed the endpoint’s allowed duration. Reduce unnecessary waiting, check endpoint limits, and use the provider’s documented endpoint for longer captures where applicable.
The result is an error page or bot check The page returned a challenge or failed response instead of the intended content. Inspect the captured result and provider response details. A longer delay does not solve access restrictions or failed navigation.

7. Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. Its delay option is configured in milliseconds; see the ScreenshotNeo API documentation for the supported parameters and request options.

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

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com", "wait_for": 2000}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com', wait_for: '2000' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot request failed: ${res.status}`);
const image = Buffer.from(await res.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('shot.webp', image));

ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before the shot. Bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots.

Create a free ScreenshotNeo account and get 1,000 screenshots a month with no card.

8. FAQ

Does waiting for page load mean the page is fully ready?

No. A provider-defined load point may occur before client-rendered content, images, or later requests finish. Use a readiness condition tied to the content you need when possible.

Should I always add a fixed delay after waiting for a selector?

No. Add one only when the selector appears before the final visual state you need. Keep it as short as the page permits.

Can I reuse the same delay value across screenshot APIs?

Only after checking units, limits, and when the provider starts the timer. Matching parameter names do not guarantee matching behavior.