Browser Test Automation: WebDriver, Headless Mode, Capabilities, and Version Pinning
How Chrome for Testing, ChromeDriver, Puppeteer, and Headless mode work together for reproducible WebDriver tests in CI and local setups.
This page summarizes Chrome automation and testing documentation: the stack built for reliable, unattended browser tests—version-pinned binaries, a WebDriver server, high-level Node automation, and Headless execution—plus capabilities, Android basics, debugging, and common failures.
Automation stack: which tool when?
Section titled “Automation stack: which tool when?”Chrome’s testing ecosystem is meant to answer one practical question: how do you get deterministic, reproducible browser runs in local development and continuous integration (CI)?
Automated browser testing is essential for building robust, high-quality web applications. Whether you are running continuous integration (CI) end-to-end suites, performing regression testing across browser releases, or automating browser interactions, Chrome provides a dedicated suite of tools and execution modes designed for developers and test automation engineers.
— Chrome, Automation and testing with Chrome
| Piece | Role | Typical use |
|---|---|---|
| Chrome for Testing | Version-pinned Chrome binary (no auto-update) | Lock browser version in CI and when reproducing old commits |
| Chrome Headless mode | Run Chrome without visible UI (--headless) |
Servers, containers, CI without a display |
| ChromeDriver | W3C WebDriver + WebDriver BiDi server | Selenium, WebDriverIO, Nightwatch, and other WebDriver frameworks |
| Puppeteer | Node library over DevTools Protocol | Scripts, screenshots, PDFs; downloads a matching Chrome for Testing binary by default |
Common conclusion: Pin a Chrome for Testing binary, run it Headless in CI when you do not need a visible window, and drive it with Puppeteer (Node-centric) or ChromeDriver (multi-language WebDriver). Puppeteer wires binary + Headless automatically; WebDriver stacks pair Chrome for Testing with a matching ChromeDriver from the same release infrastructure.
Typical CI workflow
Section titled “Typical CI workflow”In a typical automated testing or continuous integration (CI) workflow, these products work together to provide a reproducible, unattended testing environment:
Browser binary (Chrome for Testing): Use a specific, version-pinned Chrome for Testing binary so your test results are deterministic across runs. Execution mode (Chrome Headless mode): Run that binary in Headless mode (
--headless) so tests execute cleanly in servers, containers, or CI pipelines without a graphical display. Automation driver (Puppeteer or ChromeDriver): Drive the browser using an automation library like Puppeteer or any other testing framework connected through WebDriver BiDi.
— Chrome, Automation and testing with Chrome
Chrome for Testing: why not the browser users install?
Section titled “Chrome for Testing: why not the browser users install?”Regular Chrome auto-updates—good for users, awkward for test suites that need the same browser build on every run and the ability to check out an old branch and re-run tests against that era’s binary.
You want consistent, reproducible results across repeated test runs—but this may not happen if the browser executable or binary decides to update itself in between two runs. You want to pin a specific browser version and check that version number into your source code repository, so that you can check out old commits and branches and re-run the tests against the browser binary from that point in time.
— Chrome, Chrome for Testing
Chrome for Testing is a dedicated flavor integrated into the Chrome release process: versioned downloads across Stable, Beta, Dev, and Canary, each paired with matching ChromeDriver (and optional chrome-headless-shell for legacy headless). It is only for automation and testing—not for everyday browsing.
Note: Chrome for Testing has been created purely for browser automation and testing purposes. It should only be used to consume trustworthy content.
— Chrome, Chrome for Testing
How to download pinned binaries
Section titled “How to download pinned binaries”Use the Chrome for Testing availability dashboard or automate downloads:
npx @puppeteer/browsers install chrome@stablenpx @puppeteer/browsers install chrome@116.0.5793.0npx @puppeteer/browsers install chromedriver@canaryJSON API endpoints on the dashboard support custom download scripts. For Chrome 115+, version selection is largely “pick a CfT channel/version and take the bundled ChromeDriver”; for older Chrome, follow the legacy LATEST_RELEASE_ flow described in Version selection and Downloads.
ChromeDriver and WebDriver: starting a desktop session
Section titled “ChromeDriver and WebDriver: starting a desktop session”ChromeDriver is a standalone server implementing W3C WebDriver and WebDriver BiDi—it bridges WebDriver test code and Chrome.
ChromeDriver is a separate executable that Selenium WebDriver uses to control Chrome.
— Chrome, Get started with ChromeDriver
Setup checklist
Section titled “Setup checklist”From Get started with ChromeDriver:
- Install Chrome (or point ChromeDriver at a Chrome for Testing binary via
binaryin Capabilities and ChromeOptions). - Download a compatible ChromeDriver for your Chrome version (see version pinning above).
- Put
chromedriveronPATH, setwebdriver.chrome.driver(Java), or pass the path when constructingwebdriver.Chrome(Python).
For large suites, avoid starting a new ChromeDriver process per test: use ChromeDriverService or run ./chromedriver once and connect with RemoteWebDriver to http://127.0.0.1:9515.
Support policy: Help with ChromeDriver notes that only current Stable and Beta ChromeDriver versions are supported for bug reports.
Headless mode: unified Chrome vs chrome-headless-shell
Section titled “Headless mode: unified Chrome vs chrome-headless-shell”Modern Headless runs the same Chrome engine as headful mode—platform windows are created but not shown (since Chrome 112’s update).
With Chrome Headless mode, you can run the browser in an unattended environment, without any visible UI. Essentially, you can run Chrome without chrome.
— Chrome, Chrome Headless mode
Enable it with --headless on the binary, or via framework options—for example Puppeteer’s headless: true (default) as shown in Chrome Headless mode.
The old Headless implementation is deprecated as part of the main binary; since Chrome 132 it lives only as standalone chrome-headless-shell from Chrome for Testing. Trade-off from Headless Chrome shell: the shell is lighter and fewer dependencies; new Headless is fuller Chrome—better for accurate end-to-end tests and extension testing (extensions may need --headless=new where the toolchain does not add it).
CLI-only capture (no WebDriver)
Section titled “CLI-only capture (no WebDriver)”Headless command-line reference documents flags such as --dump-dom (post-JS DOM), --screenshot, --print-to-pdf, --timeout, and --virtual-time-budget for fast-forwarding timers—useful for smoke checks without a full test harness.
Virtual displays in Headless
Section titled “Virtual displays in Headless”From Chrome 142+, Configure virtual screens in Headless mode supports --screen-info and CDP Emulation.addScreen / Emulation.removeScreen for multi-monitor and kiosk scenarios (fully supported in Puppeteer).
Capabilities and ChromeOptions: profiles, args, and attach
Section titled “Capabilities and ChromeOptions: profiles, args, and attach”Capabilities and ChromeOptions configure each WebDriver session. Most Chrome-specific settings go through ChromeOptions (or goog:chromeOptions in capability dictionaries).
Practical patterns from the same doc:
- Custom profile:
user-data-dir=/path/to/profile(temporary profile is default per session). - Non-default binary:
binary→ path to Chrome for Testing or custom build. - Window:
start-maximizedinargs. - Downloads:
prefs→download.default_directory(avoid forbidden system folders; use full paths;driver.quit()may kill in-flight downloads). - Attach to existing Chrome:
debuggerAddressashost:port—see limits below.
Android-specific options (Getting started with Android) include androidPackage, androidDeviceSerial, androidUseRunningApp, and WebView-only androidActivity / androidProcess. Rooted devices are not required for Chrome 33+; always call driver.quit() when using multiple devices so ChromeDriver can assign free devices.
Mobile emulation uses mobileEmulation with either deviceName or custom deviceMetrics, userAgent, and clientHints.
Debugging when the browser has no window
Section titled “Debugging when the browser has no window”Headless Chrome
Section titled “Headless Chrome”Debug in Headless mode: launch with --remote-debugging-port=0, read the WebSocket URL from stdout, then in a normal Chrome instance use chrome://inspect → Configure → add 127.0.0.1:PORT → inspect the remote target.
Another Chrome instance (port forwarding)
Section titled “Another Chrome instance (port forwarding)”Access local servers and Chrome instances with port forwarding describes starting Chrome with --remote-debugging-port=PORT so DevTools can attach—same idea for debugging automation targets locally.
Logging
Section titled “Logging”Enable verbose ChromeDriver logs with --verbose and optionally --log-path (Logging). When Chrome fails to start, check chromedriver.log for which binary and switches were used (Chrome doesn’t start or crashes immediately).
Common mistakes and limits
Section titled “Common mistakes and limits”| Symptom or goal | What documentation says |
|---|---|
| Chrome crashes on Linux CI as root | Running as root is a common crash cause; --no-sandbox is unsupported and discouraged—run as a normal user (Chrome doesn’t start) |
| Tests only fail in Jenkins/service account | Try Chrome’s alternate “install for all users” installer (Chrome doesn’t start) |
operation not supported when using remote debugging |
Some commands need the automation extension loaded at startup; remove debuggerAddress and let ChromeDriver launch a fresh session (Operation not supported) |
Wrong or missing keys in sendKeys |
ChromeDriver expects a US keyboard layout; add US QWERTY as a secondary layout (Keyboard support) |
| Exposed ChromeDriver on a network | Default is local-only; use --allowed-ips deliberately; run unprivileged, isolated, firewalled (Security considerations) |
| Extension E2E in Headless | May need new Headless (--headless=new); old default headless may not load extensions (End-to-end testing for Chrome Extensions) |
Packed or unpacked extensions load via addExtensions or load-extension= (Chrome Extensions with ChromeDriver).
How to check this on your site
Section titled “How to check this on your site”-
Confirm your pipeline uses a pinned Chrome for Testing binary (or documents the exact version from the availability dashboard), not an auto-updating user Chrome install.
-
Run one minimal Get started with ChromeDriver sample locally with
chromedriveronPATH; if it fails, reproduce by launching the same binary and flags from a normal shell and inspectchromedriver.logper Chrome doesn’t start or crashes immediately. -
In CI, run the same test with
--headless(or Puppeteerheadless: true) and verify output (screenshot, DOM, or assertion) matches headful locally using Chrome Headless mode. -
For stuck Headless failures, attach DevTools using
--remote-debugging-portas in Debug in Headless mode. -
You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact statement you are asking about so it can be corrected.