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

“Error overlay” can mean three different things in a Playwright run: a page element that blocks a click, an application or development-server error screen, or Playwright’s own test information shown in recorded video. The fix depends on which one you have. Explicitly dismiss a predictable page overlay; use page.addLocatorHandler() for an unexpected, variable overlay; and investigate an application error through pageerror instead of hiding it. Playwright does not provide one switch that disables every framework’s error screen.

Identify which overlay you are seeing

Start with the screenshot, trace, or video from the failed test and read the overlay’s text. Then classify it before changing the test.

A blocking page element

This is a normal DOM element such as a cookie dialog, newsletter prompt, chat panel, maintenance banner, or site modal. It sits above the control your test needs and causes an actionability failure, commonly “element is not receiving pointer events” or a timeout while Playwright waits for the target to become actionable.

An application or development error screen

This is a screen rendered by your application or its development server after a JavaScript exception, failed module load, or framework error. It is not a Playwright control. Removing it would hide evidence of a page failure, so capture the underlying exception first.

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

Playwright test information in a video

Playwright Test can place test information on recorded video through its video test option. That status display is different from a runtime page overlay; changing the application DOM will not remove it. See the Playwright TestOptions reference for the video setting used by your version.

#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

Dismiss a predictable overlay in the normal test flow

When the same overlay appears at a known point, Playwright recommends waiting for it and dismissing it as part of the regular flow rather than installing a global handler. The Page API gives this guidance in its official reference.

  1. Give the overlay a stable locator. Prefer a role, accessible name, or test id owned by the application, for example page.getByRole('dialog', { name: 'Cookie preferences' }).
  2. Wait for the visible state. Waiting for the actual element avoids a race in which the test clicks before the dialog is attached.
  3. Use the ordinary close or consent control. This exercises the same path a visitor uses and lets the site remove any backdrop it created.
  4. Assert that the blocker is gone. A hidden dialog with a still-visible backdrop can continue to intercept pointer events.
import { test, expect } from '@playwright/test';

test('opens the checkout after dismissing the consent dialog', async ({ page }) => {
  await page.goto('https://shop.example.test/checkout');

  const consent = page.getByRole('dialog', { name: 'Cookie preferences' });
  await consent.waitFor({ state: 'visible', timeout: 5000 });
  await consent.getByRole('button', { name: 'Accept all' }).click();
  await expect(consent).toBeHidden();

  await page.getByRole('button', { name: 'Place order' }).click();
});

Keep this code close to the navigation that triggers the dialog. Do not add a long, unconditional sleep: it slows every run and still fails when the overlay appears later than expected. If the dialog is optional and may not appear, use a short, targeted visibility check and continue when it is absent, rather than masking unrelated failures.

Use page.addLocatorHandler() for an unexpected or variable blocker

A locator handler is useful when a known overlay can appear at different times and would otherwise interrupt many unrelated actions. Register a locator for the visible blocking element and a callback that makes that element disappear. Playwright checks the handler before actions that require actionability and before auto-waiting assertions; it is not a background observer running continuously while the test is idle.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import { test, expect } from '@playwright/test';

test('continues when a support prompt appears', async ({ page }) => {
  await page.addLocatorHandler(
    page.locator('[data-testid="support-overlay"]'),
    async overlay => {
      const close = overlay.getByRole('button', { name: 'Close' });
      await close.click();
    }
  );

  await page.goto('https://app.example.test');
  await page.getByRole('link', { name: 'Reports' }).click();
  await expect(page.getByRole('heading', { name: 'Reports' })).toBeVisible();
});

The callback must actually remove the blocking element (or its backdrop). Merely finding it, logging it, or hiding a child is not enough if the overlay still intercepts input. Make the handler idempotent: it should work whether the prompt appears once or several times, and it should not throw when the close control is already gone.

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

Choose a selector that identifies the blocker, not the target

  • Use an application-owned test id when the overlay has no reliable accessible role.
  • Use a role and name for dialogs and alerts that are part of the user interface.
  • Avoid broad selectors such as div.modal if they can match legitimate dialogs that should remain open.
  • Scope the close button to the overlay locator so a similarly named button elsewhere cannot be clicked.

Understand when the handler runs

If the overlay appears while your test is waiting on neither an action nor an auto-waiting assertion, the handler is not invoked at that instant. The next actionability check may invoke it. If timing matters at a specific point, use an explicit wait and dismissal there instead of relying on the handler.

Investigate an application error screen instead of hiding it

For a red error page, framework stack trace, or development-server overlay, first record the uncaught exception. Playwright emits a pageerror event when an uncaught exception happens inside the page, and the Page API also exposes stored errors through page.pageErrors() and page.clearPageErrors() (Page API reference).

import { test, expect } from '@playwright/test';

