Skip to content
Failure diaryBy 8 min read

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.

  1. A page titled Orders with a table whose rows are grey placeholder bars; no order numbers or names

    A page of grey bars at domcontentloaded

  2. The Orders page with grey skeleton rows, captured while the data was still on its way

    The default holds, until the data is slow

  3. The Orders page with grey skeleton rows after the network had gone quiet and before the app asked for its data

    networkidle is a guess about the future

  4. The Orders page with grey skeleton rows, captured after the selector for the table had matched the skeleton table

    A selector that matches the skeleton

  5. The Orders page with the order rows drawn in faint grey text, part way through a fade-in

    Visible, but not yet there: the fade-in

  6. The Reports page with its heading and grey skeleton rows, captured right after a click on the Reports link

    A route change by click

  7. The Orders page with a pink error box that says the orders could not be loaded

    The picture is right; the data never came

  8. The Orders page with all eight order rows drawn: numbers, names, totals and status labels

    The picture you wanted

Failure diaryRun on 12 November 2026Chromium 153

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.

  1. Load the page up to the stage in wait_until.
  2. With load or networkidle: 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.
  3. Wait for wait_for_selector to be visible.
  4. Sleep for delay.
  5. Click click, pause 250 ms, wait up to 3 s for the load event.
  6. 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=domcontentloaded

What came back

The header, the heading and a table of 8 rows of grey bars (32 skeleton bars, no data rows). It came back in about 1 s. The same on all 9 situations: none showed a data row.

Why

A single-page app draws its skeleton the moment its script runs, which is before the load event, and it asks for its data after that. This option also skips the settle step, the short wait the renderer adds after the load event, so nothing is left to catch the data.

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).

A page titled Orders with a table whose rows are grey placeholder bars; no order numbers or names
Capture 1: a page of grey bars at domcontentloaded.

Flaky

The default holds, until the data is slow

What I sent

(nothing: wait_until=load, the default)

What came back

With data after 2.5, 3 and 3.5 s, all 3 captures of each showed rows. At 4 s and 4.5 s only 1 of 3 did. At 5 s all 3 did, though the first run had caught a skeleton at 5 s. At 6 s none did (0 of 3).

Why

After the load event the renderer waits up to 3 s for the network to go quiet, then up to 3 s for the picture to stop changing. A skeleton that does not change counts as a picture that stopped changing. Data that lands near the end of that window is caught on one capture and missed on the next, which is worse than a clean failure.

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).

The Orders page with grey skeleton rows, captured while the data was still on its way
Capture 2: the default holds, until the data is slow.

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=networkidle

What came back

The app waited before it asked its API. After 0.3 s both the default and networkidle showed rows 2 of 2 times. After 0.8 s the default showed rows 1 of 2 and networkidle 2 of 2. After 1.5 s and 3 s, neither did: 0 of 2 each. In the first run a delay of 2 s fixed the 1.5 s case.

Why

Playwright counts the network as idle after at least 500 ms with no connections.[1] An app that starts its fetch later than that, because it loads a chunk first, checks a flag or waits for a timer, is idle before it asks for anything. The picture then holds still, and the settle step stops waiting.

The fix. Name the thing you are waiting for. A delay works here but guesses how long; a data element does not guess.

The Orders page with grey skeleton rows after the network had gone quiet and before the app asked for its data
Capture 3: networkidle is a guess about the future.

Captures with rows, out of 2

App asks afterDefaultnetworkidle
0.3 s2 of 22 of 2
0.8 s1 of 22 of 2
1.5 s0 of 20 of 2
3.0 s0 of 20 of 2

Trap

A selector that matches the skeleton

What I sent

wait_for_selector=.table

What came back

The request returned at once because the skeleton is also a table with the class table. With data in 5 s, 9 s and with the late fetch, the picture was the skeleton. The same request with wait_for_selector=[data-row] showed rows in 7 of 9 situations; the two it missed are entries 7 and 8.

Why

wait_for_selector resolves on the first visible match. Skeleton markup often reuses the classes of the real content so the layout does not jump.

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.

The Orders page with grey skeleton rows, captured after the selector for the table had matched the skeleton table
Capture 4: a selector that matches the skeleton.

Failed

Visible, but not yet there: the fade-in

What I sent

wait_for_selector=[data-row]

