Many modern websites load content dynamically with JavaScript. Screenshotly provides several mechanisms to ensure content is fully rendered before capturing.
Delay parameter
The delay parameter specifies how many milliseconds to wait after the page loads before taking the screenshot (0–10000):
Use delay when:
- The page has animations that need to complete
- Content loads via JavaScript after the initial page load
- You need to wait for fonts or images to render
Wait for selector
The wait_for_selector parameter waits for a specific DOM element to appear before capturing:
This is more reliable than a fixed delay because it captures as soon as the element exists, rather than waiting an arbitrary amount of time.
Element capture with selector
The selector parameter captures a specific element instead of the full page:
selector and wait_for_selector serve different purposes: selector captures a specific element, while wait_for_selector waits for an element to appear before capturing the full page (or viewport).
Navigation control with wait_until
The wait_until parameter controls when the page is considered loaded:
You can also pass an array to wait for multiple conditions:
Combining options
You can use delay, wait_for_selector, and wait_until together. The API waits for navigation (wait_until), then for the selector (wait_for_selector), then applies the additional delay:
When capturing SPAs built with React, Vue, or Angular, use wait_for_selector targeting a container that only renders after data loads. This is more reliable than guessing a delay value.
Timeouts
If the page takes too long to load or the selector never appears, the request will time out.
If the wait_for_selector element never appears on the page, the request will fail after the timeout period. Set error_on_selector_not_found: true to get a clear error, or ensure the selector matches an element that will exist.