How to Make Loki Wait for a Website to Finish Loading Before Capturing
Use Loki’s `--chromeLoadTimeout` option to set how long Chrome waits before capture. Learn the default, package-runner syntax, and what the setting does not guarantee.
Set Loki’s --chromeLoadTimeout option to control how many milliseconds Chrome waits for a page to load before taking a screenshot. Loki’s reference lists a default of 60000 milliseconds (60 seconds). For example, to set a 90-second timeout when running Loki through Yarn:
yarn loki test -- --chromeLoadTimeout 90000
The -- separates Yarn’s options from Loki’s arguments so Yarn forwards the option to Loki. The timeout controls the documented wait before capture; it does not, by itself, promise that every asynchronous update, animation, or network request has settled. Loki’s command-line reference documents the option and default. [c001]
Set Loki’s Chrome load timeout
- Choose the timeout in milliseconds. For example,
90000is 90 seconds. - Pass it to
loki testas--chromeLoadTimeout. - If you invoke Loki through Yarn or npm, put
--before Loki’s arguments.
Direct invocation:
loki test --chromeLoadTimeout 90000
Through npm:
npm exec -- loki test --chromeLoadTimeout 90000
Through Yarn:
yarn loki test -- --chromeLoadTimeout 90000
These examples show argument forwarding and the documented option. The exact wrapper syntax can depend on how Loki is installed and invoked; consult the package runner’s help if it handles commands differently.
What the timeout controls
The Loki reference describes --chromeLoadTimeout as the number of milliseconds Loki waits for the page to load before taking a screenshot. It lists 60000 as the default. Raise the value when that wait is not sufficient for the page in your environment. The reference does not define this option as a network-idle wait or a signal that all client-side rendering is complete. [c001]
If your application fills in content after the page load event, increasing this timeout alone may not make Loki recognize that content as ready. The cited reference does not document a separate readiness-condition option, so avoid treating this flag as one.
Keep the timeout distinct from other Chrome settings
Loki’s command-line reference lists several Chrome controls separately from page-load timeout. They serve different purposes; changing them is not a substitute for setting the wait duration. [c001]
| Setting | Documented value or behavior | Relation to load timeout |
|---|---|---|
--chromeLoadTimeout |
Wait duration before capture; default 60000 ms |
Sets the page-load wait. |
| Chrome concurrency | Default 4 | Controls parallel Chrome work, not page readiness. |
| Chrome retries | Default 0 | Controls retries, not the wait duration. |
| Animation enabling | Default false | Separate capture behavior; it does not define load completion. |
| Chrome selector | Default #root > * |
A separate selector setting, not a page-load timeout. |
loki test captures screenshots and compares them with reference files. loki update captures screenshots and updates reference files, and accepts the same arguments. Use the same timeout when updating references if you need the capture wait to match your test invocation. [c001]
Choose a practical timeout
- Start with Loki’s documented default of 60000 ms unless you have a reason to adjust it.
- Increase the value if the page’s initial load routinely exceeds the chosen wait in your environment.
- Use milliseconds: 30000 is 30 seconds, 60000 is 60 seconds, and 90000 is 90 seconds.
- Keep the value consistent between screenshot comparison and reference updates when you want those commands to use the same wait.
- Do not assume a longer timeout resolves content that appears only after some application-specific event. The reference does not say Loki waits for network idle or checks a custom readiness condition.
Troubleshooting
Loki says the option is unknown
Cause: Your installed version may not accept the option, or a package runner may not be forwarding it. Fix: Check the installed Loki version’s CLI help and matching documentation. When using Yarn or npm, put the required argument separator before Loki’s arguments. The reference cited here was last updated August 27, 2024, so confirm behavior against your installed version. [c001]
The command runs, but the page still looks incomplete
Cause: The page may render or update content after the load period that this option covers. The documentation does not claim that the timeout waits for every asynchronous update or for network idle. Fix: Confirm whether the missing content arrives after the page load event and consult the documentation for your Loki version for any supported readiness mechanism. Do not assume this flag alone detects application-specific readiness.
The timeout value seems far too short or long
Cause: The option uses milliseconds, not seconds. Fix: Convert the desired duration before passing it: 45 seconds is 45000; 90 seconds is 90000.
Reference updates and tests capture at different times
Cause: The commands may be using different timeout arguments. Fix: Pass the same --chromeLoadTimeout value to both loki test and loki update. Loki documents that loki update accepts the same arguments. [c001]
Performance, reliability, and cost
A larger timeout allows Loki to wait longer before capture; it is not a performance optimization and may make a run take longer when pages need the extra time. The reference provides a default but no benchmark or guarantee about the actual duration of a run. The timeout also does not establish that a page is visually settled or that retries will occur; the reference lists Chrome retries separately, with a default of zero. [c001]
For reliable visual comparisons, keep the timeout consistent across test and reference-update runs, and investigate whether late content is tied to application readiness rather than initial page loading. No separate cost information is specified by the Loki reference.
Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server for developers. Make a screenshot with one request:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for request options. ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server offers take_screenshot, get_page_info, and capture_pdf for AI agents. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots.
Sign up free for 1,000 screenshots a month, with no card required.
FAQ
How long does Loki wait by default?
The command-line reference lists 60000 milliseconds, or 60 seconds. [c001]
Is the timeout measured in seconds?
No. The documented unit is milliseconds. For example, use 90000 for 90 seconds. [c001]
Does this option wait for network idle?
The cited reference describes a wait for the page to load before capture. It does not specify a network-idle condition. [c001]
Can I use this option with loki update?
Yes. The reference says loki update accepts the same arguments as loki test. [c001]


