AI and automation
Headless or headful browsers for automation?
Use headless by default for speed and server friendliness, and switch to headful for debugging or for sites whose bot checks single out headless browsers.
The difference
A headless browser runs the full engine (HTML, CSS, JavaScript, network) without drawing a window. A headful browser is the normal browser with a visible window, which on a server needs a display, real or virtual. Playwright, Puppeteer and Selenium can run either way with one option. Modern Chrome's newer headless mode shares most of its code with the regular browser, so the gap is smaller than it used to be, but differences remain.
Comparison
| Headless | Headful | |
|---|---|---|
| Resource use | Lower | Higher (rendering, display) |
| Runs on a plain server | Yes | Needs a virtual display such as Xvfb |
| Debugging | Screenshots and logs | Watch it live, use devtools |
| Bot detection | More tells to hide | Fewer tells |
| Parallel instances per machine | More | Fewer |
Detection: the main reason to care
Sites with bot management look for signs of automation, and some are specific to headless mode: user agent strings containing "HeadlessChrome" in older versions, missing plugins or odd screen sizes, rendering differences in canvas and WebGL, and the navigator.webdriver flag that all automated browsers expose unless changed. The entry on headless browser detection lists them. On sites that score these signals heavily, a headful browser meets fewer challenges and gets better reCAPTCHA v3 scores.
Running headful on a server
# give the browser a virtual screen, then run the script headful
xvfb-run --auto-servernum --server-args="-screen 0 1600x1000x24" node collect-prices.mjs
Inside the script, launch with headless: false. It costs more memory per instance, so plan for fewer parallel browsers per machine.
A sensible default
- Development: headful, often with slow motion, so you can see what happens; see debugging Puppeteer.
- Production on friendly sites: headless, for density and cost.
- Production on strict sites: try headless first with consistent headers, a real user agent and a stable proxy. If challenges stay frequent, compare a headful run on the same IPs and measure the difference.
- Your own QA suites: headless in CI, headful for reproducing failures locally.
CAPTCHAs either way
Whichever mode you choose, some challenges will still appear. Token widgets can be solved through the API and injected into the page in both modes; the solve happens on the solver's side, so your browser mode does not affect it. What the mode does affect is how often you meet challenges and, for score based widgets, how the rest of the session looks. With reCAPTCHA v3 in particular, a session that looks automated can undo a good token. The guides on Playwright being detected and fingerprints in agents cover the session side.
For AI agents
Agent frameworks that drive browsers usually default to headless in the cloud. If your agent hits the same wall repeatedly on one site, a headful run with a persistent profile is a quick experiment that tells you whether detection is the cause. Persisting cookies between runs also cuts the number of checks, because a returning visitor with history is trusted more than a fresh one every time.
The cost side
Measure before switching a whole fleet to headful. Count pages per hour per machine in each mode, then add the cost of solving the extra challenges you meet in headless mode, for example at $0.56 per 1,000 for reCAPTCHA v2. Sometimes solving is cheaper than the extra machines; sometimes fewer challenges make headful the better deal.
Whatever you choose, record the mode in your run logs next to the challenge rate. When a site tightens its checks months later, that history tells you at once whether switching modes is worth trying.
Common questions
Is headless Chrome detectable?
Often, through several small signals; modern headless mode hides more of them, but strict sites still notice.
Does headful mode avoid CAPTCHAs?
It usually reduces them on strict sites, but it does not remove them; other signals still count.
Can I run a headful browser on a server without a monitor?
Yes, with a virtual display such as Xvfb and xvfb-run.
Does browser mode affect solving through an API?
No. The solve happens on the solver's side; only token injection happens in your browser.
Which mode is cheaper?
Headless per page, though extra challenges on strict sites can shift the balance; measure both.
Keep reading
- Headless browserA real browser engine running without a visible window, driven by code for tests, screenshots and pages that need JavaScript.
- Headless browser detectionThe traces a browser without a window tends to leave: automation flags, missing plugins and telltale user agent tokens.
- Why your Playwright bot is detectedThe automation tells a stock Playwright launch exposes, how sites read them, and practical changes for calmer test runs.
- What is stealth mode in browser automation?Stealth mode patches tells that give away an automated browser, like the webdriver flag and headless quirks, but not everything.