Limit how long the API waits before capturing your image
How it works
The max_wait_ms parameter sets a maximum time limit for waiting before the screenshot is taken. This is useful when pages load extra irrelevant content that you don’t need to wait for.
Value range
Minimum
Maximum
500 ms
10000 ms (10 seconds)
max_wait_ms vs ms_delay
These two parameters serve different purposes:
Parameter
Purpose
Behavior
ms_delay
Add extra wait time
Waits for the specified time after the page loads
max_wait_ms
Set a time limit
Stops waiting before the specified time, even if content is still loading
When to use each
Use ms_delay when you need to wait for JavaScript to execute or animations to complete
Use max_wait_ms when pages load too much content and you want to capture sooner
Example usage
Speed up slow pages
If a page loads unnecessary content that slows down your screenshot:
When generating many screenshots, use max_wait_ms to prevent slow pages from blocking your queue:
{"url":"https://example.com","max_wait_ms":5000}
Best practices
Start with the default - Only use max_wait_ms if screenshots are taking too long
Test your value - Too short a time may result in incomplete screenshots
Combine with selector - Use selector to capture specific elements that load quickly
Consider render_when_ready - For precise control, use render_when_ready instead
Note
If the page hasn’t loaded essential content within max_wait_ms, the screenshot may be incomplete. Test with your specific URLs to find the right balance.
Need help?
Talk to a human. Please email us support@htmlcsstoimage.com with any questions and we’ll gladly help you get started.