GlossaryToolsIntermediate

Headless Browser

A headless browser is a real browser running without a visible window. It loads pages and runs JavaScript exactly like Chrome does, but it is driven by code instead of a mouse and keyboard.

Last updated July 29, 2026

Definition

A headless browser is a genuine web browser running with no user interface. The word headless simply means the "head" — the window, tabs, and buttons you normally see — is missing. Everything else is intact: it loads pages, executes JavaScript, applies CSS, stores cookies, and renders layout, all invisibly in the background.

It is the same engine as the browser on your desktop, just controlled by a script rather than a person.

Why not just fetch the page?

This is the key thing to understand. A simple HTTP request — curl, Python requests — downloads the raw HTML the server sends and stops there. That was fine when websites shipped finished pages.

Modern sites often send a nearly empty shell plus a bundle of JavaScript, then build the content in the browser. Fetch such a page with curl and you get a skeleton with no prices, no listings, no text. A headless browser runs that JavaScript, so it sees the finished page a real visitor would see.

The trade-off is cost. A headless browser uses far more memory and CPU than a plain request and is much slower — often hundreds of milliseconds versus a few. Sensible projects use plain requests wherever possible and reach for a browser only when the page genuinely requires one.

What it can do

  • Click buttons, fill forms, and log in
  • Scroll to trigger lazy-loaded or infinite-scroll content
  • Wait for specific elements to appear before reading them
  • Take screenshots and generate PDFs
  • Intercept network requests, and block images or ads to run faster
  • Run many isolated sessions in parallel, each with its own cookies

The common tools

  • Playwright — Microsoft's library, driving Chromium, Firefox, and WebKit from one API. Currently the usual default for new projects.
  • Puppeteer — Google's library, focused on Chrome and Chromium. Mature and widely documented.
  • Selenium — the long-standing standard, with the broadest language support and deep roots in QA testing.

Being detected — and why it happens

Websites can often tell a headless browser from a human one, because automation leaves traces. The navigator.webdriver property is set to true, the user-agent may contain the word HeadlessChrome, plugin and font lists come back unusually sparse, and mouse movement is either absent or suspiciously linear. Anti-bot systems check exactly these signals.

That is why people pair headless browsers with stealth plugins, realistic headers, human-like timing, and high-trust residential or mobile proxies. Even then, the browser itself is only part of the picture — the IP address it connects from matters just as much, since a perfect browser fingerprint arriving from a flagged datacenter IP still gets blocked.

Headless is not only for scraping

Its original purpose was automated testing, and that is still its biggest use. Continuous integration pipelines run thousands of headless browser tests on every commit, because a server has no screen to display a window on. The same technology also generates PDF invoices, renders social preview images, and produces page screenshots on demand.

Examples

1

Using Playwright to load a JavaScript-heavy product page and read prices that never appear in the raw HTML

2

A CI pipeline running the full browser test suite headlessly on every commit, with no screen attached

3

Generating a PDF invoice by rendering an HTML template in headless Chrome and printing it to file

4

Automating a multi-step login and checkout flow that a plain HTTP request could never complete

Common Use Cases

Scraping sites that build their content with JavaScript
Automated end-to-end and regression testing
Taking screenshots and generating PDFs at scale
Automating logins, forms and multi-step workflows
Monitoring page performance and uptime
Powering AI agents that need to browse real websites

Frequently Asked Questions

curl downloads the raw HTML the server returns and stops. A headless browser also runs the JavaScript, applies CSS, and builds the finished page. If a site loads its content dynamically, curl sees an empty shell while the headless browser sees the real thing.
Often, yes. Automation leaves signals: navigator.webdriver is set to true, the user-agent may say HeadlessChrome, plugin and font lists look sparse, and there is no natural mouse movement. Anti-bot systems check these deliberately.
Playwright is the usual choice for new work, since it drives Chromium, Firefox, and WebKit through one API. Puppeteer suits Chrome-only projects. Selenium remains strong where you need broad language support or already have a QA suite built on it.
For anything at scale, yes. The browser controls how you appear; the proxy controls where you appear from. Even a convincing browser fingerprint gets blocked if every request arrives from one flagged datacenter IP.
Somewhat, since nothing has to be painted to a screen, and you can block images and fonts to speed it up further. But it is still far heavier than a plain HTTP request, so use one only when the page actually needs JavaScript.
The tool itself is entirely legitimate and is standard in software testing. Legality depends on what you do with it — respect each site's terms of service, avoid login-gated data you are not authorised to access, and follow data-protection law where personal data is involved.