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.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

To hide an element only in a Playwright screenshot, pass a screenshot-time stylesheet: await page.screenshot({ style: '.ad-slot { display: none !important; }' }). Use mask instead when you want an opaque cover rather than true visual removal.

Hide the element with screenshot-time CSS

Playwright applies the style string while it captures the image. The page is not permanently edited, so the same browser context can continue testing the original DOM after the screenshot. This is useful for advertisements, timestamps, rotating recommendations, newsletter prompts, and other transient content.

The simplest page screenshot

await page.screenshot({
  path: 'page.png',
  style: '.ad-slot { display: none !important; }'
});

display: none removes the matched element from the rendered image and its layout. Use a selector that identifies only the content you intend to suppress. A class or data attribute owned by your application is safer than a generic selector such as div or .popup. Add !important when the site’s own rules might otherwise override your capture stylesheet.

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

Complete runnable JavaScript example

import { chromium } from 'playwright';

const browser = await chromium.launch();
const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });

try {
  await page.goto('https://example.com', { waitUntil: 'networkidle' });
  await page.screenshot({
    path: 'clean-page.png',
    fullPage: true,
    style: '.ad-slot, [data-testid="newsletter-modal"] { display: none !important; }'
  });
} finally {
  await browser.close();
}

The stylesheet is temporary: it affects the capture operation, not the site’s source files and not subsequent browser sessions.

#1 Best Overall
Sale
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

display: none or visibility: hidden?

Choose display: none when the element should disappear and stop occupying layout space. Choose visibility: hidden when you want the element’s box to remain in the layout while its pixels are absent. Both are screenshot-time CSS rules; neither deletes the element from the DOM.

Capture one element with a locator

A locator screenshot clips the result to the matching element. It performs actionability checks and scrolls the element into view before capture. You can also supply style to a locator screenshot.

const card = page.locator('[data-testid="product-card"]');
await card.screenshot({
  path: 'product-card.png',
  style: '.price-change, .live-badge { visibility: hidden !important; }'
});

Use a page screenshot when the thing you are hiding is elsewhere on the page or when you need the surrounding layout. A locator whose own display is set to none cannot provide a useful image of the surrounding page; target a visible parent or take a page screenshot with the hiding rule instead. If the target detaches between the actionability check and capture, the locator screenshot fails, so wait for the component to settle or locate it again.

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

Hiding versus masking

Hiding and masking solve different visual problems:

Need Use What appears in the image What happens to the DOM
Make an element absent style with display: none or visibility: hidden The element’s pixels are not shown The DOM remains unchanged for the page
Cover a value while keeping its box mask with a locator An opaque rectangle covers the locator’s bounding box The content still exists underneath the overlay

Mask a sensitive or variable value

await page.screenshot({
  path: 'redacted.png',
  mask: [page.locator('.private-value')],
  maskColor: '#000000'
});

Playwright’s default mask overlay is pink, #FF00FF. Set maskColor to any CSS color when a black, white, or brand-colored block is preferable. A mask covers the matched element’s bounding box; it does not remove text from the DOM or from accessibility and test queries. The locator API documents masks as overlays and notes that a locator mask is applied even to invisible elements. If visibility matching matters to your case, verify the behavior against the Playwright version installed in your project.

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

Selectors that remain stable

Prefer a dedicated test identifier or application-owned attribute:

await page.screenshot({
  path: 'without-chat.png',
  style: '[data-testid="support-chat"] { display: none !important; }'
});

Do not rely on generated class names, nth-child positions, or text that changes with localization. If several independent widgets must disappear, list their selectors in one stylesheet and keep the rule narrowly scoped:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const hideTransientUi = `
  [data-testid="cookie-banner"],
  [data-testid="newsletter-modal"],
  .chat-launcher {
    display: none !important;
  }
`;

await page.screenshot({ path: 'stable.png', style: hideTransientUi });

Shadow DOM and inner frames

The documented screenshot stylesheet crosses Shadow DOM boundaries and applies to inner frames. That lets a page capture hide matching content inside a web component or an iframe when the selector matches the rendered element there.

await page.screenshot({
  path: 'without-widget.png',
  style: 'promo-widget, .third-party-banner { display: none !important; }'
});

For a locator-based operation inside a frame, obtain the locator from the appropriate frame:

const frame = page.frameLocator('iframe[title="Checkout"]');
await frame.locator('[data-testid="promo-code"]').screenshot({
  path: 'promo-code.png',
  style: '.helper-text { visibility: hidden !important; }'
});

If a selector works in the top document but not in a frame, inspect the frame boundary and use frameLocator or the frame’s own locator. Shadow roots likewise require a selector that matches the component’s actual rendered content.

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.

Make repeated screenshots deterministic

Hiding a widget is only one part of visual repeatability. Playwright also exposes screenshot options for animation and caret behavior. Disable animations when transitions can move the pixels you compare, and hide the caret when text fields are captured.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
await page.screenshot({
  path: 'repeatable.png',
  style: '.live-clock { display: none !important; }',
  animations: 'disabled',
  caret: 'hide'
});

