Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
Cypress

Selenium vs. Cypress for Screenshots in 2026: Capture, Failure Artifacts, and Visual Regression

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

Short answer: Choose Cypress when screenshot capture is primarily part of JavaScript/TypeScript end-to-end tests. Its cy.screenshot() command captures the application, an element, or the test runner, and cypress run saves a failure screenshot automatically by default. Choose Selenium when you need WebDriver’s portable, language-neutral screenshot primitive, custom hooks, or an existing Grid and driver ecosystem. Neither core API compares images; add a visual-regression plugin or service for baseline approval and pixel diffs.

This guide shows the exact Selenium and Cypress workflows, explains what each captures, and gives a practical decision framework for 2026 projects.

What each tool actually captures

Concern Selenium Cypress
Capture API WebDriver screenshot endpoint, exposed in language bindings such as getScreenshotAs. cy.screenshot() for the application or cy.get(selector).screenshot() for an element.
Default artifact location Whatever path your test code chooses. cypress/screenshots.
Failure screenshots You add a test-listener, hook, or framework integration. cypress run captures failures automatically unless disabled.
Capture modes Driver-level screenshot; cropping, naming, and synchronization are yours to compose. viewport, fullPage, or runner, with options for blackout, overwrite, and animation handling.
Image comparison Not provided by the core screenshot call. Not provided by the core screenshot call; use a plugin or external visual-testing integration.
Browser and language reach WebDriver drivers, Grid, desktop and mobile infrastructure, and bindings across major languages. Real-browser execution documented for Chrome-family browsers and Firefox; WebKit support is experimental.

The important distinction is abstraction level. Selenium returns an image from the browser-driver endpoint (encoded as Base64 before the binding writes it). Cypress treats screenshots as a test command with application-aware defaults and CI failure handling.

Taking screenshots with Selenium

Minimal Java example

The following example navigates to a page, waits for a visible heading, and writes a PNG. Selenium’s TakesScreenshot interface asks the driver for the screenshot; getScreenshotAs handles the supported output representation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.Duration;

import org.openqa.selenium.By;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

public class ScreenshotTest {
  public static void main(String[] args) throws Exception {
    WebDriver driver = new ChromeDriver();
    try {
      driver.manage().window().setSize(new org.openqa.selenium.Dimension(1440, 900));
      driver.get("https://example.com");
      new WebDriverWait(driver, Duration.ofSeconds(15))
          .until(ExpectedConditions.visibilityOfElementLocated(By.tagName("h1")));

      Path output = Path.of("artifacts", "example.png");
      Files.createDirectories(output.getParent());
      Files.write(output, ((TakesScreenshot) driver).getScreenshotAs(OutputType.BYTES));
    } finally {
      driver.quit();
    }
  }
}

What Selenium leaves to your code

  • When to capture: wait for a specific element, URL state, or network condition instead of taking a shot immediately after navigation.
  • File naming: include browser, viewport, test name, and a timestamp or run identifier to prevent parallel workers overwriting one another.
  • Full-page behavior: a normal driver screenshot is generally the current viewport. Full-page stitching or browser-specific full-page support must be implemented in your chosen driver and pipeline.
  • Failure hooks: register a listener in JUnit, TestNG, pytest, NUnit, or your runner and call the same capture method when a test fails.
  • Comparison: pass the saved image to a visual-testing tool that stores approved baselines and produces diffs.

Reliable Selenium capture sequence

  1. Set a deterministic window size or device emulation profile.
  2. Navigate and wait for the state that defines “ready” for the assertion.
  3. Disable or mask dynamic content such as clocks, rotating ads, and user-specific data.
  4. Capture to a run-specific path, preserving the original image for diagnostics.
  5. Compare only in a controlled rendering environment, then publish the artifact and diff when the test fails.

Taking screenshots with Cypress

Application and element screenshots

Cypress supports screenshots in both interactive and headless runs. A manual capture of the page is:

describe('checkout', () => {
  it('captures the confirmed order', () => {
    cy.visit('/checkout');
    cy.get('[data-testid="order-confirmed"]').should('be.visible');
    cy.screenshot('checkout-confirmed', {
      capture: 'fullPage',
      disableTimersAndAnimations: true,
      blackout: ['.live-chat', '[data-testid="current-time"]'],
      overwrite: false
    });
  });

  it('captures one component', () => {
    cy.visit('/dashboard');
    cy.get('.post').first().screenshot('first-post', { capture: 'viewport' });
  });
});

Files go to cypress/screenshots by default. Before cypress run, Cypress clears that directory unless trashAssetsBeforeRuns is changed, so copy artifacts to CI storage if you need them after the job.

Capture options that matter

  • capture: 'viewport' records the visible browser area; 'fullPage' captures the full application page; 'runner' includes the Cypress runner interface.
  • Failure screenshots are coerced to runner, making the command log and test context visible.
  • screenshotOnRunFailure defaults to true. Set it to false when failure images are prohibited or too large for your artifact policy.
  • disableTimersAndAnimations defaults to true, reducing motion-related differences.
  • blackout accepts selectors whose pixels should be masked; use it for secrets and intentionally variable regions.
  • overwrite defaults to false, so repeated names remain separate rather than silently replacing an earlier image.

Configuring failure behavior

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

module.exports = defineConfig({
  e2e: {
    screenshotOnRunFailure: true,
    video: false
  },
  screenshotsFolder: 'cypress/screenshots',
  trashAssetsBeforeRuns: true
});

Use cypress open when interactively selecting a test and cypress run in CI. The automatic failure capture applies to the headless run; explicit cy.screenshot() calls work in either mode.

Does Cypress compare screenshots?

