What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Find out which layer is failing before changing CSS. In Puppeteer, an element can be missing from the DOM, present but hidden, clipped by layout, waiting on client-side rendering, unreachable because it is inside a frame or shadow root, or missing its stylesheet because a request stalled. Check those layers in that order: selector presence, visibility and bounds, stylesheet responses, application readiness, and selector scope. The workflow below includes runnable diagnostics and recovery patterns.

1. Prove whether the element exists

Start with the exact selector you expect. page.waitForSelector() waits for a matching node to be added; by default it checks presence, not whether the node can be seen. Use visible: true when you need Puppeteer to verify that the element is not hidden by display: none or visibility: hidden.

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.goto('https://example.com', {waitUntil: 'domcontentloaded'});

  const selector = '.hero-title';
  const present = await page.waitForSelector(selector, {timeout: 10000});
  console.log('Present:', Boolean(present));

  const visible = await page.waitForSelector(selector, {
    visible: true,
    timeout: 10000
  });
  console.log('Visible:', Boolean(visible));

  await browser.close();
})();

If the first wait times out, inspect the HTML and the code that creates the component. If presence succeeds but the visible wait fails, inspect styles and layout rather than adding a longer delay.

Inspect the DOM, computed styles, and geometry

const details = await page.$eval('.hero-title', el => {
  const style = getComputedStyle(el);
  const rect = el.getBoundingClientRect();
  return {
    text: el.textContent,
    display: style.display,
    visibility: style.visibility,
    opacity: style.opacity,
    position: style.position,
    width: rect.width,
    height: rect.height,
    top: rect.top,
    left: rect.left,
    html: el.outerHTML
  };
});
console.log(details);

A zero width or height, an off-screen coordinate, display: none, visibility: hidden, or an opacity of zero identifies a different problem from a missing node. Also inspect ancestor elements: a parent with display: none, overflow: hidden, a transform, or a stacking context can make a correctly styled child appear absent.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

2. Check stylesheet and asset requests

When request interception is enabled, every intercepted request must be continued, answered, or aborted. Puppeteer’s documentation states: “Once request interception is enabled, every request will stall unless it’s continued, responded or aborted.” A stylesheet that never receives a resolution can leave the page unstyled.

await page.setRequestInterception(true);

page.on('request', request => {
  // Do not leave requests pending.
  request.continue().catch(() => {});
});

page.on('requestfailed', request => {
  console.error('Request failed:', request.url(), request.failure());
});

page.on('response', response => {
  const type = response.request().resourceType();
  if (type === 'stylesheet') {
    console.log('CSS', response.status(), response.url());
  }
});

If you intentionally block resources, make the rule explicit and verify that CSS is not included accidentally.

page.on('request', request => {
  const blocked = new Set(['image', 'font']);
  if (blocked.has(request.resourceType())) {
    request.abort().catch(() => {});
  } else {
    request.continue().catch(() => {});
  }
});

For each stylesheet response, look for HTTP errors, redirects to an authentication page, certificate failures, or a URL that is inaccessible from the browser’s network context. Logging requestfailed and stylesheet response status is more reliable than assuming a CSS syntax problem.

3. Verify HTML and CSS when using setContent()

page.setContent() renders the HTML string you provide. Confirm that the expected markup is actually in that string and that stylesheet links resolve from the page’s base URL. Its wait options determine when the method considers loading complete; the documented default is load. That event does not prove that your application has finished rendering.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
await page.setContent(`
  <html>
    <head>
      <base href="https://example.com/">
      <link rel="stylesheet" href="/styles/site.css">
    </head>
    <body>
      <div class="hero-title">Loaded title</div>
    </body>
  </html>
`, {waitUntil: 'load'});

await page.waitForSelector('.hero-title', {visible: true});

For self-contained HTML, put critical rules in a <style> element or use an absolute, reachable stylesheet URL. If a framework inserts the element after hydration, wait for that element or an application-specific readiness signal.

4. Wait for the condition that matters

Network-idle waits describe network traffic, not visual correctness. They can be useful when a page loads data over several requests, but they do not assert that a chosen element exists, is visible, or has the intended computed style. Prefer a target-specific wait whenever possible.

Selector and function waits

await page.goto('https://example.com/dashboard', {waitUntil: 'networkidle2'});
await page.waitForSelector('[data-testid="report"]', {visible: true});

await page.waitForFunction(() => {
  const el = document.querySelector('[data-testid="report"]');
  return el && el.getBoundingClientRect().height > 0;
});

Use a stable test identifier rather than a presentation class that may change. If the application exposes a loading flag, wait for that flag to disappear and then verify the element’s bounds.

Avoid arbitrary sleeps as the primary fix

A delay can mask a race on a fast machine and still fail under load. Keep a short delay only for a documented animation or third-party widget, and pair it with a selector or function assertion.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

5. Check selector scope: document, iframe, or shadow root

Elements inside an iframe

A selector run on the main page cannot find a node inside an iframe. Wait for the frame, select it, and query that frame’s document.

await page.goto('https://example.com');
const frameHandle = await page.waitForSelector('iframe.payment');
const frame = await frameHandle.contentFrame();
if (!frame) throw new Error('Frame has not loaded');
await frame.waitForSelector('.card-number', {visible: true});

When several frames exist, identify the correct one by URL or a distinguishing element instead of assuming the first frame is the target.

Elements inside open shadow roots

