ScreenshotNeo

BlogHow-to

How to Add a Delay Before a ScreenshotAPI.net Capture

Use ScreenshotAPI.net’s delay parameter to wait before capture, and choose a selector or page event when elapsed time is not the right readiness signal.

By the ScreenshotNeo team4 October 20268 min read

Direct answer: Add delay to your ScreenshotAPI.net capture request and set it to the number of milliseconds to wait before capture. For example, delay=2000 requests a two-second delay; the documented default is 0, meaning no added delay. [ScreenshotAPI.net delay documentation]

A fixed delay is useful when a page needs a known amount of extra time for animation, charts, or API-driven content. If you can identify a readiness condition, a selector or page-load event can be more precise. The examples below are based on the documented parameters; no live capture was run for this guide.

1. Add the delay parameter

ScreenshotAPI.net’s documented request uses the v3 screenshot endpoint. URL-encode the page URL, especially if it includes query parameters or other reserved characters.

https://shot.screenshotapi.net/v3/screenshot?token=TOKEN&url=ENCODED_URL&delay=2000

Replace TOKEN with your ScreenshotAPI.net token, ENCODED_URL with the encoded target page URL, and 2000 with the desired delay in milliseconds. The value is elapsed time, not seconds: 500 is half a second, 2000 is two seconds, and 0 adds no delay. These are documented examples, not universal recommendations for every site. [Official delay parameter documentation]

cURL

curl --get 'https://shot.screenshotapi.net/v3/screenshot' \
  --data-urlencode 'token=TOKEN' \
  --data-urlencode 'url=https://example.com/dashboard?range=week&view=chart' \
  --data-urlencode 'delay=2000' \
  --output screenshot.png

Python

import requests

response = requests.get(
    "https://shot.screenshotapi.net/v3/screenshot",
    params={
        "token": "TOKEN",
        "url": "https://example.com/dashboard?range=week&view=chart",
        "delay": 2000,
    },
    timeout=120,
)
response.raise_for_status()
with open("screenshot.png", "wb") as image_file:
    image_file.write(response.content)

Node.js

const params = new URLSearchParams({
  token: 'TOKEN',
  url: 'https://example.com/dashboard?range=week&view=chart',
  delay: '2000',
});

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

Keep tokens out of source control and public browser code. In production, load the token from a server-side environment variable. Set the output extension or downstream content handling to match the image format configured for your account/request.

2. Choose the right wait strategy

A longer fixed wait does not solve every timing problem. Pick the wait that corresponds to how the page becomes ready.

Method Use it when Consider
delay The needed extra render time is reasonably predictable. It waits for elapsed time even if the page is ready sooner.
wait_for_selector A specific chart, result, or component indicates readiness. The selector must exist on the target page and match the intended element.
wait_for_event=networkidle Content depends on asynchronous requests settling. The docs define network idle as no active requests for at least 500 ms; pages with ongoing requests may not settle promptly.
wait_for_event=load You need the page resources to finish loading. This is the documented default event.
wait_for_event=domcontentloaded You need HTML parsing to complete and do not need to wait for every resource. Images and other resources may still be loading.

The ScreenshotAPI.net docs describe load, domcontentloaded, and networkidle as distinct readiness events. The feature page also shows that wait controls can be combined, for example wait_for_event=networkidle&wait_for_selector=.hero. Combine conditions only when each one represents a real requirement for the page. [Timing and wait options] [Wait event documentation]

Example: wait for a selector

https://shot.screenshotapi.net/v3/screenshot?token=TOKEN&url=ENCODED_URL&wait_for_selector=%23chart

Use a selector that actually appears in the page DOM. A selector wait is often easier to tune than repeatedly increasing a delay when a chart or result has a clear element that appears on completion. The parameter example is illustrative; check the current official docs for the supported selector syntax.

Example: wait for network idle

https://shot.screenshotapi.net/v3/screenshot?token=TOKEN&url=ENCODED_URL&wait_for_event=networkidle

This can help when content arrives through asynchronous requests. It is not a guarantee that all application work is finished: client-side rendering can continue after requests settle, and some pages keep requests active. If a specific element marks readiness, use a selector as well.

3. Handle lazy-loaded content separately

A delay waits before capture; it does not, by itself, scroll the page to trigger content deferred until it enters the viewport. For that case, ScreenshotAPI.net documents lazy_load=true, which scrolls through the page, and scroll_delay, which sets the pause between scroll steps in milliseconds. The documented default for scroll_delay is 500 ms. [Lazy-load options]

https://shot.screenshotapi.net/v3/screenshot?token=TOKEN&url=ENCODED_URL&lazy_load=true&scroll_delay=500&delay=2000

