Capturing a single-page app: a failure diary
One small app that draws grey bars first and fetches its data afterwards. I captured it wrong eight times, on purpose. Each picture below is a real result; each one has a reason and a fix.

A page of grey bars at domcontentloaded

The default holds, until the data is slow

networkidle is a guess about the future

A selector that matches the skeleton

Visible, but not yet there: the fade-in

A route change by click

The picture is right; the data never came

The picture you wanted
The app I kept breaking
It is called Shopdesk and it is one HTML file. A header holds two links, Orders and Reports. A router built on history.pushState swaps the page without a reload. Each page draws a table of grey skeleton bars first, asks a local server for its data after the page has loaded, then replaces the bars with rows. I made the server answer after any delay I liked.
Before the entries, the order in which the renderer waits, read from its source. It matters in entries 6 and 7.
- Load the page up to the stage in
wait_until. - With
loadornetworkidle: wait for the network to go quiet (up to 3 s, or 10 s for networkidle), then up to 3 s for the picture to stop changing. - Wait for
wait_for_selectorto be visible. - Sleep for
delay. - Click
click, pause 250 ms, wait up to 3 s for the load event. - Refuse a page that is blank, then take the picture.
The same steps are in the waiting and timing page of the docs. How I ran them is at the end.
Failed
A page of grey bars at domcontentloaded
What I sent
wait_until=domcontentloadedWhat came back
Why
The fix. Leave it for the cases where speed matters more than the page, or pair it with a wait for an element (the last entry shows that pair).

Flaky
The default holds, until the data is slow
What I sent
(nothing: wait_until=load, the default)What came back
Why
The fix. Do not depend on the default for an app whose data can take more than about 3 s. Wait for a data element instead (entry 4).

Captures with rows, out of 3
- Data after 2.5 s3 of 3
- Data after 3.0 s3 of 3
- Data after 3.5 s3 of 3
- Data after 4.0 s1 of 3
- Data after 4.5 s1 of 3
- Data after 5.0 s3 of 3
- Data after 6.0 s0 of 3
Default wait, one new browser for each capture.
Failed
networkidle is a guess about the future
What I sent
wait_until=networkidleWhat came back
Why
The fix. Name the thing you are waiting for. A delay works here but guesses how long; a data element does not guess.

Captures with rows, out of 2
| App asks after | Default | networkidle |
|---|---|---|
| 0.3 s | 2 of 2 | 2 of 2 |
| 0.8 s | 1 of 2 | 2 of 2 |
| 1.5 s | 0 of 2 | 0 of 2 |
| 3.0 s | 0 of 2 | 0 of 2 |
Trap
A selector that matches the skeleton
What I sent
wait_for_selector=.tableWhat came back
Why
The fix. Pick something that exists only after the data: a row, a total, an attribute the app sets when it is ready. If the page is yours, add one.

Failed
Visible, but not yet there: the fade-in
What I sent
wait_for_selector=[data-row]What came back
Why
The fix. Add a short delay, turn animations off with reduced_motion, or select the element that the app marks after its transition.

Opacity of the rows at the picture
selector [data-row]
0.950.710.910.58
selector [data-row] and delay 1
1.001.001.001.00
selector for the ready attribute
1.001.001.001.00
Four captures each, data after 6 s, a fade of 0.6 s. The opacity was read a moment before the picture.
Works, costs time
A fixed delay: too short here, too long there
What I sent
delay=2 and delay=5What came back
Why
The fix. Keep delay for what nothing can see, such as a chart drawing itself. For data, wait for the data.
Seconds to the picture, data ready in 0.3 s
- networkidle2.1 s
- Default2.6 s
- commit and ready selector1.5 s
- selector [data-row]2.9 s
- delay 24.0 s
- delay 57.0 s
One capture each on a busy machine: read the order, not the decimals.
Failed
A route change by click
What I sent
click=a[href="/reports"] with each of the nine waitsWhat came back
Why
The fix. Request the route by its own address. The same data, opened as the Reports address, showed rows in 8 of 8 ways that wait (all but domcontentloaded), with the revenue line in place. This needs a host that serves the app for deep links, which single-page app hosts normally do.

Trap
The picture is right; the data never came
What I sent
wait_for_selector=[data-row]What came back
Why
The fix. Treat selector_not_found as a signal that the page is broken, not as a reason to wait longer. If the API needs a header or a cookie the capture does not send, add it with headers or cookies.

