Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk3 min

How to Add Custom CSS Before Percy Takes a Screenshot

Add CSS to one Percy snapshot with percyCSS, set a project-wide override in .percy.yml, or prepare the page in your test before capture.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To add custom CSS to one Percy screenshot, pass a percyCSS string in the snapshot options. To apply the same CSS to snapshots across a project, configure snapshot.percy-css in .percy.yml. If the page itself must be changed before capture, make the CSS or DOM change in your test before calling Percy.

Add CSS to one Percy screenshot

Use the percyCSS snapshot option for a narrowly scoped override. For example, this hides iframes in one snapshot:

As an Amazon Associate I earn from qualifying purchases.

await percySnapshot('Home page', {
  percyCSS: 'iframe { display: none; }'
});

Replace the CSS selector and declaration with the rule you need. Because this is attached to that snapshot call, it is appropriate for a one-off adjustment rather than a project-wide style change. See Percy’s Percy Specific CSS changelog entry for the documented example.

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

Apply CSS to snapshots project-wide

To use the same Percy-specific CSS across snapshots, add percy-css beneath snapshot in the project’s .percy.yml file:

version: 1
snapshot:
  percy-css: |
    iframe {
      display: none;
    }

The YAML block scalar (|) preserves the CSS as a multiline value. This global configuration is useful when the same override belongs in every snapshot; use the per-snapshot option when it should affect only one capture.

Change the page before calling Percy

Percy-specific CSS is for styling the snapshot. When the test needs to prepare the application page itself—for example, by changing application state or manipulating the DOM—make that change in the test before invoking the snapshot function. The sequence is:

Rank #2
  1. Load the page and establish the state your visual test is intended to inspect.
  2. Apply the required page-specific CSS or DOM change in the test.
  3. Call the Percy snapshot function after the change.

Keep this distinct from a Percy-only override: test-side preparation changes the page under test, while percyCSS supplies CSS for the Percy capture.

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.

Choose what to hide carefully

Dynamic elements can create noisy visual differences when they are not part of the layout or behavior being tested. Percy’s guidance discusses elements such as live chat, notification badges, counters, rotating banners, and ads as potential sources of instability. Hiding them can make comparisons more repeatable, but exclude them only when they are outside the purpose of the visual assertion.

If animation or transitions make captures vary, CSS can disable them for the visual test. For data-driven content, controlling the test data may be preferable to hiding the content, because stable data can preserve the layout the test is meant to verify. Percy covers these approaches in How to Reduce False Positives in Visual Testing, published February 23, 2026.

Check SDK compatibility before relying on a version number

Percy’s September 17, 2019 announcement said Percy-specific CSS required @percy/agent v0.13.0 or newer at that time. That is a historical requirement, not confirmation of current compatibility. Check the documentation for the Percy SDK installed in your project before depending on a particular version or option.

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 screenshot through an API rather than a Percy visual-test snapshot, ScreenshotNeo accepts a URL in one GET request. For example, using 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

See the ScreenshotNeo documentation for API options. Cookie banners are accepted and removed before capture, along with known newsletter popups and chat widgets; those steps can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers report the page verdict and billing status. An MCP server provides screenshot tools for AI agents, and the free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000.

Sign up free for ScreenshotNeo: 1,000 screenshots a month, no card required.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.