Here, lazy loading triggers the scroll, scroll_delay spaces the scroll steps, and delay adds a wait before capture. The docs show a request using lazy_load=true together with delay=10000; the right values depend on page length and behavior. Long pages combined with large scroll pauses can run into the documented default timeout of 100,000 ms. [Timeout documentation]

4. Tune the wait without wasting time

  1. Start from the page’s actual readiness signal. Use a selector if a particular element appears when the content is ready; use a fixed delay if the additional rendering time is predictable.
  2. Begin with a small delay. Increase it only if the required content is consistently missing. The vendor examples include 500 ms, 2,000 ms, and 5,000 ms in particular contexts; none is a general best value. [Delay examples]
  3. Separate network waits from scroll waits. Use network idle for request-driven updates and lazy loading for content triggered by scrolling. A larger delay cannot trigger an off-screen lazy image.
  4. Keep a timeout budget. The documented default timeout is 100,000 ms. Long waits and full-page scrolling both consume time, so avoid stacking generous delays without a reason.
  5. Make captures repeatable. Use the same wait condition and target state for recurring screenshots. If the page’s data changes over time, a successful wait will not make the content itself deterministic.

5. Troubleshooting

Symptom Likely cause What to change
The screenshot still shows a loading state. The fixed delay is shorter than the page’s render time, or capture happens before a readiness event. Wait for a meaningful selector or use an appropriate page event. If the page has no reliable signal, increase delay incrementally.
The chart is missing even after adding delay. The chart may be waiting on an API request, or its container may not yet be present. Try network idle for asynchronous requests or a selector for the chart element. Confirm the selector matches the page.
Images lower down the page are blank. They load only when scrolled into view. Enable lazy_load=true and tune scroll_delay. A fixed delay alone does not scroll.
The request takes too long or times out. A large delay, network wait, long page, or slow scroll sequence can exceed the request’s timeout budget. Reduce unnecessary waits, use a specific selector where possible, and lower scroll pauses or limit the work to what the capture needs. The docs list a 100,000 ms default timeout.
The result is captured before images finish loading. domcontentloaded only signals that HTML parsing is complete. Use load, a relevant selector, or an additional delay depending on the page’s readiness requirement.
A selector wait does not help. The selector is wrong, appears only in a different state, or never appears. Inspect the page DOM and choose a stable element that becomes available when the desired content is ready.
The request fails when the target URL contains & or ?. The URL was not encoded as a single query parameter. Use curl --data-urlencode, Python’s params, or JavaScript’s URLSearchParams as in the examples.

6. Performance, reliability, and cost considerations

Every additional wait extends capture latency. A fixed delay is simple but may spend time waiting after content is already ready; condition-based waits can avoid guessing, though their usefulness depends on choosing a condition that actually signals completion. Lazy loading adds scroll work, and its duration grows with page length and scroll pauses. These are operational consequences of the documented controls, not measured benchmarks.

For reliability, treat timing as page-specific. A page can change its selectors, load sequence, or network behavior, so re-check the chosen readiness condition when the site changes. Use a timeout that allows the intended capture to finish, while keeping enough margin for slow responses. ScreenshotAPI.net’s docs state a default timeout of 100,000 ms and warn that long lazy-load scroll delays can exceed it. [Timeout and lazy-load notes]

Cost depends on the provider’s current plan and billing rules; the research available for this guide does not establish ScreenshotAPI.net pricing or whether timeouts and failed captures are billed. Check the provider’s current pricing and terms before estimating recurring capture costs. For any screenshot pipeline, avoid paying for unnecessary repeated captures by choosing an appropriate cache or refresh policy when the service offers one.

7. Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server from Yorker Media. Its one-call API accepts a URL and returns a screenshot or PDF, with a configurable delay and other capture options documented in the ScreenshotNeo API docs.

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

ScreenshotNeo removes cookie and consent banners, newsletter popups, and chat widgets before the shot; each cleanup step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers say which page verdict applied and whether it was billed. Its MCP server lets AI agents use take_screenshot, get_page_info, and capture_pdf. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots. Every feature is on every plan.

Get 1,000 free ScreenshotNeo screenshots a month with no card.

8. FAQ

What unit does ScreenshotAPI.net use for delay?

Milliseconds. For example, 2000 requests two seconds.

What happens if I omit delay?

The documented default is 0, so no extra fixed delay is added.

Does delay wait for images or scroll the page?

No. It adds elapsed time before capture. Use an appropriate load event for resources or lazy_load=true to trigger off-screen content by scrolling.

Should I use a delay or a selector?

Use a selector when a particular element reliably marks readiness. Use a fixed delay when the extra time is predictable or there is no usable readiness signal.