Chrome's `--headless` flag launches the browser without rendering to a screen, consuming far less memory and CPU than a full graphical session. Headless Chrome exposes the Chrome DevTools Protocol (CDP), which allows external programs to control page navigation, inspect the DOM, intercept network requests, execute JavaScript, and capture screenshots.
Playwright and Puppeteer are the dominant libraries for controlling headless Chrome programmatically. They wrap CDP in a high-level API and handle browser lifecycle management, page context isolation, and event waiting. Some libraries (Playwright) can also drive Firefox and WebKit in headless mode.
Detection of headless Chrome is a cat-and-mouse game: anti-bot systems look for tells such as missing `window.chrome` properties, specific navigator attributes set by headless mode, or WebGL rendering differences. Stealth patches (puppeteer-extra-plugin-stealth, Playwright's maskFingerprintingScripts) override these properties to make the headless browser indistinguishable from a real user's Chrome.