logo of Screenshot for Web
Free toolsPlaygroundDocsBlogPricing
LoginDashboard

Company

HomeFeaturesPricingBlogFacts

Screenshot Tools

Website ScreenshotsFull Page ScreenshotsScrolling ScreenshotsWebsite HistoryPDF Generation APIScreenshot API

Legal

Terms of UsePrivacy PolicyCookie PolicyCopyrightSecurity

Support

FAQSupportContact UsAPI Status
screen shot for web logo

No clutter. No distractions. Just clean, full-page screenshots with smart customization.

© 2026 HYDRANODE LTD. All rights reserved.

Screenshot for Web is operated by HYDRANODE LTD, a company registered in England and Wales, company number 15672526. Registered office: 124 City Road, London, London, England, EC1V 2NX.

FacebookInstagramLinkedInYouTube
  1. Home
  2. Blog
  3. Guides

Screenshots of React and Vue apps: why the usual waits fire too early, tested

We captured a React app and a Vue app at each Puppeteer wait condition, on deep links and after in-app clicks: what each one caught, and a helper that waits properly.

Screenshot for Web·October 28, 2026·8 min read

Sources

  1. Puppeteer API: PuppeteerLifeCycleEvent (networkidle0 and networkidle2)
  2. Puppeteer API: Page.waitForNavigation() (History API navigations)
  3. Puppeteer API: WaitForOptions (30-second default timeout)
  4. Puppeteer API: Page.goto() (no error on HTTP error statuses)
  5. React docs: Suspense, preventing already revealed content from hiding
  6. React Router: upgrading from v6 (v7_startTransition)
  7. Vue Router: the full navigation resolution flow
  8. Vue Router: HTML5 history mode and server configuration
  9. Vue docs: Transition and mode out-in
  10. MDN: EventSource (connection limit without HTTP/2)
  11. MDN: Document.getAnimations()

How this article was made

Researched and drafted with AI assistance from the sources listed. We built the React and Vue test apps, ran every script and made every screenshot on 28 October 2026 with Puppeteer 24.11.1 and its bundled Chrome 138, on a Mac, against a local test server.

Capture any page without ads, banners or chat widgets, free and without an account.

Try the free tools

More articles

  • News

    Puppeteer 25.19 stops print and dark mode emulation from cancelling each other

    Before Puppeteer 25.19.0, emulateMediaType and emulateMediaFeatures reset each other, losing print or dark mode. Our tests, the fix and a workaround.

    November 26, 2026
  • News

    Chrome 158 drops XSLT: what it does to screenshots of sitemaps and feeds

    We captured eight live sitemaps in Chrome 156 and Chromium 158. Styled pages turn into raw XML, a red warning bar is already in captures, and two fixes work.

    November 9, 2026
  • Research

    Chrome DevTools' full-size screenshot: where it fails on long and lazy pages

    We ran DevTools' full-size screenshot on six long pages: it stops at 16,384 pixels and misses content that appears on scroll. Here's why, and the fixes that worked.

    November 8, 2026

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.

WaitReactVueOn 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 stimed out at 10 snothing; 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 screenshots of the React product page. With load it shows only Loading, with networkidle2 six grey skeleton cards, with a selector for the real cards the names and prices without images, and with waitForSpaReady all six cards with coloured images.

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 clickReactVue
page.waitForNavigation()124 ms: URL is /products, home page still showing416 ms: URL is /products, home page fading out at 42% opacity
waitForNavigation({ waitUntil: "networkidle2" })681 ms: skeleton cards426 ms: home page fading out at 30% opacity
waitForSpaReady2,996 ms: complete page3,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 Vue test shop's home page, faded to light grey text, captured after page.waitForNavigation() resolved: the URL had already changed to /products but the old page was still fading out.

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.

// spa-ready.js
// Wait until a single-page app has rendered real content: the content selector is visible,
// no placeholder is left, every image has loaded, finite animations have finished and fonts are ready.
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 });

  // 1. A deep link: load the route directly.
  await page.goto("http://localhost:4102/products");
  await waitForSpaReady(page, { content: ".card:not(.skeleton)" });
  await page.screenshot({ path: "products.png" });

  // 2. A client-side navigation: click, then wait for the new route's content.
  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:

  1. 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.
  2. Pass your app's placeholder selector if it doesn't use .skeleton or aria-busy="true".
  3. 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

SituationUse
Deep link to a routegoto, then wait for the real content's selector, images and animations
Clicking through the appthe same helper after the click; not waitForNavigation()
Page has live updates, chat or pollingnever networkidle0; it times out
Skeleton screensa selector the skeletons don't match
Server without an index.html fallbackcheck 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.