Every way to wait, against every situation
81 captures: 9 situations, 9 ways to wait, one capture each. Rows means the picture shows the data. A selector for a data row showed rows in 7 of 9; the two it missed are the click and the failing API, which no wait can fix.
| Situation | Default (load) | domcontentloaded | networkidle | delay 2 | delay 5 | selector .table | selector [data-row] | selector [data-ready] | commit + [data-ready] |
|---|---|---|---|---|---|---|---|---|---|
| Data in 0.3 sThe API answers after 0.3 s. | Rows | Skeleton | Rows | Rows | Rows | Rows | Rows | Rows | Rows |
| Data in 2.5 sThe API answers after 2.5 s. | Rows | Skeleton | Rows | Rows | Rows | Rows | Rows | Rows | Rows |
| Data in 5 sThe API answers after 5 s. | Skeleton | Skeleton | Rows | Rows | Rows | Skeleton | Rows | Rows | Rows |
| Data in 9 sThe API answers after 9 s. | Skeleton | Skeleton | Rows | Skeleton | Rows | Skeleton | Rows | Rows | Cut at 10 s |
| Fetch starts at 1.5 sThe app waits 1.5 s, then asks the API (answer 0.3 s). | Skeleton | Skeleton | Skeleton | Rows | Rows | Skeleton | Rows | Rows | Rows |
| Rows fade inData in 0.8 s; the rows fade in over 0.6 s. | Rows | Skeleton | Rows | Rows | Rows | Rows | Rows | Rows | Rows |
| Route by addressThe Reports route opened by its own address; data in 2.5 s. | Rows | Skeleton | Rows | Rows | Rows | Rows | Rows | Rows | Rows |
| Route by clickThe Orders page, then a click on the Reports link; data in 2.5 s. | Skeleton | Skeleton | Skeleton | Skeleton | Skeleton | Skeleton | Skeleton | Skeleton | Skeleton |
| API answers 500The API fails; the app draws an error box. | Error box | Skeleton | Error box | Error box | Error box | No match | No match | No match | No match |
| Showed rows | 4 of 9 | 0 of 9 | 6 of 9 | 6 of 9 | 7 of 9 | 4 of 9 | 7 of 9 | 7 of 9 | 6 of 9 |
Cut at 10 s: my lab timeout ended a wait that would have worked with the default 30 s. The ready selector, rerun with 30 s on the 9 s page, showed rows at 10.8 s. The Reports route is the same data as the click, opened by its address.
The request I ended on
For a page that fills a table, wait for a row, give it a timeout longer than your slowest API answer, and ask for the route by its address. Attribute selectors need quotes in curl, so this sends each value encoded.
curl -G "https://curlshot.com/api/v1/screenshot" \ --data-urlencode "access_key=YOUR_ACCESS_KEY" \ --data-urlencode "url=https://app.example.com/reports" \ --data-urlencode "wait_for_selector=[data-row]" \ --data-urlencode "timeout=30" \ --output reports.png
- If the page is yours, set an attribute when the data and the fade are done, and wait for it. A ready attribute never caught a half-faded row in four captures.
wait_until=commitwith a selector skips the settle step and was the quickest on the fast page (1.5 s against 2.6 s for the default). Nothing else waits for the data then, so it needs the selector.- A
selector_not_foundafter the timeout means the page never showed that element. Look at the picture with no wait before you raise the timeout.
Try a page of your own on the URL to image tool or read about the request on the screenshot API page. The free plan is on pricing.

How it was run
On 12 November 2026. The app is one HTML file. It has a header with two links, a router built on history.pushState, an Orders page and a Reports page. Each page draws a table of grey skeleton bars first, fetches its data from a local server after the page has loaded, then swaps the skeleton for rows. The server answers after a delay the test sets. Each case was captured in a new Chromium 153.0.8010.12 context through Playwright 1.63.0 at 1280 x 1024, by replaying the renderer wait steps in the order of its source: load, the bot-check wait, the settle step, wait_for_selector, delay, click, the blank-page check, the picture. The settle step and the bot-check functions are the renderer files, imported unchanged. The server shared its machine with other jobs (load average 5 to 10 on 6 cores), so every time below is slower than on a quiet machine and the exact edges move from run to run.
Each of the 81 captures of the table was taken once, then the edges were checked again with three captures for the slow-data sweep, two for the late fetch and four for the fade. Counts that small show the shape, not a rate. The wait options are the ones in the documentation of CurlShot; the 500 ms of network idle and the visibility of a faded element are Playwright's own words, read on 12 November 2026. No call to the API was sent in these runs, so none of the pictures came from the service. A first run used a 10 s timeout for the waits, which cut the 9 s page short; that cell was rerun with the default 30 s.
The same wait steps decide the rest of what a capture looks like. For lazy pictures read lazy images and full-page captures, and for the larger set of reasons a picture differs from your browser, why website screenshots look wrong.
One thing the diary could not show
Questions people ask
Why is my screenshot of a React, Vue or Angular app blank or full of grey bars?
The picture was taken before the app drew its data. In the test, domcontentloaded gave a skeleton every time, and the default wait gave one when the data took 6 s. Wait for an element that exists only after the data with wait_for_selector, and set timeout above your API's slowest answer.
Does wait_until=networkidle fix a single-page app?
Only when the app asks for its data at once. Playwright counts the network as idle after 500 ms without connections, so an app that fetches later is idle first. In the test networkidle failed 2 of 2 times when the fetch started 1.5 s after load.
Should I use delay or wait_for_selector?
Use wait_for_selector for data: it ends when the element appears. In the test delay=5 got rows in 7 of 9 situations but took 7.0 s on a page that was ready in a fraction of that, and delay=2 missed the 9 s case. Keep delay for things no selector can see, such as an animation.
How do I screenshot a route of a single-page app?
Request the route's own address. A click on a link showed a skeleton with every wait in the test, because the waits run before the click and the click is followed by only a 250 ms pause. Opening the same route by address showed rows with every wait except domcontentloaded. The host has to serve the app for deep links.
Why does wait_for_selector fail with selector_not_found?
No visible element matched before the timeout. Either the selector is wrong, the element is hidden, or the data never came. In the test an API that answered 500 made every data selector time out, so check what the page shows with no wait before you raise the timeout. CurlShot returns status 422 for this error.
Sources
- [1]Playwright documentation, Auto-waiting and actionability checks. Checked .
- [2]Playwright documentation, Page: waitForLoadState and the networkidle state. Checked .
Read next
- Measured testLazy images and full-page captures, measuredFive ways a page loads pictures on scroll, seven scroll rules, 105 runs in Chromium: which full-page captures come back with every picture.
- Field guideWhy website screenshots look wrong, and the fixesA field guide to 11 ways a website screenshot goes wrong, from blank lazy images to cookie banners and cut-off pages, with the cause and the fix for each.
- Error dictionary15 curl errors on a screenshot call, with fixes15 curl errors from real runs of a screenshot call: the exact message, what it means, how to check it and the fix. Paste yours to look it up.