test('captures page errors before diagnosing the overlay', async ({ page }) => {
  const liveErrors = [];
  page.on('pageerror', error => {
    liveErrors.push(error);
    console.error('uncaught page exception:', error);
  });

  await page.goto('https://app.example.test/dashboard');

  const storedErrors = await page.pageErrors();
  for (const error of storedErrors) {
    console.error('stored page exception:', error);
  }

  expect(liveErrors, 'unexpected uncaught page exceptions').toHaveLength(0);
  page.clearPageErrors();
});

Use the exception message, stack, failed resource, and the route that produced the screen to fix the application or configure that framework’s development overlay according to its own documentation. The Playwright API sources do not document a universal option for suppressing arbitrary third-party framework overlays. A framework-specific setting may exist, but it cannot be selected safely until you know which framework rendered the screen.

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

Do not confuse an exception with a normal dialog

A browser dialog such as alert(), confirm(), or beforeunload is handled with Playwright’s dialog event, not a locator handler. A DOM modal is handled with a locator. A framework error screen is diagnosed through page errors. Treating all three as “the Playwright overlay” leads to brittle tests and lost failures.

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.

Use Playwright diagnostics to separate an interaction failure from a page failure

Read the complete failure message and call log first. They show which locator Playwright resolved, which actionability check was pending, and whether the element was covered, hidden, moving, or disabled. For API-level logging, run the official debug command:

DEBUG=pw:api npx playwright test

On Windows PowerShell, set the variable for the command with $env:DEBUG='pw:api'; npx playwright test. The Playwright debugging guide documents the API logging workflow and other diagnostic options.

Choose the right approach

What you observe Preferred action Why Timing limitation
A known consent or modal appears at a predictable step Explicitly wait, dismiss, and assert hidden It is part of the normal user flow and keeps the test readable Runs exactly where you place it
A known blocker appears unpredictably during many actions page.addLocatorHandler() Centralizes a repeatable dismissal Checked around actions and auto-waiting assertions, not while idle
A framework error page or stack trace appears Capture pageerror, inspect stored errors, fix or configure the framework The overlay may be evidence of a real application defect There is no Playwright-wide suppression switch
Text appears only in a recorded video Inspect the video configuration It is Playwright’s test-status display, not page DOM Controlled by the video option documented for your version

Common failures and fixes

The handler never runs

Cause: no actionability check or auto-waiting assertion occurred after the overlay appeared, or the locator does not match the visible element. Fix: verify the selector in the trace, then add an explicit wait and dismissal at the point where the overlay is expected.

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

The handler runs but the click still times out

Cause: the callback clicked the wrong control, left a backdrop in place, or matched a hidden duplicate. Fix: scope the close button to the matched overlay, assert the overlay is hidden, and inspect the post-handler DOM in a trace.

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

A test fails after adding a broad handler

Cause: the handler is matching a legitimate dialog or consuming a control that the scenario needs. Fix: narrow the locator to a unique role, name, or test id and install it only on pages where that overlay is expected.

The page shows an error screen but no locator matches

Cause: it is likely rendered by the application rather than a dismissible DOM prompt. Fix: attach the pageerror listener before navigation, inspect the stored errors, and repair the failing route or framework configuration.

CI output is too vague

Cause: only the final timeout is visible. Fix: enable DEBUG=pw:api, retain the trace or video for the failed test, and compare the call log with the page-error output.

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

A fixed sleep makes the suite slow and flaky

Cause: the delay guesses when the overlay will appear. Fix: wait for the overlay’s visible state and then wait for it to become hidden after dismissal. Use a short, explicit timeout only when the product behavior has a known bound.

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.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is a clean image of a deployed page for a failure report, documentation, or visual check, ScreenshotNeo provides a website screenshot API. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients.

One GET request is enough (see the ScreenshotNeo API documentation):

curl -G 'https://api.screenshotneo.com/v1/shot' -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

The same request in 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)

And in 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}`);
const body = Buffer.from(await res.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('shot.webp', body));

ScreenshotNeo includes full-page capture, element selection, device presets, custom CSS and JavaScript, waits, request blocking, cookies and headers, PDF output, signed links, asynchronous jobs, bulk capture, caching, and an OpenAPI specification. Every plan includes every feature. The free plan allows 1,000 screenshots each month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account to get started.

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

Keep the test honest

Remove only overlays that are expected product behavior or known incidental UI. If the screen reports an exception, preserve it in CI artifacts and fix its cause. A clean test run should mean the page reached the intended state—not that an error was covered up.

Frequently Asked Questions

Should a CI test dismiss every overlay to keep screenshots clean?

No. Dismiss only a known, non-error page element. Preserve framework error screens and page exceptions so the build exposes real regressions; clean presentation screenshots can be generated separately.

How can I tell whether a failure is caused by the overlay or by the page itself?

Compare the action call log with the page-error output: an actionability timeout with no page exception points to an obstructing element, while an uncaught exception or framework stack trace points to an application failure.

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.

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.