zshot/cliDownload

--wait-for

Defaultload

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: The window.load event
  • ready: The DOMContentLoaded event
  • networkidle0: After there have been zero new network connections attempted for 500ms
  • networkidle2: After there have been a maximum of two network connections attempted for 1 second
  • js:NAME_OF_EVENT: When a CustomEvent has been triggered on the window object, eg: js:my_event would allow zshot to 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, zshot will wait that number of seconds before continuing. 5 would wait 5 seconds, 2.5 would wait 2.5 seconds and 0 would 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.