What came back

Data after 6 s, rows fading in over 0.6 s. Four captures read the opacity of the rows just before the picture: 0.95, 0.71, 0.91, 0.58. With delay=1 added, 4 of 4 were at 1.00. With a selector for an attribute the app sets when the fade ends, 4 of 4 were at 1.00.

Why

Playwright treats an element with opacity 0 as visible.[2] The selector matched when the rows were put into the page, not when they finished appearing.

The fix. Add a short delay, turn animations off with reduced_motion, or select the element that the app marks after its transition.

The Orders page with the order rows drawn in faint grey text, part way through a fade-in
Capture 5: visible, but not yet there: the fade-in.

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=5

What came back

delay=5 got rows in 7 of 9 situations and delay=2 in 6. It missed the 9 s case. On the page whose data came in 0.3 s the picture took 2.6 s by default, 4.0 s with delay=2 and 7.0 s with delay=5, one capture each.

Why

A delay is a sleep after the other waits end. It is long enough for the slow page and a waste on the fast one, and it is fixed.

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 waits

What came back

All nine pictures showed the Reports heading over grey bars: 16 skeleton bars, 0 rows. That includes delay=5, which took 15.5 s.

Why

In the renderer, the waits run first and the click after them. After the click there is a pause of 250 ms and a wait of up to 3 s for the load event, which a client-side route change never fires. The data of the new route has not been asked for yet when the picture is taken, so a wait set on the request cannot wait for it.

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.

The Reports page with its heading and grey skeleton rows, captured right after a click on the Reports link
Capture 7: a route change by click.

Trap

The picture is right; the data never came

What I sent

wait_for_selector=[data-row]

What came back

With the API answering 500, the default capture showed a red box that says the orders could not be loaded. Every wait for a data element ended in selector_not_found when the lab timeout ran out, status 422.

Why

No wait changes what a server answers. The page drew an error, which is what it was asked to do.

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.

The Orders page with a pink error box that says the orders could not be loaded
Capture 8: the picture is right; the data never came.

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.

SituationDefault (load)domcontentloadednetworkidledelay 2delay 5selector .tableselector [data-row]selector [data-ready]commit + [data-ready]
Data in 0.3 sThe API answers after 0.3 s.RowsSkeletonRowsRowsRowsRowsRowsRowsRows
Data in 2.5 sThe API answers after 2.5 s.RowsSkeletonRowsRowsRowsRowsRowsRowsRows
Data in 5 sThe API answers after 5 s.SkeletonSkeletonRowsRowsRowsSkeletonRowsRowsRows
Data in 9 sThe API answers after 9 s.SkeletonSkeletonRowsSkeletonRowsSkeletonRowsRowsCut at 10 s
Fetch starts at 1.5 sThe app waits 1.5 s, then asks the API (answer 0.3 s).SkeletonSkeletonSkeletonRowsRowsSkeletonRowsRowsRows
Rows fade inData in 0.8 s; the rows fade in over 0.6 s.RowsSkeletonRowsRowsRowsRowsRowsRowsRows
Route by addressThe Reports route opened by its own address; data in 2.5 s.RowsSkeletonRowsRowsRowsRowsRowsRowsRows
Route by clickThe Orders page, then a click on the Reports link; data in 2.5 s.SkeletonSkeletonSkeletonSkeletonSkeletonSkeletonSkeletonSkeletonSkeleton
API answers 500The API fails; the app draws an error box.Error boxSkeletonError boxError boxError boxNo matchNo matchNo matchNo match
Showed rows4 of 90 of 96 of 96 of 97 of 94 of 97 of 97 of 96 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=commit with 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_found after 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.

The Orders page with all eight order rows drawn: numbers, names, totals and status labels
The picture of the Orders page that was wanted: every row drawn, taken with a wait for the ready attribute.

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

Your app is not Shopdesk. A real site adds consent banners, bot checks and slow third parties. The waits above are the ones to try first; the picture with no wait at all is the first thing to look at.

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. [1]Playwright documentation, Auto-waiting and actionability checks. Checked .
  2. [2]Playwright documentation, Page: waitForLoadState and the networkidle state. Checked .

Screenshot any page in one step

Paste an address into CurlShot and download the screenshot. A free account gives you 50 screenshots every month. No card needed.