A single-page app (SPA) built with React or Vue sends the browser an almost empty HTML page and then builds the real page with JavaScript. That breaks the waits most screenshot scripts rely on. We built the same small shop in React and in Vue, captured its product page with each Puppeteer wait condition, five times each, and recorded what was on screen. In both apps, load captured a blank page, networkidle2 captured grey placeholders, networkidle0 never fired at all, and page.waitForNavigation() returned before the new page had appeared. This guide shows the measurements, explains each failure from the libraries' own documentation, and gives a tested helper that waited correctly in every run.
The test apps
Both apps have a home page and a /products route. They were built with Vite 8.3.5: React 19.3.1 with React Router 7.18.5, and Vue 3.5.44 with Vue Router 5.4.0. They behave the way many production SPAs do:
- The products route is code-split, so its JavaScript chunk loads only when you visit it. Our test server delays that chunk by 300 ms.
- The route first shows six grey skeleton cards, then fetches its data from
/api/products, which takes 900 ms.
- Each card's image takes 600 ms and fades in over 400 ms once it has loaded.
- A "live stock updates" badge in the header keeps a server-sent events stream open, the kind of connection used for live prices, chat or notifications.
- The Vue app fades between routes with a
<Transition mode="out-in">.
The screenshots are 1000 × 640 pixels. All times are from the start of page.goto() or the click.
Deep links: what each wait condition captured
A deep link means opening /products directly, as a screenshot job normally does. Each row is the median of five runs, with the range in brackets. What was on screen was the same in all five runs.
| Wait | React | Vue | On screen |
|---|
waitUntil: "load" | 160 ms (127–194) | 161 ms (141–172) | React: "Loading…"; Vue: header only |
waitUntil: "networkidle2" | 958 ms (912–984) | 706 ms (666–756) | six skeleton cards |
waitUntil: "networkidle0" | timed out at 10 s | timed out at 10 s | nothing; the call threw TimeoutError |
waitForSelector(".card") | 464 ms (448–598) | 530 ms (503–667) | six skeleton cards |
waitForSelector(".card:not(.skeleton)") | 1,391 ms (1,337–1,522) | 1,627 ms (1,376–2,217) | real cards, no images yet |
waitForSpaReady (below) | 2,997 ms (2,945–3,100) | 3,066 ms (2,997–3,135) | complete page |

Four separate problems show up in this table.
load fires before the app has rendered anything. The HTML and the main bundle are loaded at that point, but the route's chunk and its data are not. React showed its Suspense fallback; Vue had rendered the header and an empty route.
networkidle2 tolerates exactly the connections an SPA keeps open. Puppeteer defines it as no more than 2 network connections for at least 500 ms, and networkidle0 as no connections for 500 ms. Our app had the live-updates stream open the whole time, plus one slow API request. That is two connections, so networkidle2 decided the page was idle while the data was still on its way, and captured the skeletons.
networkidle0 never fires on a page with a stream. The server-sent events connection never closes, so the count never reaches zero, and page.goto() threw a TimeoutError after our 10-second limit in all ten runs. The same follows for long polling, which also keeps a request open. With Puppeteer's default navigation timeout of 30 seconds, a script waits 30 seconds and then fails.
A selector that skeletons also match proves nothing. Skeleton cards often share the class of the real cards. waitForSelector(".card") returned in under half a second, on the placeholders. Excluding them with .card:not(.skeleton) got the real cards, but the images were still loading and invisible.
The hidden cost of a live connection
The ready helper needed about 3 seconds, though the delays we built in add up to about 2.2 seconds. The browser's resource timings showed why. Five images were requested at the same moment, and the sixth was only sent when they finished, 600 ms later.
Our test server speaks HTTP/1.1. MDN's EventSource page warns that server-sent events not used over HTTP/2 run into a limit of six open connections per browser and domain. The live-updates stream held one of the six for the whole session, so the sixth image had to queue. Over HTTP/2 this limit does not apply in the same way, but on HTTP/1.1 sites a stream or a long poll slows every capture you take.
In-app navigation: waitForNavigation returns too early
Some jobs have to click through an app: open a dashboard, then click into a report. Clicking a link in an SPA doesn't load a new document. The router changes the URL with the History API and renders the new route itself. Puppeteer's documentation says this counts as a navigation, and that waitForNavigation() then resolves with null. We tested what that means in practice: open the home page, click the link to /products, wait, and capture.
| Wait after the click | React | Vue |
|---|
page.waitForNavigation() | 124 ms: URL is /products, home page still showing | 416 ms: URL is /products, home page fading out at 42% opacity |
waitForNavigation({ waitUntil: "networkidle2" }) | 681 ms: skeleton cards | 426 ms: home page fading out at 30% opacity |
waitForSpaReady | 2,996 ms: complete page | 3,532 ms: complete page |
In both apps, waitForNavigation() resolved when the URL changed, not when the new page appeared, and asking it for networkidle2 didn't help.