Ordinary CSS selectors do not cross a shadow boundary. Puppeteer provides deep-combinator support for querying through open shadow roots. If the component uses a closed shadow root, query its public interface or interact with the host; the internal nodes are not available to page-level selectors.

const button = await page.waitForSelector('my-widget >>> button.submit', {
  visible: true
});

Confirm that the component has actually attached its shadow root before querying it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

6. Capture evidence of what Chromium rendered

A screenshot distinguishes a missing node from clipping, layout, or styling differences. Capture after the readiness condition, not immediately after navigation.

await page.waitForSelector('.hero-title', {visible: true});
await page.screenshot({path: 'debug-full.png', fullPage: true});

const card = await page.$('.pricing-card');
if (card) {
  await card.screenshot({path: 'debug-card.png'});
}

For a full-page capture, check whether the element is below the initial viewport, clipped by a container, or covered by a fixed overlay. For an element capture, verify that the selected node has non-zero dimensions before blaming the screenshot operation.

7. Reproduce the page in a visible browser

Launch headful while debugging so you can use Chromium’s Elements, Computed, Console, and Network panels. Puppeteer’s debugging guidance also recommends forwarding browser-process logs with dumpio.

const browser = await puppeteer.launch({
  headless: false,
  devtools: true,
  dumpio: true
});

Compare the same URL and viewport in the visible browser and in headless mode. Log browser console errors and page errors:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
page.on('console', message => console.log('BROWSER:', message.type(), message.text()));
page.on('pageerror', error => console.error('PAGE ERROR:', error));

In DevTools, inspect the element’s matched rules and computed values, then check whether the stylesheet request succeeded. This identifies whether the failing layer is CSS, JavaScript, a network response, or Puppeteer’s timing.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

8. A repeatable diagnostic script

The following compact script checks presence, visibility, geometry, and stylesheet responses in one run.

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  page.on('response', response => {
    if (response.request().resourceType() === 'stylesheet') {
      console.log('stylesheet', response.status(), response.url());
    }
  });
  page.on('requestfailed', request => {
    console.error('failed', request.resourceType(), request.url(), request.failure());
  });

  await page.goto('https://example.com', {waitUntil: 'networkidle2'});
  const selector = '.hero-title';
  const handle = await page.waitForSelector(selector, {timeout: 10000}).catch(() => null);
  if (!handle) throw new Error(`Not present: ${selector}`);

  const result = await page.$eval(selector, el => {
    const style = getComputedStyle(el);
    const rect = el.getBoundingClientRect();
    return {
      visible: style.display !== 'none' && style.visibility !== 'hidden',
      opacity: style.opacity,
      width: rect.width,
      height: rect.height,
      top: rect.top,
      left: rect.left
    };
  });
  console.log(result);
  await page.screenshot({path: 'diagnostic.png', fullPage: true});
  await browser.close();
})();

9. Common symptoms and fixes

Symptom Likely layer Check and fix
waitForSelector times out DOM or scope Confirm markup, URL, frame, and shadow-root boundary; use a stable selector.
Selector resolves but screenshot is blank Visibility or layout Read computed styles and getBoundingClientRect(); inspect ancestors and overlays.
Everything is unstyled Stylesheet request Log stylesheet responses and failures; resolve every intercepted request.
Works in a browser, fails in automation Readiness or environment Use the same viewport and URL, wait for the application condition, and inspect console/network logs.
Only iframe content is missing Frame scope Obtain the correct Frame and query it instead of the top-level page.
Only web-component internals are missing Shadow DOM scope Use Puppeteer’s deep selector for an open root or the component’s public API.

10. Reliability and performance considerations

  • Prefer one precise selector wait over a long global delay; it reduces test time and makes failures actionable.
  • Use networkidle2 only when the page’s network behavior makes it useful, then add a target-specific assertion.
  • Reuse a browser process for batches of pages, but create isolated pages and close them in a finally block.
  • Record the URL, selector, viewport, wait condition, failed requests, and computed-style result with each failure.
  • Do not block stylesheets, scripts required for hydration, or fonts needed for the layout unless the test explicitly intends to do so.

Or skip the browser setup

If your goal is a dependable website image rather than debugging Puppeteer itself, ScreenshotNeo provides a single screenshot request. It accepts cookie and consent banners like a visitor, removes more than 60 known consent platforms plus newsletter popups and chat widgets before capture, and lets you turn each cleanup step off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed; response headers identify the page verdict and billing result. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients.

See the parameter details in the ScreenshotNeo documentation. cURL:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

Every plan includes the feature set, including full-page lazy-image loading, element selectors, device presets, custom CSS and JavaScript, waits, request blocking, cookies and headers, geolocation, resizing, caching, signed links, asynchronous jobs, bulk capture, usage data, and PDF output. The Free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000. Create a free ScreenshotNeo account.

Frequently Asked Questions

Should I always wait for network idle in Puppeteer?

No. Network idle only describes recent network activity. Combine it with a selector or function wait that proves the element your test needs is present and visible.

Why does a selector work in page.evaluate but not in a screenshot?

The node may exist while being hidden, zero-sized, clipped, covered, or outside the captured region. Compare computed styles and bounding-box values before capture.

Can Puppeteer query a closed shadow root?

Not through ordinary page selectors. Closed-root internals are intentionally inaccessible; use the component’s public behavior or an exposed test hook.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.