Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Use Chrome’s unified Headless mode: add --headless=new through Selenium’s ChromeOptions, set a known viewport, isolate the browser profile, and wait for actual page conditions. Chrome’s new Headless implementation uses the same browser code as regular Chrome, but viewport, fonts, locale, permissions, GPU access, network timing, and container limits can still produce different results.
The reliable baseline
This Python example starts Chrome in the current Headless implementation, fixes the viewport, and gives the test its own profile. A unique profile prevents extensions, cookies, service workers, and preferences from another run from changing the result.
from pathlib import Path
import tempfile
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
profile_dir = tempfile.mkdtemp(prefix="selenium-chrome-")
options = Options()
options.add_argument("--headless=new")
options.add_argument("--window-size=1920,1080")
options.add_argument(f"--user-data-dir={profile_dir}")
# Selenium Manager normally finds a compatible driver automatically.
driver = webdriver.Chrome(options=options)
try:
driver.get("https://example.com")
heading = WebDriverWait(driver, 20).until(
EC.visibility_of_element_located((By.TAG_NAME, "h1"))
)
print(heading.text)
driver.save_screenshot("example.png")
finally:
driver.quit()
Install Selenium with python -m pip install -U selenium. The exact profile directory, proxy, locale, permissions, and viewport should match the environment you are trying to reproduce. Do not copy a collection of unrelated Chrome flags: each one can alter security, rendering, sandboxing, or resource behavior.
What changed in Chrome and Selenium
| Milestone | What it means |
|---|---|
| Chrome 96–108 | The newer implementation was selected with --headless=chrome. |
| Chrome 109 and later | --headless=new is the documented unified Headless mode. |
| Selenium 4.10.0 | Convenience setters such as setHeadless(true) were removed; pass a browser argument instead. |
| Chrome 132 and later | The old Headless implementation is distributed separately as the chrome-headless-shell binary. It is not the normal Chrome binary used by the unified mode. |
Chrome describes new Headless as the real Chrome browser. That removes the old architectural split, but it does not make every machine identical. A ChromeDriver major version must match the Chrome major version. Selenium Manager is built into current Selenium releases and normally handles driver discovery, but a manually installed driver still needs that major-version match.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#1 Best Overall
Make the execution environment deterministic
Fix the viewport and scale
Responsive breakpoints, canvas dimensions, lazy-loading thresholds, and screenshot geometry depend on the viewport. Set --window-size=1920,1080 (or the dimensions your test specifies) and keep them constant between headful and headless runs. If a test depends on physical pixels or high-density rendering, configure the device scale factor deliberately rather than assuming the host monitor’s value.
Use an isolated profile
A fresh --user-data-dir removes stale cookies, cached scripts, consent choices, service workers, and browser preferences from the comparison. Never let concurrent WebDriver instances write to the same Chrome profile. For repeatability, create a temporary directory per test or per worker and delete it after the run.
Control fonts, locale, and time
Missing fonts cause different line breaks and element sizes even when the HTML and CSS are identical. Install the fonts required by the application in the test image. Keep language, timezone, and geolocation consistent when text, date formatting, or regional content matters. A proxy can change both the response and the apparent location, so treat proxy configuration as part of the test fixture.
Account for containers and Linux hosts
Containers may have restricted sandboxes, small shared-memory mounts, limited CPU, or no usable GPU. These constraints can cause crashes, blank pages, and timing changes. Fix the container’s permissions and resource limits first. Flags that disable security controls may make a broken container start, but they also change the behavior being tested; use them only when the container design requires them and document the trade-off.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsSet permissions and identity intentionally
Notifications, camera and microphone access, downloads, authentication headers, and cookies can all change a flow. Configure the required permissions, headers, and credentials explicitly. Do not assume a headless session should inherit whatever a developer’s interactive profile happens to contain.
Rank #2
Wait for conditions, not elapsed time
Headless runs often expose race conditions that a slower interactive run hides. Replace arbitrary sleeps with an explicit wait for the condition required by the next action.
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
wait = WebDriverWait(driver, 30)
button = wait.until(
EC.element_to_be_clickable((By.CSS_SELECTOR, "button[data-ready='true']"))
)
button.click()
wait.until(EC.invisibility_of_element_located((By.CSS_SELECTOR, ".spinner")))
Choose a condition that reflects the application: an element becoming visible or clickable, a loading indicator disappearing, a URL changing, a specific title appearing, or a JavaScript state becoming true. Selenium advises against combining implicit and explicit waits because their timeouts can compound unpredictably. Set one strategy for the suite, and do not share a WebDriver instance between tests.
Diagnose the first failed condition
Capture evidence at the failure point
Save a screenshot, page source, current URL, and browser console output when a wait expires. The first unmet condition is usually more informative than the final timeout. A screenshot can show a consent dialog, a responsive layout change, or a blank document that is otherwise invisible in a stack trace.
Recommended Free Tools
from pathlib import Path
try:
wait.until(EC.visibility_of_element_located((By.ID, "results")))
except Exception:
Path("failure.html").write_text(driver.page_source, encoding="utf-8")
driver.save_screenshot("failure.png")
print("URL:", driver.current_url)
raise
Use WebDriver BiDi for cross-browser events
WebDriver BiDi provides a bidirectional WebSocket connection for console messages, JavaScript errors, and network events across browsers. It is the preferred direction when diagnostics should remain portable beyond Chrome. Enable the Selenium BiDi features supported by your Selenium version and collect events around the failing navigation rather than logging the entire run indefinitely.
Use CDP for Chrome-specific controls
Chrome DevTools Protocol remains useful when the test needs Chrome-only capabilities such as detailed emulation controls. Its stable endpoint exposes a subset of the full protocol, so pin the Chrome version used by the suite and verify that the command you need exists there. Do not add CDP emulation merely to make a test pass: overriding the user agent, accepted language, platform, user-agent metadata, or screen configuration changes what the site serves.
Rank #3
Why “full browser” still does not mean “human session”
--headless=new makes the browser implementation much closer to headful Chrome; it is not a universal stealth switch. Sites can still observe automation-related browser and network characteristics, timing, permissions, and environment details. Compatibility and test fidelity are valid goals, but no official Selenium or Chrome guidance establishes a universal recipe that makes automation indistinguishable from a person using an interactive session.
Common headless-only failures
| Symptom | Likely cause | Fix |
|---|---|---|
setHeadless or a similar method is missing |
The convenience setter was removed in Selenium 4.10.0. | Create Options and add --headless=new. |
| Chrome fails to start or exits immediately | ChromeDriver and Chrome major versions differ, or the container lacks required permissions/resources. | Align the major versions; inspect sandbox, shared-memory, CPU, and memory limits before changing flags. |
| A selector times out only in Headless | The viewport selects a different responsive layout, a consent overlay covers the page, or the test races the application. | Fix the viewport, capture a failure screenshot, then wait for the actual element or overlay state. |
| Text wraps differently | Fonts, device scale, viewport, or locale differ. | Install matching fonts and set those variables explicitly. |
| A page is blank or incomplete | Navigation failed, a script crashed, a bot check appeared, or the environment ran out of resources. | Record URL, page source, console and network events; distinguish a site response from a local Chrome failure. |
| Tests pass alone but fail in parallel | Drivers or profiles are being shared, or the host is CPU/memory constrained. | Use one driver and profile per test worker and size the host for the concurrency level. |
| Headful and Headless differ after login | Cookies, storage, permissions, or a service worker came from different profiles. | Start both runs from controlled profiles and perform authentication through the same documented setup. |
Performance and reliability trade-offs
- Startup: creating a fresh profile improves isolation but adds initialization work. Reuse a profile only when state is intentionally part of the test and never across concurrent drivers.
- CPU and memory: unified Headless runs the full Chrome code path. Budget resources for the pages, tabs, and parallel workers you actually launch rather than assuming Headless is cost-free.
- Network: a fixed viewport does not fix response time. Use explicit, bounded waits and collect network events so slow servers, blocked resources, and application errors are distinguishable.
- Reproducibility: pin Chrome, ChromeDriver, Selenium, fonts, locale, timezone, proxy, and container image when pixel-level or timing-sensitive results matter.
Or skip the browser setup
If your goal is a clean website image or PDF rather than exercising Selenium interactions, ScreenshotNeo provides a single HTTP request. Its API accepts the page URL and returns PNG, JPEG, WebP, or PDF; documentation is at https://screenshotneo.com/docs/.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
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)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
Before capture, ScreenshotNeo accepts the cookie or consent banner like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and whether the request was billed. Its MCP server lets Claude, Cursor, and other MCP clients use take_screenshot, get_page_info, and capture_pdf. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots.
Create a free ScreenshotNeo account to use the 1,000 monthly screenshots without adding a card.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.FAQ
Does unified Headless support the same Chrome extensions as headful mode?
It uses the full Chrome browser implementation, but extension behavior still depends on the Chrome version, extension type, and how the test launches Chrome. Validate the specific extension in the pinned environment instead of assuming parity.
Should visual tests compare screenshots from different operating systems?
Only with a tolerance and a deliberate normalization strategy. Operating-system font rasterization, installed fonts, graphics libraries, and device scale can produce legitimate pixel differences even when the browser settings match.
Rank #4
When is the old chrome-headless-shell useful?
It is a separate binary for workloads that specifically need the former Headless implementation. It is not a substitute for --headless=new when the objective is to exercise the same Chrome implementation used by headful Chrome.
Frequently Asked Questions
Does unified Headless support the same Chrome extensions as headful mode?
It uses the full Chrome browser implementation, but extension behavior still depends on the Chrome version, extension type, and how the test launches Chrome. Validate the specific extension in the pinned environment instead of assuming parity.
Should visual tests compare screenshots from different operating systems?
Only with a tolerance and a deliberate normalization strategy. Operating-system font rasterization, installed fonts, graphics libraries, and device scale can produce legitimate pixel differences even when the browser settings match.
When is the old chrome-headless-shell useful?
It is a separate binary for workloads that specifically need the former Headless implementation. It is not a substitute for –headless=new when the objective is to exercise the same Chrome implementation used by headful Chrome.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchQuick Recap
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.

