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

Run your test runner’s normal command-line test command: npx playwright test for Playwright Test or npx cypress run for Cypress. Both run headlessly by default, so no visible browser window is required. Install the browser and system dependencies your project needs, choose the browser engine deliberately, and save failure artifacts so you can investigate problems that appear only in headless runs.

What headless mode does—and what it does not do

A headless browser runs without displaying its normal user interface. It still loads pages and executes browser automation, which makes it suitable for command-line use and CI environments without a desktop. Headless mode does not remove the need for a browser binary or its runtime dependencies.

For both Playwright and Cypress, the simplest starting point is the runner’s standard test command. You generally do not need a special headless flag unless you are overriding a project setting. Use a visible, or headed, run when you need to watch a test or reproduce a headless-only difference.

Run Playwright Test headlessly

Install project dependencies and browsers

Use the Playwright version already declared by the project, install the project’s dependencies, and install the browser engines that its tests will run. Browser versions and required operating-system libraries can vary with the Playwright version and CI image, so use the browser installation guidance matching your project rather than assuming a globally installed browser will work.

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.

For a headless-only Chromium setup, Playwright documents a separate Chromium headless shell and the command npx playwright install --with-deps --only-shell when no browser channel is specified. Check the Playwright browser installation documentation for the current version-specific conditions before using that reduced installation.

Run the suite

npx playwright test

Playwright Test defaults to headless execution. To make that choice explicit in a project configuration, specify it under use. For example, a minimal playwright.config.ts can be:

import { defineConfig } from '@playwright/test';

export default defineConfig({
  use: {
    headless: true,
    browserName: 'chromium',
  },
});

The supported browser names include chromium, firefox, and webkit. Choose the engine or engines that match your coverage needs; adding engines increases the number of environments you must install and maintain.

Keep useful failure evidence

Screenshots, traces, and video can make failures easier to diagnose without rerunning a CI job interactively. These settings are examples, not a requirement to keep every artifact for every run:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.
import { defineConfig } from '@playwright/test';

export default defineConfig({
  use: {
    headless: true,
    screenshot: 'only-on-failure',
    trace: 'on-first-retry',
    video: 'on-first-retry',
  },
});

Failure-only screenshots reduce routine artifact creation. Trace and video capture on retry can help explain flaky failures, but artifacts consume storage and may include page content or other sensitive data. Set retention and access according to your CI and data-handling requirements.

Diagnose browser launch errors

If the browser does not start in CI, first confirm that the installed browser build matches the Playwright version and that the environment has its required dependencies. For browser launch logs, Playwright’s CI guidance recommends setting DEBUG=pw:browser. Collect the resulting logs with the CI job output when diagnosing a launch failure.

Run Cypress headlessly

Run the CLI suite

Cypress’s CLI command runs supported browsers headlessly by default:

npx cypress run

To select an installed supported browser explicitly, use --browser. For example:

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.
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.
npx cypress run --browser chrome

Use an interactive, headed workflow such as npx cypress open when you want to work through tests with the browser visible. You can also ask a CLI run to show the browser with --headed.

Know the rendering defaults

Cypress documents a headless rendering default of 1280 × 720 pixels with device pixel ratio 1. These are defaults, not a guarantee that your application will render identically on every browser, operating system, or configured viewport. If a screenshot’s dimensions or pixel density matter to a test, configure and verify those values for the test environment rather than relying on an implicit default.

Preserve screenshots and video

Cypress documents screenshot and video capture for test runs. Keep the artifacts that answer your team’s debugging needs and check the runner configuration and CI job for where those files are saved and how long they are retained. If a test fails only headlessly, replay it visibly and compare the new run with the recorded screenshots or video.

Choose a browser and make CI runs reproducible

Start with the browser engine your project already targets. Chromium is a practical initial choice for many suites, but that is a coverage decision—not a claim that other engines are unnecessary. Add Firefox or WebKit when your supported audience or product requirements call for testing those engines. Playwright offers Chromium, Firefox, and WebKit; Cypress documents Chrome-family browsers and Firefox, while its WebKit support is experimental.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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

In CI, make browser selection explicit enough that a runner update does not silently change what is being tested. Chrome for Developers recommends a version-pinned Chrome for Testing binary for deterministic automation. Cypress likewise recommends Chrome for Testing for reproducible Chrome runs, rather than relying on a browser that may auto-update. Keep the test framework, browser binary, and CI environment aligned; record the versions used when a failure is difficult to reproduce.