The two routers get there differently. React Router 7 runs navigations as React transitions; its upgrade guide describes the change as using React.useTransition for router state updates, with a flag to opt out in v7. The React docs explain that during a transition React keeps showing the previous page rather than hiding content that was already revealed. So while the products chunk loaded, the URL said /products and the screen still showed the home page.
Vue Router resolves async route components before it confirms a navigation, and updates the DOM after that. That is why the URL changed only about 400 ms after the click, once the chunk, which our server delays by 300 ms, had arrived. Then the out-in transition, which per the Vue docs animates the old element out before inserting the new one, was still running when our screenshot was taken.
A helper that waits for the real content
The helper below waits for four things: the selector of the real content is visible, no placeholder is left, every image has finished loading, and every animation that will end has ended. document.getAnimations() lists CSS animations, CSS transitions and Web Animations, so it covers image fade-ins and route transitions. Animations that run for ever, such as a loading spinner, are skipped. We checked that on a page with an infinite spinner and a 1.5-second fade: the helper resolved after 1,554 ms. Finally it waits for web fonts.
async function waitForSpaReady(page, { content, placeholder = ".skeleton, [aria-busy='true']", timeout = 15000 }) {
await page.waitForSelector(content, { visible: true, timeout });
await page.waitForFunction(
(placeholder) => {
if (document.querySelector(placeholder)) return false;
if (![...document.images].every((img) => img.complete)) return false;
return document.getAnimations().every(
(animation) => animation.playState !== "running" || animation.effect.getComputedTiming().endTime === Infinity,
);
},
{ timeout, polling: 100 },
placeholder,
);
await page.evaluate(() => document.fonts.ready);
}
module.exports = { waitForSpaReady };
It works the same for a deep link and after a click. Here it is against the Vue app:
const puppeteer = require("puppeteer");
const { waitForSpaReady } = require("./spa-ready");
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setViewport({ width: 1000, height: 640 });
await page.goto("http://localhost:4102/products");
await waitForSpaReady(page, { content: ".card:not(.skeleton)" });
await page.screenshot({ path: "products.png" });
await page.goto("http://localhost:4102/");
await waitForSpaReady(page, { content: "#to-products" });
await page.click("#to-products");
await waitForSpaReady(page, { content: ".card:not(.skeleton)" });
await page.screenshot({ path: "products-after-click.png" });
console.log(await page.$$eval(".card img", (imgs) => imgs.map((img) => getComputedStyle(img).opacity).join(" ")));
await browser.close();
})();
Output, with all six images fully faded in:
1 1 1 1 1 1
Three things to adapt for your own app:
- Choose a
content selector that only real content matches. A product title, a chart's SVG or a table row with data, never a class that placeholders share.
- Pass your app's placeholder selector if it doesn't use
.skeleton or aria-busy="true".
- Leave
waitUntil at its default. The helper does the waiting, so a networkidle wait only adds time, or a timeout on pages with a stream.
If you own the app, the most reliable signal is one the app sets itself, such as an attribute on <body> once its data has rendered. Then content can simply be that attribute's selector.
Deep links need the server's fallback
One more failure has nothing to do with waiting. A route like /products exists only inside the app. If the server doesn't answer unknown paths with index.html, a deep link returns a 404 page. The Vue Router docs describe exactly this for HTML5 history mode, and the fix is a catch-all fallback on the server.
We served the React build without that fallback and opened /products. page.goto() returned normally, with a response whose status was 404, and the screenshot showed "404 Not Found". Puppeteer documents that goto doesn't throw for HTTP error statuses, so a script that doesn't check response.status() saves the error page as if it were the screenshot. Check the status, or open the app's root and click through.
Choosing a wait for an SPA
| Situation | Use |
|---|
| Deep link to a route | goto, then wait for the real content's selector, images and animations |
| Clicking through the app | the same helper after the click; not waitForNavigation() |
| Page has live updates, chat or polling | never networkidle0; it times out |
| Skeleton screens | a selector the skeletons don't match |
Server without an index.html fallback | check response.status(), or start from the root |
If you capture SPAs with our screenshot API, the same rule applies: set its waitFor option to the selector of the real content, not one the placeholders also match.
How we tested
On 28 October 2026 we built both apps with Vite and served them from a small Node.js server over HTTP/1.1 on localhost, with the delays described above. Puppeteer 24.11.1 drove its bundled Chrome 138.0.7204.49 in headless mode on a Mac. Each deep-link wait ran five times per app in a fresh page; the in-app navigation tests ran once per wait and app. We recorded the time each wait took, then counted skeleton cards, real cards and fully visible images in the page at the moment of the screenshot. The image timings come from the page's performance.getEntriesByType("resource") entries.