How modern bots are built: headless browsers and stealth

Intermediate4 min readUpdated

GET /learn/bots/how-modern-bots-are-built/ Accept text/html text/markdown

Short answer

Most bots are assembled from stock parts: an HTTP client or a real browser, an automation framework such as Selenium, Puppeteer or Playwright, stealth patches that hide automation flags, a proxy network for IP addresses and a CAPTCHA solving service. Each layer solves one problem for the operator and leaves traces a site can check, mainly contradictions between layers.

Operators use the cheapest layer that works against your site. If plain HTTP requests get through, they never pay for a browser. When a site starts checking browser signals, they add a layer, and each addition costs them money and leaves new traces for you.

What are the layers of a bot?

Layer What it does for the operator What it leaves behind
HTTP client Sends requests fast and cheaply, without a browser Library TLS fingerprint, missing browser headers, no JavaScript
Headless browser Runs real page code Server hardware: software graphics, few fonts, odd screen sizes
Automation framework Scripts clicks, typing and navigation navigator.webdriver, injected helpers, machine-like input
Stealth patches Hides automation flags Patched values that contradict each other
Proxies Supplies fresh IP addresses IPs that change mid-session or disagree with the device
CAPTCHA solving Gets past puzzles Solve times and token use that do not fit the visitor

HTTP clients

The simplest bots send HTTP requests from a library in Python, Go or Node.js, or from curl. Most scrapers and API attacks start here. They often copy a Chrome user agent and nothing else, as in this typical script request:

http
GET /api/products?page=2 HTTP/1.1
Host: shop.example
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive

Real Chrome talks HTTP/2 to most HTTPS sites and sends Accept-Language, sec-ch-ua client hints and Sec-Fetch-* headers. This request has none of them. The TLS handshake gives the client away earlier still. A TLS fingerprint such as JA4, a short hash of the cipher suites, extensions and protocol versions the client offers, looks different for each library and browser. TLS fingerprinting with JA3 and JA4 explains how to log it.

Scripts never fetch CSS or JavaScript, so cookies that page code would set are missing on the next request. Libraries that copy a browser's TLS handshake move the check to whether headers, HTTP/2 settings and behaviour match too.

Headless browsers

When a site needs JavaScript to work, operators run a real browser without a visible window. Chrome's headless mode now shares its code with regular Chrome. Since Chrome 132 the old, separate implementation is only available as a standalone binary called chrome-headless-shell. Checks for features the old headless lacked catch less than they used to.

What gives headless browsers away is the machine. Servers have no GPU, so WebGL reports a software renderer such as SwiftShader or llvmpipe. They have few fonts, no audio or video devices, a window exactly the size of the screen, and often a UTC clock with an IP in another country. This snippet collects the values worth sending to your server for comparison:

js
const gl = document.createElement('canvas').getContext('webgl');
const ext = gl && gl.getExtension('WEBGL_debug_renderer_info');

const signals = {
  webdriver: navigator.webdriver === true,
  renderer: ext ? gl.getParameter(ext.UNMASKED_RENDERER_WEBGL) : gl && gl.getParameter(gl.RENDERER),
  cores: navigator.hardwareConcurrency,
  timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
  languages: navigator.languages,
  screen: [screen.width, screen.height],
  window: [window.outerWidth, window.outerHeight],
};

A software renderer next to a claim of many CPU cores, or a screen that matches no real monitor, is a server. Detecting headless Chrome goes further.

Automation frameworks

Selenium uses the W3C WebDriver protocol. Puppeteer uses the Chrome DevTools Protocol. Playwright uses the DevTools Protocol for Chromium and ships its own patched builds of Firefox and WebKit.

Under automation, browsers set navigator.webdriver to true. In Chrome that happens with the --enable-automation or --headless flags. Frameworks also add helper code and bindings to the page, and remote debugging changes some browser behaviour in ways scripts can notice.

Input is the other trace. Scripted clicks land on the exact centre of an element with no mouse movement before them, typing arrives at an even pace, and pages scroll in jumps. Behavioural detection measures this.

Stealth patches

Stealth plugins and patched browser builds overwrite the flags above, from navigator.webdriver to the WebGL renderer string and the user agent. Antidetect browsers take the same idea further and sell a fresh device profile per account.

Each patch is a claim that has to agree with every other fact about the device. Patched properties often show up as functions that are not native code, or sit on the wrong object. A renderer string that names a desktop GPU while the drawing output matches a software renderer, a macOS user agent with a Linux font list, or a Chrome version that supports features from a different release all contradict themselves. Checking consistency across signals holds up better than hunting for single flags.

Proxies

Cloud servers have hosting IPs that are easy to label by ASN, so operators route traffic through residential proxies and mobile networks. The IP then looks clean, but the session does not: the address changes between page load and form submit, the browser timezone disagrees with the IP's country, or one device fingerprint appears from dozens of IPs in an hour.

CAPTCHA solving services

Solving services take the challenge from the bot, solve it with human workers or machine learning, and return a token for the bot to submit. How CAPTCHA solving services work covers the business, and Kairal has a technical breakdown of CAPTCHA solvers.

The traces are in timing and context. Solve times cluster in a narrow band, challenges pass with no page interaction before them, and the token may have been solved from a different IP or device than the one that submits it. Challenges that bind the token to the session, and check it against the device that asked for it, turn that mismatch into a signal.

Common questions

Can websites detect Selenium and Playwright?

Default setups are easy to spot, because they set navigator.webdriver and usually run on servers with no GPU and few fonts. Patched setups hide the obvious flags, so detection relies on contradictions between the browser, the device, the network and the visitor's behaviour.

Is headless Chrome detectable?

Usually, though old checks are fading. Looking for HeadlessChrome in the user agent only catches careless scripts, because operators override it. The machine the browser runs on, and how the session behaves, give away more than the browser build does.

Are automation frameworks illegal?

No. Selenium, Puppeteer and Playwright are testing tools that developers use every day. What matters legally is what the automation does on someone else's site, which depends on the site's terms and local law.