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

Use Cypress’s selector-based blackout option with a viewport capture. Mark private regions with stable selectors, pass those selectors to cy.screenshot() (or configure a global default), and separately control automatic failure screenshots and artifact retention. Blackout is not a universal redaction system: Cypress documents it for viewport captures and says it is ignored for runner captures, so validate the behavior of the Cypress release in your project.

What Cypress can hide—and what it cannot

Cypress calls the feature “Blackout elements in screenshots.” It replaces matching page elements in the captured image based on CSS selectors. This is useful for account names, email addresses, invoices, access tokens rendered in a page, or test-only secret fixtures.

The selector must match an element that exists when the screenshot is taken. Cypress does not claim to discover every secret automatically. Text painted onto a canvas, content inside an unmatched shadow tree, or a value displayed by a different element will not be protected merely because it is sensitive.

  • Supported approach: provide an array of CSS selectors in the blackout option.
  • Capture scope: documentation limits blackout to viewport captures and says it is ignored for runner captures. Test the exact behavior of your installed version, especially if you use another capture mode.
  • Operational scope: masking a new screenshot does not redact files already saved, uploaded to CI, or shared through Cypress Cloud.

Mark sensitive regions with durable selectors

Prefer selectors that are part of your application’s intentional test contract rather than styling classes likely to change. A data attribute makes the intent obvious:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
<span data-hide="true">alex@example.com</span>
<div class="secret-info">Account number: 0042</div>

Keep the attribute on the smallest region that contains the secret. Masking an entire page panel is safer than missing a nested value, but it can make debugging harder. If a component renders asynchronously, wait until it is present before capturing.

Black out elements in one screenshot

Use an application (viewport) capture and pass selectors as an array:

it('hides private account data', () => {
  cy.visit('/account');

  cy.get('[data-hide="true"]').should('be.visible');
  cy.screenshot('account-redacted', {
    capture: 'viewport',
    blackout: ['.secret-info', '[data-hide="true"]'],
  });
});

capture: 'viewport' is deliberate. Cypress documents other values, including fullPage and runner, but its blackout guidance is specifically limited to viewport captures. A full-page shot may be useful for long documents, yet you should verify masking in your installed Cypress release before treating it as safe for secrets. Never assume a runner screenshot is protected: the API documentation says blackout is ignored there, and runner images include the Cypress interface and Command Log.

Check that selectors actually match

Before taking the screenshot, assert that each sensitive region exists. A typo that matches zero elements can produce an apparently successful but unsafe artifact:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
cy.get('.secret-info').should('exist');
cy.get('[data-hide="true"]').should('exist');
cy.screenshot({
  capture: 'viewport',
  blackout: ['.secret-info', '[data-hide="true"]'],
});

For lists, assert the expected count or use a stable parent selector. Review the generated image in a safe local environment; do not paste an unredacted artifact into a ticket while investigating.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Set a project-wide default

If most screenshots should be application viewport captures, configure the defaults in a Cypress support file. Cypress recommends the support file because it is loaded before test files are evaluated:

// cypress/support/e2e.js
Cypress.Screenshot.defaults({
  capture: 'viewport',
  blackout: [
    '.secret-info',
    '[data-hide="true"]',
    '[data-sensitive="email"]',
  ],
});

Tests can still override the options for an individual call. Treat the default list as security-sensitive configuration: review it when a new component displays personal or confidential data, and keep selectors valid through refactors.

Temporarily change the DOM for a manual capture

Some values are difficult to select or should not be present even briefly in the image. For a manually requested screenshot, Cypress supports synchronous onBeforeScreenshot and onAfterScreenshot callbacks. Hide the element before capture and restore it afterward:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
cy.screenshot('dashboard-without-clock', {
  capture: 'viewport',
  onBeforeScreenshot($el) {
    $el.find('[data-live-clock]').css('visibility', 'hidden');
  },
  onAfterScreenshot($el) {
    $el.find('[data-live-clock]').css('visibility', 'visible');
  },
});

This is preparation for that manual capture, not a blanket guarantee for automatic failure screenshots. Make the callbacks synchronous and restore the original state so later assertions are not affected. Selector blackout can be combined with this technique when a page needs both permanent masking and temporary layout changes.

Choose the screenshot type deliberately

Capture What it contains Privacy consideration
viewport The application in the current browser viewport The documented scope for blackout; preferred when masking sensitive page elements.
fullPage The application from top to bottom Useful for long pages, but verify blackout behavior for your Cypress version before relying on it.
runner The Cypress browser interface and Command Log Blackout is documented as ignored; avoid it when the runner or log could expose data.

Cypress Cloud guidance describes application capture as viewport or fullPage to keep Command Log information out of screenshots. That is a different concern from whether selector blackout is applied, so configure both intentionally.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Control automatic screenshots on test failure

During cypress run, Cypress automatically takes a screenshot when a test fails by default. If a failure state can contain secrets that you cannot safely mask, disable that artifact:

