DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk4 min

How to Integrate Percy with Selenium Tests

Use Percy’s language-specific SDK to add named visual snapshot checkpoints to Selenium tests, then run the suite through Percy CLI with PERCY_TOKEN set.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep Selenium for browser navigation and interaction, then add Percy’s language-specific SDK to mark the UI states you want to compare. Set PERCY_TOKEN in the test environment and run the test command through percy exec so Percy can create a build and upload snapshots.

How the integration works

Selenium continues to drive the browser. Percy adds named snapshot checkpoints to the existing tests, and the Percy CLI runs around the test command to connect the snapshots to a Percy build. The SDK and call differ by language: Python uses percy-selenium and percy_snapshot; Java uses percy-java-selenium and Percy.snapshot. Follow the official Python SDK instructions or Java SDK instructions for the language your suite already uses.

Python: add Percy snapshots to a Selenium test

Install the CLI and SDK

Add @percy/cli as a development dependency and install the percy-selenium Python package. Use the installation instructions in the official Python Selenium SDK repository and the CLI documentation for the package manager and environment you use.

Add a snapshot checkpoint

Import percy_snapshot from percy. Call it with your active Selenium driver and a descriptive, unique name only after the browser has reached the UI state you want to compare:

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.
from percy import percy_snapshot

# browser is your existing Selenium WebDriver
# Navigate and perform interactions before capturing.
percy_snapshot(browser, "Account settings - saved state")

The SDK requires the Selenium driver and a unique snapshot name. Keep names meaningful enough to distinguish pages and states in the resulting snapshot set.

Set the token and run the suite

Store the Percy project token in the environment as PERCY_TOKEN; do not commit it in test source code. Run the test command through the Percy CLI, for example:

export PERCY_TOKEN="your-project-token"
percy exec -- python -m pytest

Replace python -m pytest with the command that runs your tests. When Percy is running and the project token is set, the CLI creates a Percy build and uploads snapshots.

Java: add Percy snapshots to a Selenium test

Add the dependencies

Add @percy/cli as a development dependency and add the Maven dependency io.percy:percy-java-selenium. The repository example shows version 1.2.0; check the official Java SDK repository and package registry for the current version and compatibility before using it in a new project.

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

Construct Percy and capture the desired state

Import io.percy.selenium.Percy, pass your current Selenium WebDriver to the constructor, and call snapshot at the checkpoint you want to compare:

import io.percy.selenium.Percy;
import org.openqa.selenium.WebDriver;

WebDriver driver = /* your existing Selenium WebDriver */;
Percy percy = new Percy(driver);

// Navigate and interact until the intended state is visible.
percy.snapshot("Account settings - saved state");

Set the token and run the test command

Provide PERCY_TOKEN to the test process environment and wrap the existing test command with Percy:

export PERCY_TOKEN="your-project-token"
percy exec -- mvn test

Substitute your project’s actual test command for mvn test. The Java SDK’s method and package are not interchangeable with the Python SDK’s.

Choose snapshot checkpoints that produce useful comparisons

A snapshot records the browser state at the point the SDK call runs. Place it after navigation, user interactions, and the loading of the content that matters—not immediately after starting a page load if the page is still changing. Percy’s Selenium visual-testing guide, dated March 31, 2026, recommends a consistent viewport and waiting for key content to become visible to reduce diffs caused by timing or environment variation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Capture meaningful states, such as a form after saving or a menu after opening it.
  • Wait for the key content or interaction result before calling the snapshot method.
  • Keep viewport conditions consistent across runs so viewport changes do not masquerade as application changes.
  • Give each snapshot a descriptive unique name, as required by both official SDKs.

JavaScript and Node.js suites

Percy’s March 31, 2026 overview shows a Node.js workflow using @percy/selenium-webdriver and @percy/cli, with a snapshot after navigation and tests run under npx percy exec. Because the focused official SDK instructions cited here cover Python and Java, verify the current Node SDK documentation for installation details and API compatibility before adding a version-specific recipe.

Troubleshooting common integration issues

No Percy build or uploaded snapshots

Check that the Percy CLI is wrapping the test command and that PERCY_TOKEN is available in the same environment as that process. Keep the token in environment configuration rather than source code.

The snapshot shows an incomplete or inconsistent page

Move the snapshot call until after the necessary navigation and interactions, and wait for key content to become visible. Use the same viewport conditions across runs to reduce timing- and environment-driven differences.

The snapshot call or import does not match your language

Use the SDK that matches your suite: Python imports percy_snapshot from percy; Java constructs io.percy.selenium.Percy with the current WebDriver and calls snapshot. Follow that SDK’s repository for package details and version changes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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 screenshots from a URL rather than Percy snapshots attached to Selenium tests, ScreenshotNeo provides a website screenshot API and MCP server. A single GET request can return PNG, JPEG, WebP, or PDF; its API options include full-page and element capture, viewport and device settings, and custom waits. It is not a replacement for Percy’s visual-regression checkpoints inside your Selenium suite.

For example, this cURL request captures a page as WebP:

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 API documentation for request options. Before capture, ScreenshotNeo can accept cookie or consent banners and remove known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots.

Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.

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.

Leave a Reply

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

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. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
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.