No. Cypress states that it does not perform image comparison itself. A screenshot command produces an artifact; visual regression adds a second stage that compares that artifact with an approved baseline, reports changed pixels, and lets a reviewer accept or reject the change. Selenium’s screenshot primitive has the same boundary.

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.

Building a dependable visual-regression pipeline

  1. Capture deterministically: pin viewport dimensions, browser version, operating system image, fonts, timezone, locale, and device scale factor.
  2. Stabilize the page: wait for fonts and images, freeze animations, mask timestamps and personalized content, and seed test data.
  3. Store baselines deliberately: review baseline changes as code changes, with ownership and a reason for each approval.
  4. Compare with a dedicated integration: choose a plugin or service that supports your runner, diff thresholds, review workflow, and retention needs.
  5. Investigate failures: inspect the baseline, current image, and diff together; a one-pixel font shift can indicate an environment change rather than a product defect.

Which is better for common screenshot jobs?

Choose Cypress when

  • Your end-to-end suite is JavaScript or TypeScript and already runs in Cypress.
  • You want element screenshots without writing file-handling helpers.
  • Automatic CI screenshots on test failure are valuable.
  • Built-in defaults for full-page capture, animation disabling, blackout selectors, and overwrite behavior reduce custom code.

Choose Selenium when

  • Your team needs Java, Python, C#, Ruby, JavaScript, or another WebDriver binding.
  • You already operate Selenium Grid, cloud drivers, or a mobile-browser pipeline.
  • You need low-level control over drivers, sessions, hooks, naming, and artifact storage.
  • The same capture primitive must be shared by multiple test frameworks or repositories.

Use both when the systems differ

Some organizations keep Selenium for broad cross-language or device coverage and Cypress for fast application-focused tests. Standardize the output contract—PNG or another supported format, fixed viewport, metadata, and artifact naming—so a visual review process does not care which runner produced the image.

Browser support and infrastructure trade-offs

Cypress launches and controls a real browser in an isolated state. Its documented browser choices include Chrome-family browsers (including Edge and Chrome for Testing) and Firefox; WebKit is experimental. Selenium’s WebDriver model delegates browser control to browser-specific drivers and infrastructure, which is why it remains useful across desktop and mobile environments and remote grids. Confirm the browser and driver versions in your CI image rather than assuming local and CI pixels will match.

Performance, reliability, and cost decisions

  • Capture less often: take screenshots at assertion points and on failures rather than after every command.
  • Prefer element shots: they are smaller and less sensitive to unrelated page changes when the component is the real test target.
  • Keep full-page shots intentional: long pages require more rendering and storage and can expose lazy-loading timing problems.
  • Parallelize safely: isolate output directories per worker and merge artifacts after the run.
  • Control visual noise: consistent fonts, data, timezone, and animations improve reliability more than changing the screenshot API.
  • Budget comparison separately: screenshot capture is only one cost; baseline storage, diff computation, review seats, and CI minutes belong in the visual-testing budget.

Common failures and fixes

Blank or partially rendered image

Cause: capture occurred before the application finished rendering or lazy images loaded. Fix: wait on a meaningful selector, network-idle condition, or image-ready assertion; avoid arbitrary sleeps unless no state signal exists.

Images differ on every run

Cause: animations, clocks, randomized data, fonts, browser versions, or display scaling. Fix: freeze data, disable animations, blackout dynamic selectors, and run comparisons in a pinned container and viewport.

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

Cypress failure image is missing

Cause: the test ran in interactive mode, screenshotOnRunFailure was disabled, or CI discarded cypress/screenshots. Fix: run the failing spec with cypress run, enable the setting, and upload the folder as a CI artifact.

Expected Cypress file disappeared

Cause: Cypress clears the screenshots folder before a run by default. Fix: change trashAssetsBeforeRuns or copy images to durable storage before the job ends.

Selenium overwrote another worker’s screenshot

Cause: shared filenames or output directories. Fix: include the worker index, test ID, browser, and run ID in the path and create directories before writing.

A visual diff flags harmless pixels

Cause: the rendering environment changed or the baseline includes dynamic content. Fix: align OS, browser, fonts, scale, locale, and timezone; mask intentional variability before changing the diff threshold.

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

ScreenshotNeo is a website screenshot API and MCP server for developers. One GET request returns PNG, JPEG, WebP, or PDF, while its capture flow accepts consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before the shot. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status.

For a direct capture, see 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 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 also offers an MCP server with take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. Its 63 options include full-page and element capture, dark mode, device presets, retina scale, PDF controls, custom CSS and JavaScript, clicks, waits, request blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, chosen-TTL caching, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage data, and an OpenAPI specification. Parameter names used by other screenshot APIs also work.

Plan Allowance Price
Free 1,000 shots/month No card required
Starter 3,000 shots $5
Growth 15,000 shots $15
Pro 60,000 shots $39
Scale 250,000 shots $99
Business 1,000,000 shots $249

Yearly billing gives two months free, and every feature is on every plan. Start with 1,000 free screenshots a month with no card; paid plans start at $5 for 3,000.

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

Frequently Asked Questions

Can Selenium capture an element instead of the whole viewport?

The basic WebDriver screenshot is driver-level. Use an element-screenshot capability supplied by your language binding or crop the captured image to the element’s coordinates in your own pipeline.

Will Cypress screenshots work in CI without a display?

Yes. Cypress supports screenshots in headless cypress run; configure the browser and upload cypress/screenshots as a CI artifact.

Should visual baselines be shared between Selenium and Cypress?

Only when both runs use the same browser engine, version, operating system, fonts, viewport, scale, locale, timezone, and test data. Otherwise maintain environment-specific baselines.

What format does ScreenshotNeo return?

The API can return PNG, JPEG, WebP, or a PDF, depending on the request options.

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.

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.

Read next

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

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.