Wait for the page state you actually need before taking the image. For a known component, waiting for a selector is more targeted than adding an arbitrary delay. A delay can still be useful for a widget that renders after an unpredictable timer, but it should be the fallback rather than the only synchronization mechanism.

Check your Playwright version

The Locator screenshot API reference labels screenshot-time style as added in Playwright v1.41. The maskColor option was added in v1.35. Check the package installed in the project before using those options:

npx playwright --version
Option Documented addition Purpose
style v1.41 Inject CSS for the duration of a screenshot
maskColor v1.35 Choose the color of a locator mask overlay
mask, animations, caret See the API reference for the installed release Cover locators, control motion, and control caret rendering

If an older package rejects style, upgrade Playwright in the project or use a temporary DOM/CSS change as a compatibility fallback. Keep that fallback isolated and restore the original state in a finally block so the test does not leak modifications into later cases.

Common failures and fixes

The element is still visible

  • Selector mismatch: inspect the element in the page and replace a guessed class with a stable attribute or test id.
  • Specificity conflict: add !important to the screenshot rule.
  • Wrong document: the target is inside an iframe or Shadow DOM; use the correct frame locator or a selector that reaches the component.
  • Rendered after capture: wait for the element or for the page state that creates it before calling screenshot.

The locator screenshot throws an error

  • Element detached: the component was replaced during actionability checks. Wait for a stable state, then create a fresh locator.
  • Target is hidden: a display: none target cannot produce a useful clipped image. Capture a visible ancestor or use a page screenshot with a style rule.
  • More than one match: make the locator unique with a test id, role, or a scoped parent.

The result is pink

That is the documented default mask color. Set maskColor, for example 'white' or '#000000', and make sure the installed Playwright version supports 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

The screenshot changes between runs

  • Disable animations and hide the caret.
  • Hide clocks, rotating promos, and live counters with the screenshot stylesheet.
  • Wait for fonts, images, and the component state required by the test.
  • Use the same viewport, device scale factor, locale, timezone, and color scheme for every run.

Performance, data handling, and output

A screenshot-time style is usually cheaper and safer than mutating the page, because it is applied only while pixels are being captured. Keep selectors short and avoid broad rules that force large parts of the page to recalculate. A full-page image can still be expensive when the document is tall or contains many lazy-loaded images; use a locator screenshot when you need only one component.

Playwright can return screenshot bytes instead of writing a file. That is useful for image comparison, storage, or sending the result to another service:

const bytes = await page.screenshot({
  style: '.unstable-widget { display: none !important; }'
});
// bytes is a Buffer in Node.js

Remember that masking is visual redaction, not data deletion. If the image itself is sensitive, protect the resulting file or bytes and avoid logging the underlying locator text.

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

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server for developers. It is the first alternative to try when you want a clean capture without maintaining Playwright browser setup: it accepts cookie and consent banners before capture, removes more than 60 known consent platforms plus newsletter popups and chat widgets, and bills only clean shots. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and each response reports the result with X-Page-Verdict and X-Billed headers.

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

One GET request

See the parameter reference in the ScreenshotNeo 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 response can be PNG, JPEG, WebP, or a PDF, depending on the request options. The same endpoint supports full-page capture with lazy images loaded, CSS-selector element capture, dark mode, 12 device presets or any custom viewport, retina scale, PDF paper size and margins, landscape mode and page ranges, HTML/CSS-to-image, custom JavaScript, pre-capture clicks, hidden selectors, waits for a selector, delay or network idle, request and resource blocking, custom headers, cookies, user agent and Authorization, timezone and geolocation, transparent backgrounds, resizing, and a cache TTL you choose.

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.

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}`);

For automation, ScreenshotNeo also offers signed links for public <img> tags, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API, an OpenAPI specification, and an MCP server with take_screenshot, get_page_info, and capture_pdf tools. Claude, Cursor, and other MCP clients can call those tools directly.

Plans and cost

Plan Included shots Price
Free 1,000 per month $0; no card
Starter 3,000 $5
Growth 15,000 $15
Pro 60,000 $39
Scale 250,000 $99
Business 1,000,000 $249

Every feature is available on every plan. Yearly billing provides two months free. ScreenshotNeo also accepts the parameter names used by other screenshot APIs, which can reduce changes when switching services.

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.

Start with 1,000 free screenshots a month with no card; paid plans start at $5 for 3,000 shots.

Frequently Asked Questions

Does the screenshot stylesheet persist after the capture?

No. The style option is applied for the screenshot operation, so later actions in the same page do not inherit it unless you pass it again.

Can I use a mask to prove that data was removed?

No. A mask is an overlay over a locator’s bounding box. It changes the pixels in the image but leaves the underlying DOM content present.

What should I do if I need a screenshot of an element that is intentionally hidden?

Capture a visible ancestor or take a page screenshot with a rule that hides the unwanted content. A hidden target cannot provide a meaningful clipped locator screenshot.

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.