Decision Practical approach
Framework Use the runner already integrated into the project unless there is a concrete reason to change it.
Engine coverage Begin with the engine needed for the immediate suite; add other engines when product support requirements justify the added setup.
Browser updates Pin a browser build when stable, repeatable CI behavior matters; an automatically updated browser can change between runs.
Failure diagnosis Choose screenshots, traces, or video according to what the team needs to inspect and retain.
CI display Headless runs do not need a visible desktop. On Linux, Playwright says headed runs require Xvfb; its Docker image and GitHub Action have it preinstalled.

Only add a virtual display when you need headed debugging on a Linux CI agent. A normal headless run avoids the visible-desktop requirement, but it still needs an installed browser and its runtime dependencies.

Investigate failures that happen only headlessly

  1. Save the first failure. Keep the failing test output and available screenshot, trace, or video instead of relying only on a pass/fail summary.
  2. Replay visibly. Run the same test with a headed browser and the same browser build, viewport, test data, and relevant environment settings.
  3. Compare the evidence. Look for differences in layout, timing, loaded content, interaction state, or viewport and pixel ratio. A visible replay that passes does not by itself prove the headless run was misconfigured.
  4. Check environment drift. Compare framework and browser versions, installed dependencies, configuration, and CI image with the environment where the test passes.
  5. Keep the reproduction narrow. Rerun the failing test or smallest affected group with the same settings before changing timeouts or removing assertions.

Cypress explicitly notes that a test can pass in one mode and fail in the other, and suggests replaying with a headed run such as:

npx cypress run --headed --no-exit --browser chrome

Use that replay alongside the recorded screenshots or videos. If you are using Playwright on Linux, make sure Xvfb is available for the headed diagnostic run; Playwright’s Docker image and GitHub Action include it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Common problems and fixes

  • Browser executable is missing or will not launch: Install the browser build required by the project’s framework version and the environment’s dependencies. In Playwright, enable DEBUG=pw:browser to gather launch logs.
  • CI passes locally but cannot find the selected browser: Confirm that the browser named in the command or configuration is installed in CI. Cypress requires the selected browser to be installed, unless you use a Cypress Docker image that supplies the needed environment.
  • Headed Linux debugging fails before tests start: Provide Xvfb for a Playwright headed run on a Linux agent. This display requirement is for headed debugging, not a standard headless run.
  • Screenshot comparisons differ in CI: Check the configured viewport and device pixel ratio. Cypress documents 1280 × 720 and DPR 1 as headless defaults; configure the values your test expects.
  • Tests behave differently after a browser update: Pin the browser build used in CI and align it with the framework setup. A version-pinned Chrome for Testing build is the documented reproducibility option for Chrome automation.
  • A headless-only failure disappears when opened: Preserve the headless artifacts, replay visibly with the same inputs, and compare the two runs. Cypress documents that headed and headless outcomes can differ.
  • Artifacts make CI storage grow: Capture screenshots only on failure and traces or video on retry where those settings fit your debugging policy. Review retention and access rather than recording every run by default.

Or skip the browser setup

If the task is to capture a website image or PDF—not to exercise your application’s interactive test suite—ScreenshotNeo offers a website screenshot API and MCP server for developers. A single GET request can return PNG, JPEG, WebP, or PDF. For a WebP capture:

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 setup and options. Cookie banners, newsletter popups, and chat widgets are removed before capture; bot checks, blank pages, and failed loads are never billed. AI agents can take screenshots through its MCP server. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000. Those are screenshot captures, not browser test executions: use Playwright or Cypress when you need to verify application behavior. Sign up for the free plan.

Performance, reliability, and cost considerations

Headless mode removes the need to display a browser window; it does not guarantee that a test will be faster, more reliable, or cheaper. Actual run time and CI cost depend on the suite, browser, environment, and artifact policy, and no universal timing or savings figure follows from headless mode alone.

  • Install only the browser engines the suite needs, while preserving any cross-engine coverage the product requires.
  • Pin browser versions when reproducibility matters, and update the framework and browser deliberately rather than allowing untracked changes in CI.
  • Capture failure evidence selectively and retain it long enough to investigate; traces and video can make failures easier to understand but use storage.
  • For headed Linux debugging, account for the virtual display dependency separately from the ordinary headless test path.

Frequently Asked Questions

Does headless mode mean a browser is not installed?

No. It means the browser runs without a visible window; the browser binary and runtime dependencies are still required.

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

Can I run a browser test suite without CI?

Yes. The same Playwright or Cypress CLI commands can be run locally from the project environment.

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.