// cypress.config.js
const { defineConfig } = require('cypress');

module.exports = defineConfig({
  screenshotOnRunFailure: false,
});

You can also set this through Cypress configuration as appropriate for your project. Disabling failure screenshots removes a valuable debugging artifact, so use it when the privacy risk outweighs that diagnostic benefit. If you leave it enabled, ensure the page’s sensitive selectors and capture mode are compatible with the behavior of your Cypress release; do not assume a manually configured screenshot option automatically governs every failure path.

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

Local files, Cypress Cloud, and CI retention are separate controls

Screenshots are written to the configured screenshotsFolder, which defaults to cypress/screenshots. Cypress documents cleanup of that folder before cypress run when the default asset-cleanup behavior is active. Cleanup is not redaction and is not secure deletion of copies that were already uploaded or archived.

Review the complete artifact path

  • Inspect the local screenshots folder and any alternate path configured in your project.
  • Check CI upload steps, retention periods, pull-request previews, and build logs.
  • Limit who can access Cypress Cloud runs and their screenshots.
  • Decide whether failure artifacts should be disabled for tests that process production-like data.

Cypress Cloud documents blackout as masking selected elements in screenshots saved locally or visible to users who can access the Cloud run. Cloud’s controls for captured network data are separate: automatic redaction of certain credential and token fields in Test Replay network logs does not change screenshot pixels. Configure both artifact types if your threat model includes network logs.

Verification checklist before sharing a screenshot

  1. List every sensitive field that can appear in the tested state, including values revealed after loading or interaction.
  2. Add stable selectors such as data-hide="true" to those regions.
  3. Assert that the selectors exist before the capture.
  4. Use capture: 'viewport' when relying on the documented blackout behavior.
  5. Open the resulting image and inspect areas outside the intended mask, including headers, toast messages, and error states.
  6. Test a failure path separately if automatic failure screenshots remain enabled.
  7. Audit local, CI, and Cloud retention and access after the test run.

Troubleshooting common failures

The secret is visible despite a blackout selector

Check that the selector matches the rendered element at capture time, not only the component source. Wait for the element, confirm the exact attribute spelling and quoting, and inspect whether the value is rendered in a different node, iframe, canvas, or shadow root. Then confirm the screenshot is not a runner capture. If you use fullPage, verify behavior with your installed Cypress version rather than assuming viewport rules apply.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

The screenshot contains the Command Log

You captured runner. Use an application capture (viewport or, after validating masking, fullPage) when the Cypress interface must not appear.

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.

Manual masking changes the test page

Ensure onBeforeScreenshot and onAfterScreenshot use synchronous DOM changes and restore the original styles. Limit the temporary change to the capture and avoid assertions that depend on the hidden state.

A failure screenshot still contains private data

Automatic failure capture is a separate path. Either make the failure state safe and verify its capture mode, or set screenshotOnRunFailure: false and rely on other diagnostics that your retention policy permits.

Old unredacted images remain in storage

New blackout settings cannot alter existing files. Remove or restrict old local, CI, and Cloud artifacts according to your organization’s retention policy, then run the test again to create clean artifacts.

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 you need a clean image outside Cypress, ScreenshotNeo provides a website screenshot API and MCP server. Its consent step accepts cookie banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. An MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients.

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

For API parameters, options, and authentication, see the ScreenshotNeo documentation. A direct cURL request is:

Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
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 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}`);

ScreenshotNeo supports PNG, JPEG, WebP, and PDF output, plus full-page and element captures, custom CSS and JavaScript, hidden selectors, waits, request blocking, headers, cookies, user agents, geolocation, resizing, caching, signed links, asynchronous webhooks, bulk capture, and usage reporting. Plans include 1,000 screenshots per month free with no card; paid plans start at $5 for 3,000. Create a free ScreenshotNeo account to try it.

FAQ

Does blackout encrypt or delete the original page data?

No. It changes the screenshot output; it does not remove secrets from the application, browser memory, network logs, or previously stored artifacts.

Can I use the same selector list for Cypress and ScreenshotNeo?

The concepts are similar, but ScreenshotNeo’s selector and capture options are configured through its API. Follow the current parameter names in its documentation rather than copying Cypress configuration directly.

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.

Should I mask test fixtures containing fake secrets?

Yes. Fake values can later be replaced with realistic data, and masking them keeps screenshots safe when test environments evolve.

Frequently Asked Questions

Can Cypress blackout protect screenshots taken by plugins or external reporters?

Not necessarily. The documented option applies to Cypress screenshot capture; verify how any plugin or reporter obtains its image and apply its own redaction controls.

Is disabling failure screenshots enough for privacy compliance?

It prevents that Cypress failure artifact, but other screenshots, videos, network logs, CI files, and Cloud data may still exist. Review the entire capture and retention pipeline.

The Bottom Line

Use stable selectors and blackout with a validated viewport capture, then audit automatic failures and every place artifacts are retained. Cypress masking protects the image you configure—not every representation of the underlying data.

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.