--wait-for
Waiting For Page Readiness
# Render the page when the window.load event fires
zshot --wait-for load https://zshot-cli.com/
# Render the page when the document.ready event fires
zshot --wait-for ready https://zshot-cli.com/
# Render the page when the networkidle0 state is arrived at
zshot --wait-for networkidle0 https://zshot-cli.com/
# Render the page 5s after the page loads
zshot --wait-for 5 https://zshot-cli.com/
# Render the page after the my_event CustomEvent has fired
zshot --wait-for js:my_event https://zshot-cli.com/Sets the state at which point zshot should render the page. The following values are allowed:
load: Thewindow.loadeventready: TheDOMContentLoadedeventnetworkidle0: After there have been zero new network connections attempted for 500msnetworkidle2: After there have been a maximum of two network connections attempted for 1 secondjs:NAME_OF_EVENT: When aCustomEventhas been triggered on thewindowobject, eg:js:my_eventwould allowzshotto render once the page has executed the following code:window.dispatchEvent(new CustomEvent("my_event"))css:SELECTOR: When a DOM element matching this selector exists on the page- Any number: If you simply specify a number,
zshotwill wait that number of seconds before continuing.5would wait 5 seconds,2.5would wait 2.5 seconds and0would not wait at all.
The default value of --wait-for is load.
Redirects
zshot follows HTTP redirects, in-page navigations that run during load such as location.href,
and instant meta-refresh automatically. To capture the destination of a redirect that fires after
the page loads, such as a delayed meta-refresh or a timed script redirect, set --wait-for to a
number of seconds larger than the redirect delay.