MS Delay Parameter

The ms_delay parameter adds a delay (in milliseconds) before capturing the screenshot, allowing time for animations, dynamic content, or resources to load.

Specifications

PropertyValue
Typeinteger
RequiredNo
Defaultnull
Range1-5000
APIBoth HTML/CSS and Screenshot APIs

Description

The MS Delay parameter:

  • Adds a specified delay before capturing the screenshot
  • Useful for waiting for animations to complete
  • Helps ensure dynamic content is fully loaded
  • Can be used to capture specific states of interactive elements

Adding a delay increases the total processing time of your request. Only use delays when necessary, and keep them as short as possible for your use case.

Examples

Waiting for Animation

{
    "html": "<div class='animate-fade-in'>Content with animation</div>",
    "ms_delay": 1000
}

Capturing Slow Loading Sites

{
    "url": "https://example.com/slow-page",
    "ms_delay": 2000
}

Minimal Delay

{
    "html": "<div>Simple content with short delay</div>",
    "ms_delay": 100
}

Common values

  • 500 - typical iframe with a single async asset.
  • 1000 - Twitter or Instagram embed waiting for its widget script.
  • 2000 - slow third-party widget that fetches data on mount.
  • 5000 - avoid. If you need 5 seconds, your render is probably exceeding the budget. Use wait_for_selector instead.

When to use

Use ms_delay when the content depends on an embed that does not expose a stable selector to wait for. Twitter and Instagram embed widgets are the canonical case. For your own markup, prefer wait_for_selector since it returns as soon as the element exists.

Common mistakes

  • Stacking ms_delay and a long render budget. A 4000ms delay plus a 25-second JavaScript render leaves only one second of margin. Trim the delay or move to webhook_url.
  • Using delay when a selector exists. If you control the page, expose a marker like <body data-ready="true"> and use wait_for_selector="body[data-ready='true']" instead.

See also: twitter-embed example, facebook-post example, instagram-post example, getting started guide.