Compare commits
69
Commits
v0.8.0
...
article-views
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c24507b5a | ||
|
|
39010ed45e | ||
|
|
d34a11e886 | ||
|
|
5f528357a6 | ||
|
|
70a8164d26 | ||
|
|
8a8dc8d0fd | ||
|
|
648aacfabd | ||
|
|
c61579c2f4 | ||
|
|
0bd093d285 | ||
|
|
61fde53457 | ||
|
|
823217b484 | ||
|
|
b8243bb0c2 | ||
|
|
0f14cc782d | ||
|
|
d4faa9ebaf | ||
|
|
39e4dd2e0f | ||
|
|
76a7a0ce21 | ||
|
|
0d65c54eb6 | ||
|
|
5a786f43d6 | ||
|
|
1f6f8d1ac8 | ||
|
|
95c791d351 | ||
|
|
907150bf60 | ||
|
|
d86f52c9c8 | ||
|
|
686607738e | ||
|
|
e2b795eea4 | ||
|
|
4ddf1f9fb7 | ||
|
|
790a123c86 | ||
|
|
0d2dae5862 | ||
|
|
101b8099fe | ||
|
|
874277167f | ||
|
|
0828d6b9b0 | ||
|
|
0a16b783d6 | ||
|
|
31ba882e6d | ||
|
|
fc7915483f | ||
|
|
fc0a2827ac | ||
|
|
f2474beb0b | ||
|
|
03f695d813 | ||
|
|
3b6fee9957 | ||
|
|
f4f5f13629 | ||
|
|
3fbbf6dd30 | ||
|
|
c08444186e | ||
|
|
52a1fc0859 | ||
|
|
0f48c05214 | ||
|
|
4438689e40 | ||
|
|
bf72778dcc | ||
|
|
83403b83a7 | ||
|
|
12fd16385a | ||
|
|
2b4f83f7f2 | ||
|
|
38ac9d5259 | ||
|
|
9cd79b98bc | ||
|
|
011b1c35d3 | ||
|
|
2b85b111eb | ||
|
|
386da78813 | ||
|
|
430668e50f | ||
|
|
f31b7f8ee8 | ||
|
|
7115bbeb32 | ||
|
|
cbbdda07be | ||
|
|
784c3cee1d | ||
|
|
8650f3b64c | ||
|
|
36719bb26f | ||
|
|
ba3690739d | ||
|
|
b94ba47a6b | ||
|
|
c07fbc08a8 | ||
|
|
604de15836 | ||
|
|
a822d11c07 | ||
|
|
89d56923e0 | ||
|
|
aeabf1451c | ||
|
|
718afe93d5 | ||
|
|
87ff57336d | ||
|
|
c6924d3fba |
No files matched your search
@@ -30,7 +30,7 @@ name: e2e hunt
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
giri:
|
||||
runs:
|
||||
description: "How many runs at most (at 12% it takes ~18 for a 90% chance)"
|
||||
required: false
|
||||
default: "18"
|
||||
@@ -92,19 +92,19 @@ jobs:
|
||||
- name: Loop until it catches one
|
||||
env:
|
||||
PYTHONUNBUFFERED: "1"
|
||||
INVPW_TEST_WATCHDOG_FILE: prove/e2e-watchdog.log
|
||||
INVPW_TEST_WATCHDOG_FILE: evidence/e2e-watchdog.log
|
||||
run: |
|
||||
set -u
|
||||
runs="${{ inputs.giri }}"
|
||||
mkdir -p prove/giri
|
||||
# `prove/` inside the workspace, not RUNNER_TEMP: on Windows that
|
||||
runs="${{ inputs.runs }}"
|
||||
mkdir -p evidence/runs
|
||||
# `evidence/` inside the workspace, not RUNNER_TEMP: on Windows that
|
||||
# variable contains backslashes and does not cross bash reliably.
|
||||
# xvfb only where it exists; on Windows the browser goes to the
|
||||
# runner's desktop.
|
||||
if [ "$RUNNER_OS" = "Linux" ]; then PRE="xvfb-run -a"; else PRE=""; fi
|
||||
captured=0
|
||||
for n in $(seq 1 "$runs"); do
|
||||
log="prove/giri/giro_$(printf '%02d' "$n").log"
|
||||
log="evidence/runs/run_$(printf '%02d' "$n").log"
|
||||
t0=$(date +%s)
|
||||
set +e
|
||||
$PRE python -u scripts/run_e2e.py "$FF" > "$log" 2>&1
|
||||
@@ -140,7 +140,7 @@ jobs:
|
||||
with:
|
||||
name: e2e-hunt-${{ inputs.os }}-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
path: |
|
||||
prove/giri
|
||||
prove/e2e-watchdog.log
|
||||
evidence/runs
|
||||
evidence/e2e-watchdog.log
|
||||
if-no-files-found: warn
|
||||
retention-days: 14
|
||||
@@ -13,7 +13,7 @@ name: firefox-launch-matrix
|
||||
# cache is content-keyed (Cache/<tag>_<version>_<buildid>/), so every cell failed
|
||||
# with NOT FOUND - a failure that looked exactly like the bug under investigation
|
||||
# and was not. Nine red cells read as "reproduced everywhere". The path now comes
|
||||
# from `python -m invisible_playwright path`, the only thing that knows it.
|
||||
# from the last line of `fetch`, the command that verifies the sealed tree.
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@@ -82,23 +82,36 @@ jobs:
|
||||
pip install .
|
||||
|
||||
- name: Fetch the sealed binary
|
||||
run: python -m invisible_playwright fetch
|
||||
shell: pwsh
|
||||
run: |
|
||||
$fetchOutput = @(python -m invisible_playwright fetch)
|
||||
$fetchExit = $LASTEXITCODE
|
||||
$fetchOutput | ForEach-Object { Write-Host $_ }
|
||||
if ($fetchExit -ne 0) {
|
||||
exit $fetchExit
|
||||
}
|
||||
$ffPath = [string]($fetchOutput | Select-Object -Last 1)
|
||||
$ffPath = $ffPath.Trim()
|
||||
if (-not $ffPath -or -not (Test-Path $ffPath)) {
|
||||
Write-Error "fetch reported no firefox.exe at '$ffPath'"
|
||||
exit 1
|
||||
}
|
||||
"FF_PATH=$ffPath" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
|
||||
|
||||
- name: Verify firefox.exe can launch standalone
|
||||
shell: pwsh
|
||||
run: |
|
||||
# ASK for the path, never rebuild it. The cache directory is keyed on
|
||||
# tag + base version + BuildID, so any string assembled here is a second
|
||||
# copy of a naming rule that has already moved once - and when it drifts
|
||||
# the step fails with NOT FOUND, which is indistinguishable from the
|
||||
# launch bug this job exists to detect.
|
||||
$ffPath = (python -m invisible_playwright path).Trim()
|
||||
# CARRY the path from fetch, never rebuild it. The cache directory is
|
||||
# keyed on tag + base version + BuildID, so any string assembled here
|
||||
# is a second copy of a naming rule that has already moved once - and
|
||||
# when it drifts the step fails with NOT FOUND, indistinguishable from
|
||||
# the launch bug this job exists to detect.
|
||||
$ffPath = $env:FF_PATH
|
||||
Write-Host "Package reports: $ffPath"
|
||||
if (-not $ffPath -or -not (Test-Path $ffPath)) {
|
||||
Write-Error "firefox.exe NOT FOUND at '$ffPath' (reported by the package)"
|
||||
Write-Error "firefox.exe NOT FOUND at '$ffPath' (reported by fetch)"
|
||||
exit 1
|
||||
}
|
||||
"FF_PATH=$ffPath" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
|
||||
Write-Host "Launching: $ffPath --version"
|
||||
# NOTE: firefox.exe --version on Windows prints the version but may
|
||||
# return non-zero exit code (sub-process fork quirk). Check stdout.
|
||||
|
||||
@@ -20,6 +20,35 @@ concurrency:
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
# The gate was written FOR this repository on 2026-08-27, after 549 lines of
|
||||
# Italian shipped here in one subsystem and 852 more were found in 33 files
|
||||
# that were already public. It has been wired nowhere ever since: not into
|
||||
# tests.yml, not into the pre-push hook, whose steps are pytest, pin, names,
|
||||
# internals and publish. Both sibling packages copied the script AND the CI
|
||||
# step; this one kept only the script, so the one repository the rule exists
|
||||
# for is the one that never checked. Measured 2026-09-03, the first time
|
||||
# anybody ran it here: four files, red.
|
||||
#
|
||||
# Its own job, and deliberately NOT behind core-on-index. Reading files needs
|
||||
# no install, and hanging a language check off the availability of a package on
|
||||
# an index would silently skip it during exactly the window when releases are
|
||||
# being made.
|
||||
english:
|
||||
name: the repository is English
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- name: check the prose
|
||||
# --selftest first: a language gate that has only ever printed "clean" is
|
||||
# the same non-gate as any other, and this one can go blind from a single
|
||||
# edit to its word list.
|
||||
run: |
|
||||
python scripts/check_english_only.py --selftest
|
||||
python scripts/check_english_only.py
|
||||
|
||||
# `pip install -e ".[dev]"` below resolves `invisible-core==N.M.0` from the
|
||||
# package index. The core is published BEFORE this package, so between the
|
||||
# first push of this repo and that upload there is a window in which no
|
||||
@@ -150,8 +179,40 @@ jobs:
|
||||
# turn that choice into a red and push toward dropping the protection on
|
||||
# release day of all days. So it refuses on `failure` and `cancelled`,
|
||||
# never on `skipped`.
|
||||
# The guides are the surface a stranger copies first, and until 2026-09-08
|
||||
# nothing read them: one page published `page.accessibility.snapshot()`, which
|
||||
# this fork does not have, so anybody who ran that block got an AttributeError.
|
||||
# A broken test is seen by whoever runs the suite; a broken guide is seen once,
|
||||
# by a reader who then leaves.
|
||||
#
|
||||
# It needs the package importable, because it asks the REAL classes what they
|
||||
# have rather than carrying a list that would drift from them - so it takes
|
||||
# core-on-index's answer exactly as `unit` does, and is SKIPPED during the
|
||||
# window rather than faked green.
|
||||
docs-api:
|
||||
name: the guides name an API that exists
|
||||
needs: core-on-index
|
||||
if: needs.core-on-index.outputs.available == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
cache: pip
|
||||
- name: Install package
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -e .
|
||||
- name: check the guides against the API
|
||||
# --selftest first, for the same reason the English gate does it: this
|
||||
# one goes blind from a single edit to the list of names it inspects.
|
||||
run: |
|
||||
python scripts/check_docs_api_surface.py --selftest
|
||||
python scripts/check_docs_api_surface.py
|
||||
|
||||
gate:
|
||||
needs: [core-on-index, unit]
|
||||
needs: [core-on-index, unit, docs-api]
|
||||
if: always()
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -159,10 +220,47 @@ jobs:
|
||||
run: |
|
||||
echo "core-on-index: ${{ needs.core-on-index.result }}"
|
||||
echo "unit: ${{ needs.unit.result }}"
|
||||
echo "docs-api: ${{ needs.docs-api.result }}"
|
||||
case "${{ needs.unit.result }}" in
|
||||
failure|cancelled) echo "the suite did not pass"; exit 1 ;;
|
||||
esac
|
||||
case "${{ needs.core-on-index.result }}" in
|
||||
failure|cancelled) echo "the index check did not run"; exit 1 ;;
|
||||
esac
|
||||
case "${{ needs.docs-api.result }}" in
|
||||
failure|cancelled) echo "the guides name something that does not exist"; exit 1 ;;
|
||||
esac
|
||||
echo "ok"
|
||||
|
||||
# Measured 2026-09-04: 0.10.0 was on the index while main sat on 0.10.0 with
|
||||
# FIFTEEN commits of different content on top of the tag - 39 files, 841
|
||||
# insertions, the screenshot clip fix among them. A release from there would
|
||||
# have published NOTHING and reported success, because publish.yml treats an
|
||||
# already-present version as a deliberate no-op: right for a re-pushed tag,
|
||||
# indistinguishable from somebody forgetting to bump. The fix could not have
|
||||
# reached anybody, and nothing would have said so.
|
||||
#
|
||||
# Pull requests only: on main straight after a release the version IS the
|
||||
# published one until somebody bumps, and a gate that is red at rest is one
|
||||
# people learn to skip. Bumping publishes nothing - publishing happens on a
|
||||
# tag push - so main on an unreleased version is the normal state between
|
||||
# releases and the rule costs one line.
|
||||
version:
|
||||
if: github.event_name == 'pull_request'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
# The gate diffs the tree against the tag of the published
|
||||
# version; a shallow clone has no tags and cannot tell.
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- name: the version this change proposes is still free
|
||||
env:
|
||||
IPW_CHECK_VERSION: "1"
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install pytest
|
||||
python -m pytest -q tests/test_version_is_not_taken.py
|
||||
@@ -49,10 +49,7 @@ jobs:
|
||||
python -m pip install --upgrade pip
|
||||
pip install -e ".[dev]"
|
||||
|
||||
- name: Fetch the patched Firefox binary
|
||||
run: python -m invisible_playwright fetch
|
||||
|
||||
- name: Resolve binary path
|
||||
- name: Fetch the patched Firefox binary and expose its path
|
||||
shell: bash
|
||||
run: |
|
||||
# NOT `echo "VAR=$(cmd)" >> $GITHUB_ENV`. echo exits 0 whatever the
|
||||
@@ -61,9 +58,11 @@ jobs:
|
||||
# `pytest.skip("no patched binary")`, pytest exits 0, and the job is
|
||||
# green having verified nothing - which is exactly what run #1 did.
|
||||
set -euo pipefail
|
||||
BIN="$(python -m invisible_playwright path)"
|
||||
FETCH_OUTPUT="$(python -m invisible_playwright fetch)"
|
||||
printf '%s\n' "$FETCH_OUTPUT"
|
||||
BIN="$(printf '%s\n' "$FETCH_OUTPUT" | tail -n 1)"
|
||||
if [ -z "$BIN" ] || [ ! -e "$BIN" ]; then
|
||||
echo "invisible_playwright path returned '$BIN', which is not a" >&2
|
||||
echo "invisible_playwright fetch returned '$BIN', which is not a" >&2
|
||||
echo "file. Refusing to run a suite that would skip itself green." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
+321
@@ -6,6 +6,327 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.13.2] - 2026-09-07
|
||||
|
||||
### Fixed
|
||||
- **`page.goto()` now answers with the Response, instead of always `None`.**
|
||||
The navigation itself was never broken - the page loaded, the `response`
|
||||
events carried the right statuses and `expect_response` worked - but the
|
||||
return value was hardcoded to `None`, so `page.goto(url).status` was not
|
||||
reachable. `page.reload()` answers with a Response too, and so does history
|
||||
navigation, which shares that code path but is still held back by a separate
|
||||
engine defect of its own. A redirect chain answers with the FINAL response,
|
||||
and a same-document navigation still answers `None`, as upstream does.
|
||||
Crawlee treats a `None` here as a failed load, so a `PlaywrightCrawler`
|
||||
driven by this package failed every request; it now finishes them.
|
||||
|
||||
## [0.13.1] - 2026-09-06
|
||||
|
||||
### Changed
|
||||
- **The engine is `firefox-29`, through `invisible-core 29.19.0`.** It carries
|
||||
the screencast that `page.screencast.start(on_frame=...)` needs, so the
|
||||
feature shipped in 0.13.0 now has an engine that answers it, and the
|
||||
full-window frame no longer carries the Windows resize border. Nothing
|
||||
else moves: the pin follows the seal.
|
||||
|
||||
## [0.13.0] - 2026-09-05
|
||||
|
||||
### Added
|
||||
- **`page.screencast.start(on_frame=...)` streams JPEG frames of the browser
|
||||
WINDOW.** `page.screenshot()` gives the content viewport and can never show
|
||||
the pointer, which is drawn in the chrome document precisely so that no page
|
||||
can see it. The screencast captures the window through the operating system
|
||||
in the parent process - tab strip, address bar and pointer included, nothing
|
||||
injected into the page - and hands each frame to `on_frame` as JPEG bytes
|
||||
with the captured window's size. Needs an engine from `firefox-28` on;
|
||||
`size=` bounds the frame (scaled down to fit, never up, default 1280x800)
|
||||
and `quality=` the JPEG quality (default 80). `path=` (a video file) is
|
||||
refused by name: the engine has no video encoder.
|
||||
|
||||
### Fixed
|
||||
- **Two threads writing the Juggler pipe could splice two commands into one
|
||||
line.** Frames are acknowledged from the reader thread while the caller's
|
||||
thread dispatches input; the pipe now has a write lock, and a
|
||||
`Connection.post` that sends without waiting for the reply.
|
||||
|
||||
## [0.12.3] - 2026-09-05
|
||||
|
||||
### Fixed
|
||||
- **Orphaned `.tmp-<tag>-<pid>` trees in the engine cache are swept.** Through
|
||||
`invisible-core 27.19.0`: a download killed during `verifying` or
|
||||
`extracting` used to leave up to the whole extracted tree behind, because
|
||||
only a fresh download by the same pid ever removed it. `ensure_binary` now
|
||||
removes the trees whose process is gone, on every call, and leaves alone
|
||||
this process's own tree, a live process's tree and anything not named after
|
||||
a pid. The MCP server 0.13.0 starts the download with the process, which made
|
||||
a killed download an ordinary event rather than a Ctrl-C.
|
||||
|
||||
## [0.12.2] - 2026-09-05
|
||||
|
||||
### Changed
|
||||
- **The launch counter lives on the engine's repository.** Every session now
|
||||
declares `invisible_firefox.usage_ping.url` through `invisible-core 27.18.0`,
|
||||
pointing at the `usage-counter` release of `firefox_antidetect_patch`, the
|
||||
repository that builds and ships the engine. The engine's compiled default
|
||||
says the same from the next build. Engines older than firefox-21 do not read
|
||||
the pref and are not counted. To opt out of the ping, set
|
||||
`invisible_firefox.usage_ping.enabled` to `False` in `extra_prefs`.
|
||||
- **The `browser launches` badge is back.** It was removed in 0.7.2 because the
|
||||
counter behind it lived on a repository that had been deleted, so the badge
|
||||
would have redrawn a frozen number every morning. The counter has lived on
|
||||
this repository since 2026-08-19 and is counting again, so the figure the
|
||||
badge shows is live. It is cumulative, and it undercounts: engines before
|
||||
firefox-21 still ask the old address, and they rejoin only as they upgrade.
|
||||
|
||||
## [0.12.1] - 2026-09-05
|
||||
|
||||
### Fixed
|
||||
- **A persistent profile keeps its cookies and storage for the next session.**
|
||||
Since 0.8.0, `profile_dir=` kept nothing: the first session on a profile set a
|
||||
cookie and a localStorage entry and read both back, the second session on the
|
||||
same profile read an empty jar and `None`, and on disk `cookies.sqlite` held
|
||||
zero rows. The persistent launch handed back an ordinary context, a Juggler
|
||||
container with its own userContextId, and Juggler deletes a container's
|
||||
cookies and storage together with the identity when the context is removed;
|
||||
everything a session wrote lived in a container that died with the session.
|
||||
The persistent context is now the browser's default one, the one whose state
|
||||
is the profile's, addressed by omitting `browserContextId` and never removed;
|
||||
closing it closes the browser, as upstream does. Found by a clean-environment
|
||||
check of 0.12.0, on the day after the docs page promised "logging in once
|
||||
instead of every run".
|
||||
|
||||
### Added
|
||||
- **A test that a persistent profile keeps state**, e2e: two sessions on one
|
||||
profile, cookie and localStorage written in the first and read in the second,
|
||||
and the cookie row read from `cookies.sqlite` in between, so a regression
|
||||
cannot pass by keeping the data where the page sees it and the disk does not.
|
||||
Against 0.12.0 it fails on the on-disk read.
|
||||
|
||||
## [0.12.0] - 2026-09-04
|
||||
|
||||
### Fixed
|
||||
- **The first launch on Windows works.** On a machine that had never run the
|
||||
engine from that path, the first `InvisiblePlaywright(...)` exited with
|
||||
`3221226505` (0xC0000409) before the protocol came up, and the second one
|
||||
worked. It was Firefox's launcher process, not the browser: on a new path
|
||||
`firefox.exe` runs as the launcher first and forwards the Juggler pipe to the
|
||||
real browser, and it read that pipe from CRT descriptors 3 and 4, which the
|
||||
Node.js driver provides and this client does not, since it names the handles
|
||||
in `PW_PIPE_READ` / `PW_PIPE_WRITE`. The launcher died on `_get_osfhandle(3)`;
|
||||
the next launch found a launcher timestamp with no browser timestamp in the
|
||||
registry and disabled the launcher for that path, which is why it failed
|
||||
exactly once per machine and why nothing about the cache directory mattered.
|
||||
The engine is firefox-27, where the launcher forwards the handles it is
|
||||
handed. Every Windows first launch since 0.8.0, the release where this client
|
||||
replaced the Node driver, had this; the daily Windows install check had been
|
||||
red since 2026-08-31. (#144)
|
||||
|
||||
### Added
|
||||
- **A test for the first launch from a path Firefox has never run from**,
|
||||
Windows only, e2e. It removes the launcher's registry values for the binary
|
||||
under test, launches once, and checks both that the page answers and that the
|
||||
launcher recorded a start followed by the browser's, so a success with the
|
||||
launcher disabled, the path that always worked, does not pass. Against
|
||||
firefox-26 it fails with the exit code above.
|
||||
|
||||
### Internal
|
||||
- Engine pin moved to firefox-27 through `invisible-core 27.17.0`.
|
||||
|
||||
## [0.11.0] - 2026-09-04
|
||||
|
||||
### Fixed
|
||||
- **A screenshot photographs where the page is.** The clip was
|
||||
`{x: 0, y: 0, width: innerWidth, height: innerHeight}`, and that clip is in
|
||||
document coordinates: not the window, but the top corner of the page at the
|
||||
window's size. An agent that scrolled and looked got the same image every
|
||||
time, and nothing in the image says so. `full_page` was not read at all:
|
||||
800x600 came back where 800x4000 was asked for. (#136)
|
||||
- **Two manual workflows stop calling the removed `path` command.** Both
|
||||
called `python -m invisible_playwright path`, a subcommand removed when the
|
||||
CLI became `fetch` plus `version`. The Windows launch matrix failed in all
|
||||
three cells before reaching its launch probe, and the WebRTC gate had not run
|
||||
since the removal. The existing parser gate scanned Python tests only, so
|
||||
neither call site was in its perimeter; there is now one that reads the
|
||||
workflows too. Thanks to @SamadhiFire for finding and fixing it. (#141)
|
||||
|
||||
### Added
|
||||
- **A check that asks the index whether the version a change proposes is
|
||||
still free**, on pull requests. This release exists partly because that
|
||||
check found its own repository in the state it exists to prevent: 0.10.0 was
|
||||
on the index while main sat on 0.10.0 with fifteen commits on top of the
|
||||
tag, the screenshot fix among them. A release from there would have
|
||||
published nothing and reported success, because the publish workflow treats
|
||||
an already-present version as a deliberate no-op, which is right for a
|
||||
re-pushed tag and indistinguishable from somebody forgetting to bump. (#142)
|
||||
|
||||
### Documentation
|
||||
- Twelve pages stop shipping code that cannot run as pasted, tool metadata is
|
||||
out of the shipped screenshots, and the front page names the agent layer
|
||||
that sits on this engine. (#137, #138, #139, #140)
|
||||
|
||||
## [0.10.0] - 2026-09-03
|
||||
|
||||
### Added
|
||||
- **Nine acting methods on `ElementHandle`.** `click`, `hover`, `fill`, `type`,
|
||||
`press`, `focus`, `check`, `uncheck` and `select_option` now work on a handle,
|
||||
so `page.query_selector("#go").click()` does what it does in Playwright. Until
|
||||
now the driver served fourteen handle methods, every one of them a read, and
|
||||
every action answered `ElementHandle has no method 'click'`.
|
||||
|
||||
They go through the same humanised path as the selector versions - approach,
|
||||
hover, press, release, with the hit-target check and the actionability retry -
|
||||
rather than a second, simpler one. Two click paths would be two fingerprints.
|
||||
What differs is only what should: the node is not looked up again, and the
|
||||
handle is still usable afterwards.
|
||||
### Documentation
|
||||
- **Two pages said there is no MCP server for this project.** Both were written
|
||||
on 2026-07-27 and the server was published on 2026-08-19: true when written,
|
||||
and afterwards they steered readers to Microsoft's server, which cannot carry
|
||||
the seeded profile, for a problem ours solves. The integration page now opens
|
||||
with ours and is what it actually is - how to point Microsoft's playwright-mcp
|
||||
at this engine if you are already on it, and what that costs.
|
||||
|
||||
- **The README never mentioned either sibling.** A reader who would rather prompt
|
||||
than script had one hand-off, to the page above, which told them no server
|
||||
existed. There is now a short block after Install with both one-liners, and the
|
||||
Related projects section lists the three siblings before the third-party ones.
|
||||
|
||||
- The Python floor was stated only as a badge image about 200 lines below the
|
||||
install block, and the first-run download size disagreed across three READMEs,
|
||||
all three wrong against the packaged seal. One home for it, here.
|
||||
|
||||
- Four wiki pages edited in a working tree on 2026-08-30, rescued onto a branch
|
||||
and then lost a second time when the branch was never merged. Landed.
|
||||
### Internal
|
||||
- The English-only gate was written for this repository on 2026-08-27 and wired
|
||||
nowhere: not into tests.yml, not into the pre-push hook. Both sibling packages
|
||||
copied the script and the CI step; this one kept only the script. Run here for
|
||||
the first time it found four Italian test files, now translated, and it runs in
|
||||
CI from now on.
|
||||
|
||||
## [0.9.0] - 2026-09-02
|
||||
|
||||
### Fixed
|
||||
|
||||
- **`wait_for_timeout` has never waited.** A request for 2000ms returned in
|
||||
1ms, in both the sync and the async API and in every caller of either, for as
|
||||
long as this package has had its own driver. Nothing raised, so nothing
|
||||
showed.
|
||||
|
||||
The defect was in `_juggler/server.py`, the driver written here to replace the
|
||||
Node one: `op_wait_for_timeout` read `params.get("timeout")`, a key the client
|
||||
never sends for this call, so the sleep was always zero. The client sends
|
||||
`waitTimeout`, which looks like a typo and is not - upstream Playwright
|
||||
declares this one parameter under its own name because `timeout` is the
|
||||
reserved key on that channel, carrying the per-call action timeout for every
|
||||
other call.
|
||||
|
||||
⛔ The first attempt patched the vendored client instead, to make it send
|
||||
the key the server happened to read. That is a fix at the symptom: it leaves
|
||||
the defect in the code this project owns, the next re-vendor of upstream would
|
||||
silently undo it, and it committed a false claim about the protocol into a
|
||||
comment, this changelog and a test. Review caught it before it shipped.
|
||||
|
||||
What it cost, where it was found. A corpus run against real sites reported
|
||||
three of them as blocked by three different anti-bot products, one with the
|
||||
challenge markup sitting in the document; all three serve their real page once
|
||||
the wait exists, so those verdicts were artefacts of the tool rather than
|
||||
measurements of anything. A fourth site was reported as never loading and
|
||||
loads in twenty seconds. In the MCP package a polling loop of sixty
|
||||
one-second waits ran to completion instantly, so a test with a sixty-second
|
||||
budget failed in fourteen for no reason anybody could see.
|
||||
|
||||
⛔ **This changes timings for existing callers**, which is why it is a
|
||||
minor bump and not a patch. Code that called `wait_for_timeout` and returned
|
||||
instantly will now take the time it asked for. That is the documented
|
||||
behaviour of the API and the old behaviour was silently wrong, but a script
|
||||
that waited in a loop will get slower rather than faster.
|
||||
|
||||
|
||||
## [0.8.3] - 2026-08-31
|
||||
|
||||
### Changed
|
||||
|
||||
- **Pins `invisible-core` 26.17.0, which seals firefox-26.** That engine moves
|
||||
every input handler in the visible-pointer overlay out of input delivery.
|
||||
Until now only the `mousemove` one had been deferred; the press handler was
|
||||
still adding a class, CREATING a DOM node, attaching a listener to it and
|
||||
appending it - which starts a CSS animation - synchronously in the parent
|
||||
process while a `mousedown` was in flight. That is more work than what had
|
||||
been removed, and on the click path rather than the move path.
|
||||
|
||||
The move handler's cost was measured: with the overlay on, the median gap
|
||||
between the `mousemove` events THE PAGE receives moved by a whole clamp step,
|
||||
18 ms against 17, p = 0.0005. The press path was never measured, because the
|
||||
bench that found the first one injects and listens for `mousemove` only - it
|
||||
was watching the branch that had already been fixed. The remedy here is the
|
||||
same rule applied to all four handlers rather than a second special case: a
|
||||
handler records numbers and asks for a frame, and one place draws.
|
||||
|
||||
⛔ The timing gain is NOT measured. A press-path bench now exists and refuses
|
||||
to run on a loaded machine, which is all that has been available. This is a
|
||||
fix with a mechanism and a measured precedent, not a number.
|
||||
|
||||
- The core it pins also stops the pre-push hook from naming one cause for every
|
||||
kind of publish-gate refusal.
|
||||
|
||||
## [0.8.2] - 2026-08-31
|
||||
|
||||
### Changed
|
||||
|
||||
- **The pinned engine moves to firefox-25, which has no updater.** Until now
|
||||
every session showed an "Update available" badge in the toolbar shortly after
|
||||
start. No preference could remove it: `app.update.auto` stops the download
|
||||
rather than the notification, `app.update.suppressPrompts` only delays the
|
||||
doorhanger because the badge is shown immediately and unconditionally, and
|
||||
`app.update.disabledForTesting` is inert unless the browser is driven by
|
||||
Marionette or the remote agent, which this package is not.
|
||||
|
||||
The engine is therefore built without the update machinery at all: the build
|
||||
options are gone rather than switched off, so nothing checks for an update,
|
||||
nothing can install one over the binary the seal pins, and the badge has no
|
||||
code left to draw it. The update channel is unchanged, because the
|
||||
application's remoting name derives from it.
|
||||
|
||||
One consequence is worth stating: a retail Firefox contacts Mozilla's update
|
||||
service at startup and this build no longer does. No page can observe that -
|
||||
no API exposes the updater's state - but anything watching the connection
|
||||
can.
|
||||
|
||||
## [0.8.1] - 2026-08-30
|
||||
|
||||
### Fixed
|
||||
|
||||
- **`proxy=` with an `http` or `https` scheme was accepted and ignored.** The
|
||||
page went out on the host's address while the timezone, the locale and the
|
||||
WebRTC candidate had all been resolved through the proxy, so the session
|
||||
announced one country and connected from another. That is worse than having
|
||||
no proxy: it is the mismatch this package exists to avoid, produced by the
|
||||
package. SOCKS was unaffected, which is why it went unnoticed.
|
||||
|
||||
The cause was three ways of expressing one thing, with the scheme choosing
|
||||
between them: SOCKS wrote `network.proxy.*` preferences, HTTP was handed to
|
||||
the Playwright driver to route per channel, and HTTP without a driver got
|
||||
different preferences again. Removing the Node driver removed the middle one
|
||||
and nothing said so. The other two are now gone rather than repaired: the
|
||||
endpoint is read once and routed by the engine command, for every scheme. A
|
||||
proxy that cannot be expressed refuses the launch instead of starting a
|
||||
browser without it. Reported from outside, with a 24-site case study behind
|
||||
it.
|
||||
- **SOCKS proxies that require a username and password could not connect at
|
||||
all.** The credentials reached the engine's channel filter and stopped there,
|
||||
so the browser offered "no authentication" and the proxy closed the
|
||||
connection. The symptom was a connection refused, which reads like a dead
|
||||
proxy rather than a missing password. Needs the matching engine release.
|
||||
- **`profile_dir=` raised `KeyError: 'browser'`.** A persistent context never
|
||||
opened: the reply carried the context and not the browser, and the client
|
||||
reads both.
|
||||
|
||||
### Changed
|
||||
|
||||
- Pins `invisible-core` 24.16.0, which seals the `firefox-24` engine. The proxy
|
||||
credentials fix lives in the engine, so on an older binary that one is inert.
|
||||
|
||||
## [0.8.0] - 2026-08-30
|
||||
|
||||
### Removed
|
||||
|
||||
+4629
File diff suppressed because it is too large.
Load diff
@@ -23,6 +23,14 @@ Anti-bots ask two questions, and reCAPTCHA, hCaptcha and Cloudflare Turnstile sc
|
||||
- Every click, hover and drag follows a natural mouse path with human timing, no teleporting cursor.
|
||||
- Each input is byte-identical to a real mouse: real input source, pressure, trusted events.
|
||||
|
||||
**And one thing the stock driver cannot do.** Playwright's own documentation says
|
||||
"Closed-mode shadow roots are not supported", and measured on 2026-09-05 against a page
|
||||
carrying one open and one closed root, stock Playwright returned zero matches for the
|
||||
closed content in Firefox and in Chromium alike. This engine returns the element, while
|
||||
the page still reads `null` from `element.shadowRoot`, so nothing observable to the page
|
||||
changes. The three-arm table and the page that reproduces it:
|
||||
[closed shadow roots](https://github.com/feder-cr/invisible_playwright/wiki/closed-shadow-root-playwright).
|
||||
|
||||
Driven by the standard Playwright API. Full breakdown: [feder-cr/firefox_antidetect_patch](https://github.com/feder-cr/firefox_antidetect_patch).
|
||||
|
||||
---
|
||||
@@ -36,11 +44,27 @@ Once the browser is handled it stops being the variable. If you are still gettin
|
||||
|
||||
```bash
|
||||
pip install invisible-playwright
|
||||
python -m invisible_playwright fetch # one-time ~238 MB download (~544 MB unpacked), sha256-verified
|
||||
python -m invisible_playwright fetch # one-time download, sha256-verified: 240 MB (Windows) / 262 MB (Linux x86_64) / 253 MB (Linux arm64), about 550 MB unpacked
|
||||
```
|
||||
|
||||
Requires **Python 3.11 or newer**.
|
||||
|
||||
Supported platforms: **Windows x86_64**, **Linux x86_64 / arm64**. macOS is no longer supported (releases stopped at firefox-20); on a Mac the package refuses at launch with a clear message rather than downloading a binary that no longer exists.
|
||||
|
||||
### If you would rather prompt than script
|
||||
|
||||
This page is the engine, as a Python library. There are two ways to use it
|
||||
without writing code, and both are one line:
|
||||
|
||||
- **From an MCP client you already have** (Claude Code, Claude Desktop,
|
||||
Cursor): `claude mcp add stealth -- uvx aihawk`. See
|
||||
[the MCP server page](https://github.com/feder-cr/AIHawk/wiki/mcp-server).
|
||||
- **With an interface and a model included**, needing only an OpenRouter key:
|
||||
`uvx aihawk ui --openrouter-key sk-or-...`. See
|
||||
[AIHawk](https://github.com/feder-cr/AIHawk).
|
||||
|
||||
Same engine underneath, and the second is a client of the first.
|
||||
|
||||
---
|
||||
|
||||
## Usage
|
||||
@@ -183,6 +207,16 @@ is the map most other pages link back to, [Playwright detected as a bot on one s
|
||||
is the troubleshooting order, and [navigator.webdriver is not the tell you think it is](docs/navigator-webdriver-explained.md)
|
||||
explains the most famous property in this space and why patching it alone buys you
|
||||
almost nothing.
|
||||
|
||||
The detectors section now covers the commercial anti-bot products by name, each
|
||||
read from its own documentation or from confirmed reverse engineering:
|
||||
[Cloudflare Bot Management](docs/cloudflare-bot-management-explained.md) and
|
||||
[Turnstile](docs/cloudflare-turnstile-explained.md),
|
||||
[DataDome](docs/datadome-explained.md), [Kasada](docs/kasada-explained.md),
|
||||
[Akamai Bot Manager](docs/akamai-bot-manager-explained.md),
|
||||
[PerimeterX](docs/perimeterx-explained.md), [hCaptcha](docs/hcaptcha-explained.md),
|
||||
[Imperva](docs/imperva-incapsula-explained.md), and
|
||||
[the rest of the set](docs/guides-detectors-explained.md).
|
||||
- [crawl4ai stealth and custom browser engines](docs/crawl4ai-stealth-custom-browser.md) - browser_type accepts firefox but there is no executable_path; where the adapter seam is
|
||||
- [Why headless browsers render different fonts](docs/headless-fonts-differ.md) - the three causes, the per-platform font sets, and why the fix is not installing more fonts
|
||||
- [How to make Linux and macOS report real Windows fonts](docs/bundled-fonts-cross-platform.md) - one manifest, three font backends convinced not to ask the host, and the four seams still open
|
||||
@@ -197,7 +231,18 @@ almost nothing.
|
||||
|
||||
## Related projects
|
||||
|
||||
The open-source neighbours, and what each one is for.
|
||||
**The other pieces of this one.** The engine is the middle of three, and the
|
||||
two around it are how most people reach it:
|
||||
|
||||
- **[invisible_core](https://github.com/feder-cr/invisible_core)** - seed to
|
||||
fingerprint to preferences, plus proxy and geolocation. This package pins it.
|
||||
- **[AIHawk](https://github.com/feder-cr/AIHawk)** - this engine as an MCP
|
||||
server (`uvx aihawk`, for any client that brings its own
|
||||
model) and, in the same package, an interface with a model included, from
|
||||
one command. The interface is a client of the server, with no private path
|
||||
to the browser.
|
||||
|
||||
**The open-source neighbours**, and what each one is for.
|
||||
|
||||
**On the Firefox side**
|
||||
|
||||
@@ -245,5 +290,6 @@ This project is for educational purposes only. It is provided as-is, with no war
|
||||
<a href="https://github.com/feder-cr/invisible_playwright/blob/main/LICENSE"><img src="https://raw.githubusercontent.com/feder-cr/invisible_playwright/main/docs/badges/license.svg" alt="License: MIT"></a>
|
||||
<a href="https://www.python.org/downloads/"><img src="https://raw.githubusercontent.com/feder-cr/invisible_playwright/main/docs/badges/python.svg" alt="Python 3.11+"></a>
|
||||
<a href="https://github.com/feder-cr/firefox_antidetect_patch/releases"><img src="https://raw.githubusercontent.com/feder-cr/invisible_playwright/main/docs/badges/firefox.svg" alt="Firefox 151.0"></a>
|
||||
<img src="https://raw.githubusercontent.com/feder-cr/invisible_playwright/badges/docs/badges/launches.svg" alt="browser launches">
|
||||
<a href="https://github.com/feder-cr/invisible_playwright/stargazers"><img src="https://raw.githubusercontent.com/feder-cr/invisible_playwright/badges/docs/badges/stars.svg" alt="GitHub stars"></a>
|
||||
</p>
|
||||
@@ -72,7 +72,7 @@ see is a header an injection cannot fix.
|
||||
|
||||
## How this project keeps header and property in agreement
|
||||
|
||||
Because the fingerprint is applied at the browser level rather than in the page, the
|
||||
Because the fingerprint is applied at the browser level, not in the page, the
|
||||
language is set through the same native preference a real profile uses, so both surfaces
|
||||
read from it. There is nothing to inject into the page and nothing to keep in sync: the
|
||||
header and the array are the same value formatted twice, by the browser, the way they
|
||||
@@ -98,7 +98,7 @@ failure be replayed instead of guessed at.
|
||||
|
||||
## Prove they match, do not assume it
|
||||
|
||||
The point of this page is a check you can run rather than a claim to trust. Capture the
|
||||
The point of this page is a check you can run, not a claim to trust. Capture the
|
||||
`Accept-Language` header the browser actually sent, read `navigator.languages` from the
|
||||
loaded page, and compare the two directly. Use any endpoint that echoes request headers
|
||||
back; the snippet below reads the header off the outgoing request instead, so it needs no
|
||||
@@ -132,7 +132,7 @@ with InvisiblePlaywright(seed=42) as browser:
|
||||
|
||||
Follow the method from
|
||||
[how to test whether your browser is detected](how-to-test-bot-detection.md): assert the
|
||||
values are present and agree, rather than asserting nothing looks wrong. A property that
|
||||
values are present and agree, not asserting nothing looks wrong. A property that
|
||||
comes back empty, or a header your capture never saw, is a failure and not a pass. Run it
|
||||
against a stock browser on the same machine too, and the header and array should match
|
||||
there in exactly the same way.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "AI agent retry loops trip rate limits, not fingerprints"
|
||||
description: "Why AI agent retry loops multiply requests into a volume signal that trips rate limits, and why throttling belongs in the agent loop, not the browser engine."
|
||||
description: "Retry and re-plan loops multiply requests into a volume signal; throttling belongs in the agent loop. This page moved to the AIHawk wiki."
|
||||
parent: "AI Agents and Frameworks"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 17
|
||||
@@ -9,213 +9,16 @@ nav_order: 17
|
||||
|
||||
# AI agent retry loops trip rate limits, not fingerprints
|
||||
|
||||
An agent that gets a browser to look like a real person will still get blocked if it
|
||||
asks for a page thirty times in ten seconds. That block has nothing to do with the
|
||||
fingerprint. It is a counter.
|
||||
This page moved to the AIHawk wiki, where the agent-experience content now
|
||||
lives:
|
||||
|
||||
This page is about the failure mode that a perfect disguise does not touch: an agent
|
||||
retries and re-plans on failure, every retry is another request, and a stack of retries
|
||||
per second is a volume and behaviour signal that trips rate limits and quotas long
|
||||
before any fingerprint check runs. The fix does not live in the browser. It lives in
|
||||
the loop that drives it.
|
||||
**[Agent retry loops trip rate limits, not fingerprints](https://github.com/feder-cr/AIHawk/wiki/agent-retry-loops-rate-limits)**
|
||||
|
||||
## Why an agent makes more traffic than a scraper
|
||||
The one-paragraph version: an agent that retries and re-plans multiplies its
|
||||
requests, and volume is scored server-side against your address and account.
|
||||
No browser property changes a request count. Throttle in the loop that
|
||||
produces the requests.
|
||||
|
||||
A hand-written scraper visits a known list of URLs once. An agent does not. It observes
|
||||
a page, decides a next action, acts, and when the action fails it re-plans and tries
|
||||
again. That control loop is the whole point of an agent, and it is also a request
|
||||
multiplier.
|
||||
|
||||
Three things stack up:
|
||||
|
||||
- **Retries.** A transient error, a slow load, a missing element, and the agent tries
|
||||
the same step again. One logical action becomes three or five HTTP requests.
|
||||
- **Re-planning.** When a step fails the agent often re-reads the page, or reloads it,
|
||||
or navigates back and forward to re-orient. Each of those is a fresh visit to a URL a
|
||||
human would have loaded once.
|
||||
- **Exploration.** An agent that does not know the site's layout probes it: opens a
|
||||
page to see what is there, backs out, opens another. A person who knows what they want
|
||||
does not.
|
||||
|
||||
The result is that a single high-level task ("find the price of item X") can produce
|
||||
ten or twenty page loads, most of them to the same few URLs, in a burst measured in
|
||||
seconds. That pattern is trivial to count, and counting is exactly what a rate limiter
|
||||
does.
|
||||
|
||||
## Rate limits read volume, not the browser
|
||||
|
||||
A fingerprint check and a rate limit answer two different questions, and a convincing
|
||||
disguise only answers one of them: one asks whether this browser is real, the other only
|
||||
counts how many requests just arrived.
|
||||
|
||||
A fingerprint check reads properties of the browser: the GPU string, the canvas hash,
|
||||
the font list, the TLS handshake. It asks "is this a real browser". invisible_playwright
|
||||
is built to make that answer yes, which is why it passes most of that class of check:
|
||||
the engine is a genuine Firefox patched at the C++ level, so the values are real rather
|
||||
than spoofed on top of a headless build.
|
||||
|
||||
A rate limit reads something completely different: how many requests arrived from this
|
||||
address, this account, or this session, in this window. It does not open the browser at
|
||||
all. It increments a counter and compares it to a threshold. The request could come from
|
||||
the most convincing browser ever built and the counter would go up by exactly one.
|
||||
|
||||
So the two defences are orthogonal:
|
||||
|
||||
| Signal | What it reads | Does a real-looking browser help |
|
||||
|---|---|---|
|
||||
| Fingerprint / driver / TLS | Properties of the client | Yes - this is what the engine is for |
|
||||
| Rate limit / quota | Count of requests over time | No - N requests is N requests |
|
||||
| Per-account quota | Actions tied to one identity | No - the account is the unit, not the browser |
|
||||
| Behaviour / velocity | Timing and shape of the traffic | No - the loop decides the timing |
|
||||
|
||||
The bottom three rows are not something an engine can fix, because the engine only
|
||||
controls what one request looks like, not how many of them you send or how fast. That is
|
||||
a property of the loop.
|
||||
|
||||
## Put the budget in the loop, not the engine
|
||||
|
||||
The consequence is a design rule: **backoff, throttling and a request budget belong in
|
||||
the agent loop.** No browser setting throttles an agent that has been told to retry
|
||||
until it succeeds.
|
||||
|
||||
Three controls cover most of it:
|
||||
|
||||
- **Exponential backoff on retry.** When a step fails, wait, and wait longer each time,
|
||||
instead of retrying immediately. A failed request answered by an instant identical
|
||||
request is the clearest velocity signal there is.
|
||||
- **A hard request budget.** Cap the number of requests per task and per unit of time.
|
||||
When the budget is spent, stop and surface the failure rather than letting the loop
|
||||
spend the site's patience for you.
|
||||
- **A cap on re-plans.** Bound how many times the agent may re-read or reload the same
|
||||
URL before it gives up. An unbounded re-plan loop is an accidental refresh storm.
|
||||
|
||||
The unit to think in is requests per minute from one address and one account, not
|
||||
requests per browser. Ten agents behind one exit IP each politely pacing themselves are,
|
||||
to the counter, one very busy client.
|
||||
|
||||
## A retry loop that backs off
|
||||
|
||||
Here is the two-line launch plus a retry wrapper that carries a budget and backs off.
|
||||
The browser is a stealth Firefox; the throttling is plain Python, because that is where
|
||||
it has to be.
|
||||
|
||||
```python
|
||||
import time
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
def fetch_with_budget(page, url, *, max_attempts=4, budget):
|
||||
"""Load url with exponential backoff. Raises when the budget is spent."""
|
||||
for attempt in range(max_attempts):
|
||||
if budget["spent"] >= budget["limit"]:
|
||||
raise RuntimeError("request budget exhausted; stopping instead of retrying")
|
||||
budget["spent"] += 1
|
||||
try:
|
||||
page.goto(url, wait_until="domcontentloaded")
|
||||
return page
|
||||
except Exception:
|
||||
if attempt == max_attempts - 1:
|
||||
raise
|
||||
backoff = 2 ** attempt # 1s, 2s, 4s, ...
|
||||
time.sleep(backoff)
|
||||
return page
|
||||
|
||||
budget = {"spent": 0, "limit": 30} # hard cap for the whole task
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
fetch_with_budget(page, "https://example.com", budget=budget)
|
||||
# ... agent observes, decides, acts; every navigation goes through the budget
|
||||
```
|
||||
|
||||
The `browser` returned is a real Playwright
|
||||
[`Browser`](https://playwright.dev/python/docs/api/class-browser), so every standard
|
||||
method works unchanged - `new_page`, `goto`, `click`, `wait_for_selector`. The stealth is
|
||||
in the engine; the pacing is in `fetch_with_budget`. Nothing about `seed=42` slows the loop
|
||||
down, and nothing about the loop changes the fingerprint. They are separate jobs.
|
||||
|
||||
Pacing the actions themselves matters too, because uniform, machine-fast timing is its
|
||||
own tell independent of volume. That is the subject of
|
||||
[the pause shaped like model latency](ai-browser-agents-stealth.md), and it is worth
|
||||
reading alongside this page: one is about how many requests, the other about their
|
||||
shape.
|
||||
|
||||
## What invisible_playwright fixes, and what it does not
|
||||
|
||||
The honest split, because overclaiming here is both wrong and a way to get someone
|
||||
blocked while they trust a promise that was never true.
|
||||
|
||||
**What the engine handles.** The fingerprint, driver and TLS layers read as a genuine
|
||||
Firefox, so the class of check that asks "is this a real browser driven by a real
|
||||
person" mostly answers yes. That is measurable: on the public tampering suites a session
|
||||
comes back internally consistent rather than flagged, and the same seed produces the
|
||||
same machine every run so a failure is reproducible.
|
||||
|
||||
**What you supply.** The engine does not change your IP's reputation, it does not create
|
||||
per-account quota out of nothing, it does not slow your loop down, and it does not shape
|
||||
your timing. Those are yours to bring:
|
||||
|
||||
- A clean exit, because a real-looking browser on a
|
||||
[datacenter IP is still on a datacenter IP](can-websites-detect-a-datacenter-proxy-ip.md),
|
||||
and a counter on the address does not care how good the browser is.
|
||||
- Human pacing, from the loop, using the controls above.
|
||||
- Respect for the account's own limits, which are counted against the identity and not
|
||||
the browser.
|
||||
|
||||
Put plainly: invisible_playwright makes each request look like it came from a real
|
||||
person. It does not make a thousand requests look like one. That second job is the
|
||||
loop's, and no engine setting will do it for you. When a clean fingerprint still gets
|
||||
blocked, volume and address are the usual reasons -
|
||||
[which is a page of its own](why-blocked-with-a-clean-fingerprint.md).
|
||||
|
||||
## Conclusion
|
||||
|
||||
Retries and re-planning are what make an agent an agent, and they are also what turn one
|
||||
task into a burst of requests. A burst is counted, and a counter is a different defence
|
||||
from a fingerprint check: the most convincing browser in the world still increments it by
|
||||
one per request. So the throttle cannot live in the engine. Give the loop a budget, back
|
||||
off on failure, cap the re-plans, and put a clean exit under it. The browser's job is to
|
||||
make each request real; keeping the requests few and well-spaced is yours.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Will a stealth browser stop my agent from being rate limited?** No. Rate limits count
|
||||
requests; they do not inspect the browser. A real-looking fingerprint helps with
|
||||
detection, not with volume.
|
||||
|
||||
**Why does my agent get blocked when a manual visit works fine?** Almost always because
|
||||
the agent sent many more requests, much faster, than the person did. Retries and reloads
|
||||
multiply traffic that a human never generates.
|
||||
|
||||
**Where should backoff and throttling live?** In the agent loop, not the engine. No
|
||||
browser setting paces an agent that was told to retry until it succeeds.
|
||||
|
||||
**Does the seed or fingerprint affect how fast I can go?** No. The seed controls the
|
||||
identity, not the timing. Speed and request count are decided entirely by your loop.
|
||||
|
||||
**Is a per-account quota a fingerprint problem?** No. A quota is counted against the
|
||||
identity or the account, not the browser, so a better fingerprint does nothing for it.
|
||||
Budget the actions instead.
|
||||
|
||||
**How many requests per minute is safe?** There is no universal number; it depends on
|
||||
the site. The safe habit is a hard budget per task and per window, plus backoff, so a
|
||||
failing loop stops itself rather than accelerating.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's own velocity flag, raised against invisible_playwright during testing,
|
||||
which turned out to be the test harness hammering one scoring endpoint from one
|
||||
address - the same volume signal described here, produced by our own gate.
|
||||
- The wrapper's documented API (`InvisiblePlaywright`, seed reproducibility, a real
|
||||
[Playwright `Browser`](https://playwright.dev/python/docs/api/class-browser) return)
|
||||
as shipped, used verbatim in the example above.
|
||||
|
||||
**See also:** [the pause shaped like model latency](ai-browser-agents-stealth.md) for
|
||||
the timing side of the same problem, [how to rate limit your scraper](how-to-rate-limit-your-scraper-playwright.md)
|
||||
for the pacing mechanics in detail, and [what actually detects an agent](browser-use-detection.md)
|
||||
across the layers a fingerprint does not cover.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The velocity flag that
|
||||
started this page was ours, and it belonged to the harness, not the browser.*
|
||||
Related mechanism pages that stay on this wiki:
|
||||
[why you can be blocked with a clean fingerprint](why-blocked-with-a-clean-fingerprint.md)
|
||||
and [ASN and IP reputation in bot detection](asn-and-ip-reputation-in-bot-detection.md).
|
||||
+13
-216
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "Why AI browser agents have their own timing signal"
|
||||
description: "An LLM loop emits machine-regular action gaps and instant pointer jumps - a behavioral signal no fingerprint fixes. Where pacing and dwell time live in your code."
|
||||
description: "An LLM loop emits machine-regular action gaps and instant pointer jumps - a behavioral signal no fingerprint fixes. This page moved to the AIHawk wiki."
|
||||
parent: "AI Agents and Frameworks"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 10
|
||||
@@ -9,221 +9,18 @@ nav_order: 10
|
||||
|
||||
# Why AI browser agents have their own timing signal
|
||||
|
||||
A stealth engine can make your browser read as a genuine Firefox down to the TLS
|
||||
handshake, and an AI agent driving it can still stand out for a reason that has nothing
|
||||
to do with the browser at all: the rhythm of the loop that controls it.
|
||||
This page moved to the AIHawk wiki, where the agent-experience content now
|
||||
lives:
|
||||
|
||||
An LLM agent runs a think-act cycle. It looks at the page, decides on an action, emits
|
||||
the action, waits for the result, and looks again. That cycle has a shape, and the shape
|
||||
is measurable. The gaps between actions cluster around the model's latency, the actions
|
||||
themselves land effectively instantly, and the pointer arrives at each target without a
|
||||
human's approach, overshoot or correction. None of that is in the fingerprint. It is a
|
||||
separate signal, orthogonal to every value a fingerprinting page reads, and a site can
|
||||
check it on its own.
|
||||
**[The timing signal AI agents give off](https://github.com/feder-cr/AIHawk/wiki/ai-agent-timing-signal)**
|
||||
|
||||
This page is about that signal: what produces it, why a clean fingerprint does not
|
||||
touch it, and where the fix has to live, which is in your code and not in the engine.
|
||||
The short version it still owes you here: a think-act loop pauses for model
|
||||
latency, and that pause repeats with a regularity no human produces. The
|
||||
pointer arc between actions is the engine's job, and this engine humanises it;
|
||||
the step-to-step rhythm is produced by the agent loop, which no fingerprint
|
||||
work reaches.
|
||||
|
||||
## What the timing signal actually is
|
||||
|
||||
Behaviour is a fingerprint of a different kind. A fingerprinting page reads static
|
||||
properties: the GPU string, the font list, the canvas hash. A behavioural check reads
|
||||
the stream of events a session produces over time: when clicks happen relative to each
|
||||
other, how a pointer travels between two points, how long a value takes to type, whether
|
||||
anything is read before it is acted on.
|
||||
|
||||
A human session is full of small irregularities. There is a pause to read that varies
|
||||
from a second to several. The pointer curves toward a target, arrives a little off, and
|
||||
corrects. Typing has an uneven cadence with the occasional longer gap. Time is spent on
|
||||
the page doing nothing measurable.
|
||||
|
||||
An agent loop, left to its own timing, produces almost none of that. The interesting
|
||||
part is that this is true even when the engine underneath is perfect, which is what makes
|
||||
it worth a page of its own.
|
||||
|
||||
## Why a perfect fingerprint does not touch it
|
||||
|
||||
invisible_playwright is designed to look like a real browser driven by a real person, and
|
||||
that is why it passes most detection checks: the engine fingerprint, the TLS handshake and
|
||||
the driver layer all read as a genuine Firefox rather than an automated one. That is a real
|
||||
result and it is most of what people are blocked for.
|
||||
|
||||
It is also not everything. The same honesty that makes the product worth using means being
|
||||
clear about the edges: on its own it does not fix IP reputation, per-account quotas, rate
|
||||
limits, or behaviour. Those are supplied by you, a clean exit and human pacing among them.
|
||||
The timing signal is squarely in that last category. The engine controls what the browser
|
||||
*is*; it does not control the cadence at which your loop decides to act, because that cadence
|
||||
is produced above the browser, in the code that calls it.
|
||||
|
||||
Put differently: a fingerprint is a photograph and behaviour is a motion study. Making the
|
||||
photograph perfect does nothing to the motion study, and the two are read by different parts
|
||||
of a detection system. This is the same reason the [testing method that catches false
|
||||
passes](how-to-test-bot-detection.md) lists behaviour among the things no in-page suite
|
||||
covers.
|
||||
|
||||
## What the loop leaks: gaps and pointer jumps
|
||||
|
||||
Two specifics, because they are the ones an agent produces without meaning to.
|
||||
|
||||
**Inter-action gaps that cluster.** Between one action and the next sits a wait for the
|
||||
model to respond. That wait is not random the way a human pause is; it clusters around
|
||||
whatever the model's latency happens to be, run after run. A distribution of gaps that is
|
||||
tight and repeatable, rather than the broad, ragged spread a person produces, is itself the
|
||||
tell. It does not matter that the individual number looks plausible. The *shape* of the
|
||||
distribution is the signal.
|
||||
|
||||
**Actions that land instantly, and pointers that jump.** When an agent decides to click a
|
||||
coordinate, the naive path is to dispatch the click at that coordinate with no travel and
|
||||
no dwell. The pointer teleports from wherever it was to the target, and the action fires
|
||||
with zero read time in front of it. A form filled field by field with no gaps, a click on
|
||||
an element the instant it appears, a pointer that never passes through the space between two
|
||||
targets: each is a motion no hand produces. The [detected-on-one-site checklist](playwright-detected-as-bot.md)
|
||||
reaches this at step five, after the machine and the automation tells, because it is what is
|
||||
left once the browser itself is clean.
|
||||
|
||||
invisible_playwright does smooth one piece of this for you: a click arcs the pointer to the
|
||||
target on a Bezier curve rather than teleporting, so an individual click's *path* is
|
||||
human-shaped. What it cannot smooth is the *cadence* between your actions and the dwell time
|
||||
in front of them, because your loop, not the browser, decides when the next action happens.
|
||||
|
||||
## Pacing and pointer motion live in your code, not the engine
|
||||
|
||||
The consequence is a division of labour, and it is a clean one.
|
||||
|
||||
The engine owns the browser identity: the fingerprint, the TLS layer, the driver surface.
|
||||
You own the rhythm: how long to dwell before acting, how much to vary the gap between
|
||||
actions, whether to read the page before touching it. No engine can supply the rhythm for
|
||||
you, because the rhythm is produced by the loop calling the engine, and that loop is yours.
|
||||
|
||||
Concretely, that means adding pacing and dwell to the code between your actions rather than
|
||||
expecting the browser to add it underneath. Here is the minimal shape, using the real
|
||||
two-line launch and standard Playwright methods on the returned browser:
|
||||
|
||||
```python
|
||||
import random
|
||||
import time
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
|
||||
def dwell(low=0.6, high=2.4):
|
||||
"""A varied pause, the kind reading and deciding actually produces."""
|
||||
time.sleep(random.uniform(low, high))
|
||||
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
|
||||
dwell(1.2, 3.0) # read before acting, not act on arrival
|
||||
page.click("#open") # the engine arcs the pointer on a Bezier curve
|
||||
|
||||
dwell()
|
||||
for ch in "a search phrase": # per-key rhythm, not one instant fill
|
||||
page.keyboard.type(ch)
|
||||
time.sleep(random.uniform(0.04, 0.19))
|
||||
|
||||
dwell()
|
||||
page.click("#submit")
|
||||
```
|
||||
|
||||
The `browser` returned by `InvisiblePlaywright` is a real Playwright `Browser`, so every
|
||||
method is the one you already know; the `seed=42` makes the identity reproducible so a run
|
||||
that gets flagged can be replayed exactly. The only thing added above the plain automation is
|
||||
the pacing, and that is the point: it has to be added, because it is the part the engine
|
||||
cannot produce for you.
|
||||
|
||||
A note on doing it well. Uniform delays are their own tell. `time.sleep(1.0)` between every
|
||||
action just moves the cluster from "instant" to "exactly one second", and a tight cluster at
|
||||
one second is as machine-regular as a tight cluster at zero. Vary the pauses, make them
|
||||
depend on what the step is doing (a long read before a decision, a short gap between two
|
||||
keystrokes), and avoid the same number twice. The goal is the ragged, context-dependent
|
||||
spread a person produces, not a constant with a label on it.
|
||||
|
||||
## Measuring your own rhythm before a site does
|
||||
|
||||
You can read this signal off your own agent the same way a site would, which is the honest
|
||||
way to know whether your pacing is doing anything. Record a timestamp at each action, then
|
||||
look at the distribution of the gaps.
|
||||
|
||||
```python
|
||||
import time
|
||||
|
||||
timestamps = []
|
||||
|
||||
|
||||
def mark():
|
||||
timestamps.append(time.monotonic())
|
||||
|
||||
|
||||
# call mark() immediately before each page action, then afterward:
|
||||
gaps = [b - a for a, b in zip(timestamps, timestamps[1:])]
|
||||
print("count:", len(gaps))
|
||||
print("min / max:", round(min(gaps), 3), round(max(gaps), 3))
|
||||
print("mean:", round(sum(gaps) / len(gaps), 3))
|
||||
```
|
||||
|
||||
If the min and max are close together, or the mean sits right on top of your model's
|
||||
typical response time, your loop is emitting the clustered distribution described above and
|
||||
the pacing is not varied enough yet. A human trace has a wide spread and a long tail. This is
|
||||
the same instinct as reading the fingerprint report field by field rather than trusting a
|
||||
verdict: measure the actual stream, do not assume the shape. For the related case of an agent
|
||||
whose pauses line up with tool latency in a devtools context, see
|
||||
[timing detection through the debugger](debugger-timing-detection.md).
|
||||
|
||||
## Conclusion
|
||||
|
||||
The engine fingerprint and the agent's rhythm are two different signals, read by two
|
||||
different parts of a detection system, and a stealth browser addresses the first and not the
|
||||
second. invisible_playwright makes the browser read as a genuine person's Firefox, which is
|
||||
why it clears most checks; the cadence of your think-act loop is produced above the browser,
|
||||
so pacing, dwell time and read-before-act have to live in your own code. Add them
|
||||
deliberately, vary them so they are not merely a slower constant, and measure your own trace
|
||||
the way a site would. That is the honest division of labour, and it is the one that holds up.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does a stealth browser hide that I am an AI agent?** It hides that the browser is
|
||||
automated. It does not hide the rhythm of your control loop, which is a separate signal you
|
||||
produce above the browser.
|
||||
|
||||
**What is the timing signal, exactly?** The gaps between your actions cluster around the
|
||||
model's latency instead of spreading like a human's pauses, and actions land instantly with
|
||||
pointers that jump straight to targets. Both are visible without reading any fingerprint.
|
||||
|
||||
**Can invisible_playwright fix my pacing for me?** No, and no engine can. It smooths an
|
||||
individual click's pointer path on a Bezier curve, but the cadence between actions is decided
|
||||
by your loop, so pacing and dwell have to live in your code.
|
||||
|
||||
**Do I just add a fixed sleep between actions?** That helps with "instant" but creates a new
|
||||
tell: a tight cluster at one second is as regular as a tight cluster at zero. Vary the pauses
|
||||
and make them depend on the step.
|
||||
|
||||
**Will fixing the timing get me past everything?** No. Behaviour is one signal among several.
|
||||
A clean rhythm on a bad IP, over quota, or against a rate limit still fails; those are yours
|
||||
to supply too, a clean exit and sane request volume among them.
|
||||
|
||||
**How do I know if my rhythm looks robotic?** Record a timestamp at each action and look at
|
||||
the spread of the gaps. If min and max are close, or the mean sits on your model's response
|
||||
time, the distribution is too tight.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's own testing notes, which list behaviour and the pause shaped like model
|
||||
latency among the things no in-page suite covers.
|
||||
- Standard Playwright's documented [`Browser`](https://playwright.dev/python/docs/api/class-browser),
|
||||
[`Page`](https://playwright.dev/python/docs/api/class-page) and
|
||||
[`Keyboard`](https://playwright.dev/python/docs/api/class-keyboard) methods, used unchanged
|
||||
on the browser this wrapper returns.
|
||||
- The behavioural step of this set's detected-on-one-site checklist, which reaches pointer
|
||||
motion and typing cadence after the browser itself is clean.
|
||||
|
||||
**See also:** [what fits and what does not for AI browser agents](ai-browser-agents-stealth.md),
|
||||
[why a CDP-driven agent has a tell of its own](browser-use-detection.md), and
|
||||
[testing bot detection without a false pass](how-to-test-bot-detection.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The engine makes the browser
|
||||
real; the rhythm is yours to write, and this page is the part I keep having to add back into
|
||||
my own agent loops.*
|
||||
The mechanism layer stays on this wiki:
|
||||
[mouse-dynamics behavioural biometrics](mouse-dynamics-behavioural-biometrics.md),
|
||||
[keystroke timing detection](keystroke-timing-detection-playwright.md), and
|
||||
[human-like mouse movement](human-mouse-movement.md).
|
||||
@@ -69,7 +69,7 @@ and `headless` on `BrowserProfile`. The surrounding code is Chrome executable di
|
||||
and Chrome profile handling, and the channel type is a Chromium channel.
|
||||
|
||||
The useful move there is pointing `executable_path` at your **real installed Chrome**
|
||||
rather than the bundled Chromium, and pointing `user_data_dir` at a profile that has been
|
||||
instead of the bundled Chromium, and pointing `user_data_dir` at a profile that has been
|
||||
used. [The full version is here](browser-use-detection.md).
|
||||
|
||||
## Stagehand
|
||||
@@ -77,7 +77,7 @@ used. [The full version is here](browser-use-detection.md).
|
||||
Exposes `executablePath` and documents it, which is more than most. The rest of the
|
||||
codebase is CDP: local CDP discovery, CDP tailing, a CDP client. Chromium references
|
||||
outnumber Firefox ones by a wide margin, and the Firefox mentions are in an OpenAPI
|
||||
schema and a client for someone else's API rather than in a launch path.
|
||||
schema and a client for someone else's API, not in a launch path.
|
||||
|
||||
So the option exists and it expects a Chromium build.
|
||||
|
||||
@@ -97,7 +97,7 @@ documentation notes does not support Firefox, so that combination is largely ine
|
||||
## Maxun
|
||||
|
||||
Playwright is in the manifest and no executable path is exposed. As a no-code platform
|
||||
that is a coherent product decision rather than an oversight.
|
||||
that is a coherent product decision instead of an oversight.
|
||||
|
||||
## What applies regardless of the engine
|
||||
|
||||
@@ -213,11 +213,22 @@ Chromium build.
|
||||
differently about the GPU, the fonts, the audio device and the screen. The agent is
|
||||
identical.
|
||||
|
||||
**How do you make an AI agent undetectable?** You do not, as a single setting. Three
|
||||
separate problems each need their own fix: the engine fingerprint (what patching Firefox
|
||||
at the C++ level answers), the machine surfaces a container gives away regardless of
|
||||
engine (GPU, fonts, audio, screen), and the agent loop's own rhythm, which no fingerprint
|
||||
patch touches. Fixing only the first and calling the agent undetectable is the mistake
|
||||
this whole page is about.
|
||||
|
||||
**Which AI agent framework is most stealth-friendly?** The question is usually the wrong
|
||||
one. Pick on the agent loop, then fix the machine, then consider the engine.
|
||||
|
||||
**Is there any agent route to an engine-level fingerprint?** MCP, through Microsoft's own
|
||||
Playwright MCP server, which takes a browser and an executable path.
|
||||
**Is there any agent route to an engine-level fingerprint?** Two, and they are not
|
||||
equivalent. `uvx aihawk` launches through the engine, so the
|
||||
seeded profile and the humanised pointer come with it. Microsoft's own Playwright
|
||||
MCP server takes a browser and an executable path, which runs the engine but
|
||||
carries no `firefox_user_prefs`, so every session on a given build shares one
|
||||
identity.
|
||||
|
||||
**See also:** [browser-use in detail](browser-use-detection.md),
|
||||
[crawl4ai in detail](crawl4ai-stealth-custom-browser.md),
|
||||
|
||||
@@ -0,0 +1,253 @@
|
||||
---
|
||||
title: "How Akamai Bot Manager actually works"
|
||||
description: "Akamai's own documentation plus a real GitHub issue, read together: what the sensor collects, how the _abck cookie and Bot Score work, and why a matching TLS/JA3/JA4 fingerprint was not enough to pass it."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 27
|
||||
---
|
||||
|
||||
|
||||
# How Akamai Bot Manager actually works
|
||||
|
||||
Akamai Bot Manager is not one check, it is a scoring pipeline. A JavaScript sensor
|
||||
collects on the order of a hundred browser and device signals, encodes them into a
|
||||
payload, and a server-side model combines that payload with the request's network-level
|
||||
fingerprint into a Bot Score from 0 (human) to 100 (bot). Passing one layer of that
|
||||
pipeline, even the hardest layer, does not mean you pass the rest.
|
||||
|
||||
A real, documented case makes that concrete, not theoretical. In April 2026 a
|
||||
user of [Camoufox](https://github.com/daijro/camoufox), a separate open-source project
|
||||
that also patches Firefox at the C++ level for automation, filed
|
||||
[an issue](https://github.com/daijro/camoufox/issues/555) reporting that an
|
||||
Akamai-protected site blocked their Camoufox session with a flat 403 while stock,
|
||||
unpatched Firefox driven through the same Playwright automation reached the page and a
|
||||
solvable challenge. The reporter had already checked the one thing everyone checks
|
||||
first, the TLS and HTTP/2 handshake, and it matched byte for byte. This page walks
|
||||
through how Akamai's own documentation and third-party reverse-engineering describe the
|
||||
mechanism, then works through that issue in detail, because it is the clearest public
|
||||
evidence that a matching network fingerprint is necessary and not sufficient.
|
||||
|
||||
This page is built from Akamai's own product documentation, two independent
|
||||
technical write-ups that reverse-engineered the sensor payload, and the GitHub issue
|
||||
above, all retrieved 2026-08-30. Where Akamai's own docs are deliberately vague about
|
||||
internals, which they are, the page says so instead of filling the gap with a guess.
|
||||
|
||||
## What Akamai actually scores
|
||||
|
||||
Akamai's own materials describe Bot Manager as sitting a step above basic protections,
|
||||
aimed at "APIs or transactional pages that handle things like login, signup, or
|
||||
checkout." The product page states plainly that it "generates a score from 0 (human) to
|
||||
100 (bot), looking at all anomalies, starting with the very first request," and that the
|
||||
underlying models are built from "billions of bot requests and logins daily."
|
||||
|
||||
Akamai's technical documentation names five detection methods, and only some of them
|
||||
involve a browser at all:
|
||||
|
||||
| Method | What it does |
|
||||
|---|---|
|
||||
| Akamai-validated bots | A maintained list of known bots (roughly 1,400 as of Akamai's own count), Akamai identifies them for you |
|
||||
| Custom-categorized bots | You define your own categories and rules |
|
||||
| Transparent detection | Evaluates traits of the request itself, without the client knowing it is being tested |
|
||||
| Active detection | An interaction that only a real browser typically produces |
|
||||
| Behavioral detection (Premier tier) | Movement patterns on specific endpoints like login or checkout |
|
||||
|
||||
Transparent and active detection are the two that a patched browser engine is actually
|
||||
answering. Behavioral detection is a separate problem entirely, closer to
|
||||
[mouse-dynamics biometrics](mouse-dynamics-behavioural-biometrics.md) than to anything a
|
||||
C++ patch to the rendering engine touches.
|
||||
|
||||
## The sensor pipeline, step by step
|
||||
|
||||
Akamai does not publish the internal format of what it collects; a Scrapfly write-up on
|
||||
the mechanism and a GitHub reverse-engineering project both had to work it out from the
|
||||
obfuscated client script. Read together, the pipeline looks like this:
|
||||
|
||||
1. **The sensor script loads.** One reverse-engineering write-up
|
||||
([`Edioff/akamai-analysis`](https://github.com/Edioff/akamai-analysis)) describes a
|
||||
roughly 512KB obfuscated JavaScript payload that decrypts an internal string table at
|
||||
runtime before it does anything else, which is itself a small piece of anti-analysis
|
||||
design.
|
||||
2. **Signal collection.** Both sources independently land on the same rough figure: over
|
||||
a hundred signals, grouped into device environment (screen size, color depth,
|
||||
hardware concurrency, device memory, platform), the browser API surface (navigator
|
||||
fields, plugin behavior, WebGL renderer and vendor strings, canvas rendering
|
||||
behavior), behavioral telemetry (mouse paths, click cadence, key timing, scroll
|
||||
rhythm), timing metrics (DOM milestones, script execution intervals), and the results
|
||||
of small JavaScript and Web Crypto challenges used to confirm the script actually ran
|
||||
rather than being replayed.
|
||||
3. **The payload is generated and encoded.** Described elsewhere as involving PRNG-based
|
||||
shuffling and substitution seeded from a cookie-derived hash in the newer protocol
|
||||
version, which is a deliberate anti-tampering design, not just minification.
|
||||
4. **It is posted back.** Reverse-engineering write-ups describe the payload going to a
|
||||
validation endpoint under a deployment-specific path; Akamai's own documentation does
|
||||
not publish this, consistent with treating the whole exchange as "tamper-sensitive."
|
||||
5. **The server responds with an `_abck` cookie.** Akamai's own language for it is
|
||||
"mitigation state," and it is explicit that the internal format is deployment-specific
|
||||
and "should [not be expected] to remain valid" if manually edited or reused across
|
||||
sessions.
|
||||
6. **Every later request is judged against that cookie's state**, not just against a
|
||||
fresh score. Documented failure modes include the cookie expiring, a "replay
|
||||
mismatch" when the same cookie shows up from a different IP or TLS profile, integrity
|
||||
failures from a modified cookie string, and "behavioral conflicts where cookie history
|
||||
contradicts runtime signals."
|
||||
|
||||
That last point matters for automation specifically: a session's history is part of what
|
||||
gets scored, not only its current request. A browser that looks perfect on the first
|
||||
page load and then behaves inconsistently three requests later is scored against its own
|
||||
earlier behavior, not just against a static bar.
|
||||
|
||||
## What the network layer alone tells Akamai
|
||||
|
||||
One useful breakdown of the system groups everything Akamai evaluates into roughly seven
|
||||
categories: IP reputation, TLS fingerprint consistency, HTTP protocol behavior, cookie
|
||||
state, JavaScript sensor execution, browser fingerprint integrity, and behavioral
|
||||
continuity across requests. The network-layer pieces are read the same way [JA3/JA4 and
|
||||
HTTP/2 fingerprinting are described elsewhere on this
|
||||
site](ja3-ja4-tls-fingerprint.md): TLS version, cipher and extension ordering, elliptic
|
||||
curve data for the TLS side, and SETTINGS frame values plus pseudo-header ordering
|
||||
(`:method`, `:authority`, `:scheme`, `:path`) for the HTTP/2 side.
|
||||
|
||||
That is one category out of roughly seven. Matching it removes one input to the score.
|
||||
It does not remove the other six.
|
||||
|
||||
## The case that shows "matching fingerprint" is not "passing"
|
||||
|
||||
Here is what the GitHub issue actually contains, read directly, not summarized
|
||||
from memory.
|
||||
|
||||
The reporter, running Camoufox v135.0.1-beta.24 through Playwright 1.58.0 on Linux, was
|
||||
being blocked with a flat 403 by one specific Akamai-protected site, while the same
|
||||
automated request pattern against the same site using stock Firefox through Playwright
|
||||
returned a normal page and a solvable challenge. Before filing, the reporter had already
|
||||
run the check this whole article leads with: they compared JA3, JA4, and Akamai's own
|
||||
HTTP/2 signature between the two browsers and found them identical, and confirmed the
|
||||
HTTP headers matched except for the User-Agent version string. Their own conclusion,
|
||||
stated in the issue, was that this "means detection is NOT TLS/HTTP2," and that
|
||||
"something in Camoufox's C++ patches is being detected" further up the stack.
|
||||
|
||||
The reporter also tested several other Akamai-protected sites in the same session: most
|
||||
treated both browsers identically, either passing both or blocking both, which is itself
|
||||
useful information, because it means the divergence was not a blanket Camoufox
|
||||
signature, it was specific to one deployment's tuning.
|
||||
|
||||
Working the problem, the reporter ruled out a content-blocking browser extension,
|
||||
changing the reported OS, enabling the page cache, and matching window sizes by hand,
|
||||
none of which changed the outcome. They did find one concrete inconsistency worth
|
||||
naming: Playwright reported a viewport of 1280x720, while the page's own JavaScript read
|
||||
`window.innerWidth` as 1920. A real browser does not produce that split between what the
|
||||
automation layer thinks the viewport is and what a script running inside the page reads
|
||||
back. Whether that specific mismatch was the thing Akamai's sensor actually scored, the
|
||||
issue does not settle. It is offered as a lead, not a proof.
|
||||
|
||||
The reporter also named four specific compiled patches as suspects, by filename:
|
||||
`no-css-animations.patch`, `canvas-spoofing.patch`, `font-list-spoofing.patch`, and
|
||||
`navigator-spoofing.patch`. Naming a patch as a suspect is not the same as demonstrating
|
||||
it caused the block, and nobody in the thread went on to confirm which one, or whether
|
||||
any one of them individually, was responsible.
|
||||
|
||||
What actually closed the issue was different from what anyone expected going in. Another
|
||||
user suggested trying a newer Camoufox build, version 140 or higher from an unofficial
|
||||
fork rather than the mainline release the reporter had been running. The reporter tried
|
||||
it, confirmed the previously-blocked site and the others now loaded normally, reopened
|
||||
the issue asking for the fix to land in the mainline branch, and a third participant
|
||||
noted that the mainline had since moved to a much newer Firefox base version. The issue
|
||||
is closed. No maintainer in the thread ever stated which mechanism, out of the four
|
||||
named patches, the viewport inconsistency, or something never named at all, was actually
|
||||
responsible. What is documented is that an older patched build was blocked on a network
|
||||
fingerprint that matched a passing browser, and a newer patched build on the same engine
|
||||
family was not.
|
||||
|
||||
## What this means if you patch a browser engine
|
||||
|
||||
Read narrowly, this is a story about one build lagging behind on one site. Read for the
|
||||
lesson it actually demonstrates, it is broader: engine-level patching, compiling Firefox
|
||||
or Chromium from source and setting the fingerprint in C++ rather than overriding it from
|
||||
JavaScript, narrows the gap between an automated session and a real browser. It does not
|
||||
automatically close it. The TLS and HTTP/2 layer read identical in this case, which is
|
||||
exactly the layer that
|
||||
[cannot be patched from a script and is usually the hardest thing to fake](ja3-ja4-tls-fingerprint.md),
|
||||
and Akamai still told the two sessions apart. Whatever did the telling lived somewhere
|
||||
else in that roughly-seven-category pipeline: the JavaScript-collected browser
|
||||
fingerprint, the behavioral signal, or a reputation signal tied to the session's history
|
||||
that had nothing to do with the browser at all.
|
||||
|
||||
That lesson generalizes to any project taking this approach, and it does not stop at the
|
||||
project this issue was filed against. This project also compiles Firefox from source and
|
||||
sets its fingerprint at the C++ level rather than in JavaScript, for
|
||||
[the same reasons Camoufox does](vs-camoufox.md): an injected override is a function
|
||||
whose source can be read, and a value decided below the JavaScript layer is not. That
|
||||
shared decision is a real advantage over page-level spoofing, and it is not a guarantee
|
||||
against a specific commercial detector's tuning on a specific deployment. This project
|
||||
has not been tested against the site named in that issue, and even if it had, one clean
|
||||
result would prove exactly as little as this build's years of matching TLS fingerprints
|
||||
protected it from this block. The honest position is the one this whole page has been
|
||||
building toward: a matching fingerprint at any single layer is necessary and not
|
||||
sufficient, for any tool that takes this approach, including this one.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What is the `_abck` cookie?** Akamai's own term for it is "mitigation state." It
|
||||
represents the outcome of the sensor exchange and is checked on every later request
|
||||
against that same session's history, not just evaluated once.
|
||||
|
||||
**Does a matching TLS/JA3/JA4 fingerprint mean I pass Akamai?** No. It means one input to
|
||||
the score, out of roughly seven categories Akamai evaluates, agrees with a real browser.
|
||||
The documented Camoufox case had a byte-identical network fingerprint and was still
|
||||
blocked.
|
||||
|
||||
**What actually happened in the Camoufox GitHub issue?** An older patched build was
|
||||
blocked by one Akamai-protected site while stock Firefox passed, despite matching
|
||||
TLS/JA3/JA4/HTTP2 fingerprints. Switching to a newer patched build resolved it in
|
||||
practice. No mechanism was confirmed in the thread.
|
||||
|
||||
**Does this mean invisible_playwright has the same problem?** There is no evidence either
|
||||
way. The issue was filed against a different project, on a site this project has not
|
||||
been tested against. What generalizes is the principle, not the specific outcome.
|
||||
|
||||
**What is Akamai's Bot Score?** A 0 to 100 number Akamai's own product page describes as
|
||||
built from "all anomalies, starting with the very first request," derived from the
|
||||
sensor payload plus network and reputation signals, not from any single check.
|
||||
|
||||
**Can any browser automation tool guarantee it beats Akamai Bot Manager?** No, and a tool
|
||||
that claims it should be treated as making a promise it cannot verify either. This
|
||||
project does not sell that claim about this or any other commercial anti-bot system.
|
||||
|
||||
**Where does most of Akamai's actual signal come from, if not the network layer?** From
|
||||
the parts that are hardest to verify from outside: the JavaScript-collected browser and
|
||||
device fingerprint, behavioral telemetry across the session, and reputation tied to the
|
||||
IP and cookie history, none of which a single clean test can rule in or out.
|
||||
|
||||
**See also:** [Playwright stealth vs Camoufox: two patched Firefoxes](vs-camoufox.md),
|
||||
for how this project and Camoufox compare on everything else; [JA3 and JA4: why a TLS
|
||||
fingerprint cannot be patched](ja3-ja4-tls-fingerprint.md) and [HTTP/2 fingerprint: the
|
||||
layer above the TLS handshake](http2-fingerprint-detection.md), for the two layers that
|
||||
matched in the case above; and [How do websites detect bots?](how-do-websites-detect-bots.md),
|
||||
for where a JavaScript-collected fingerprint sits among the other layers.
|
||||
|
||||
## Sources
|
||||
|
||||
- GitHub issue [`daijro/camoufox#555`](https://github.com/daijro/camoufox/issues/555),
|
||||
"Akamai-protected sites block Camoufox but not stock Firefox via Playwright," retrieved
|
||||
2026-08-30, for the test results, the matched network fingerprints, the suspected
|
||||
patches, the viewport inconsistency, and the resolution.
|
||||
- Akamai's own documentation, [Detection
|
||||
methods](https://techdocs.akamai.com/cloud-security/docs/detection-methods) and [About
|
||||
bots](https://techdocs.akamai.com/cloud-security/docs/about-bots) on
|
||||
techdocs.akamai.com, retrieved 2026-08-30, for the five documented detection methods.
|
||||
- Akamai's [Bot Manager product page](https://www.akamai.com/products/bot-manager),
|
||||
retrieved 2026-08-30, for the 0-100 Bot Score description.
|
||||
- [Akamai Bot Manager: Understanding `_abck` Cookies and Sensor
|
||||
Data](https://scrapfly.io/blog/posts/akamai-bot-manager-understanding-abck-cookies-and-sensor-data),
|
||||
Scrapfly, retrieved 2026-08-30, for the sensor signal categories, the `_abck` cookie's
|
||||
documented failure modes, and the seven-category scoring breakdown.
|
||||
- [`Edioff/akamai-analysis`](https://github.com/Edioff/akamai-analysis), GitHub, retrieved
|
||||
2026-08-30, a reverse-engineering write-up of Bot Manager's client-side sensor script,
|
||||
for the signal count, the pipeline steps, and the obfuscation details.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. The Camoufox issue above is someone else's bug
|
||||
tracker and someone else's engine build; it is quoted here because it is the clearest
|
||||
public evidence that this whole approach narrows a gap rather than closing one, and that
|
||||
applies to this project exactly as much as it applies to theirs.*
|
||||
@@ -0,0 +1,83 @@
|
||||
---
|
||||
title: "Anubis: The Proof-of-Work Firewall, Explained"
|
||||
description: "Anubis makes a browser burn CPU on a SHA-256 puzzle before it can reach a git forge, and it is genuinely open source, unlike most of this corpus. Read from its own repository: the puzzle, the JWT cookie, and a real published critique of its limits."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 34
|
||||
---
|
||||
|
||||
|
||||
# Anubis: The Proof-of-Work Firewall, Explained
|
||||
|
||||
Every other vendor on this list is a commercial product whose internals have to be pieced together from reverse engineering, because the company that built it has no reason to publish them. Anubis is different: it is MIT-licensed, its full source is on GitHub, and its author writes publicly about why it exists and what it does not solve. This page is built almost entirely from primary material, its own repository, its own documentation, and a named security researcher's own published analysis, not practitioner reconstruction. Say that plainly, because it is the exception in this corpus, not the rule.
|
||||
|
||||
Anubis was created by Xe Iaso, a pseudonymous developer, in January 2025, after Amazon's web crawler overloaded Iaso's own Git server while ignoring `robots.txt` entirely. It is now maintained by Techaro. The name is the joke and the mechanic at once: Anubis, the Egyptian god who weighs the hearts of the dead, and the software "weighs the soul" of an incoming HTTP request before deciding whether it deserves to reach the backend at all.
|
||||
|
||||
## What it actually does: a computational toll booth
|
||||
|
||||
Anubis sits in front of a web server as a reverse proxy. Before a request from anything that looks like a browser (identified, by default, by "Mozilla" in the User-Agent string) reaches the protected application, Anubis requires the client to solve a small cryptographic puzzle: find a nonce that, appended to a server-issued challenge string and run through SHA-256, produces a hash with a required number of leading zero hex digits.
|
||||
|
||||
The cost is tunable and grows fast. A default difficulty of five leading zeros takes on the order of a second on a real browser; six can take several minutes. Each added difficulty level multiplies the expected number of hash attempts by sixteen, since each hex digit is one of sixteen values, so the cost curve is deliberately steep rather than linear. A real browser solves this using Web Workers so the puzzle does not freeze the page, leaning on the native Web Crypto API where available and falling back to a pure-JavaScript SHA-256 implementation otherwise.
|
||||
|
||||
Once solved, Anubis issues an Ed25519-signed JWT, stored as a cookie, carrying the challenge string, the winning nonce, the passing hash, an issue time, an expiry, and a backdated "not before" claim for clock-skew tolerance. That token is valid for roughly a week, so a real visitor solves the puzzle about once per week of browsing rather than once per page load. For clients without JavaScript at all, a separate `metarefresh` challenge type, added around version 1.20, achieves a comparable delay using an HTTP meta-refresh redirect instead of a computed hash, specifically so that disabling JavaScript is not itself a way around the gate.
|
||||
|
||||
## The policy engine: not every request gets the same treatment
|
||||
|
||||
Later versions moved Anubis toward something closer to a lightweight, rule-driven firewall than a blanket "challenge everyone" gate. Its policy system evaluates each request against configurable rules, User-Agent regex, path matching, header inspection, CIDR ranges, GeoIP and ASN filtering, or custom CEL expressions for more complex logic, and can assign one of four outcomes: **ALLOW** it straight through, **DENY** it outright, **CHALLENGE** it with the proof-of-work puzzle, or **WEIGH** it, adding to a cumulative score that later rules and thresholds act on. The project's own configuration comments describe this in the same soul-weighing language the tool is named for: a client whose signals look clean has "a soul lighter than a feather" and passes without friction.
|
||||
|
||||
## Adoption: this is not a hypothetical
|
||||
|
||||
Anubis is deployed in front of real infrastructure at meaningful scale, not just a research demo. Documented adopters include GNOME's GitLab instance, the Linux kernel's mailing list and Git infrastructure, FFmpeg, Wine, UNESCO, FreeCAD, ScummVM, Duke University's digital archives, OpenWRT, and the Deutsche Nationalbibliothek. Its author's own stated tradeoff is explicit rather than hidden: deploying it "will result in your website being blocked from smaller scrapers and may inhibit 'good bots' like the Internet Archive," and the project's guidance is that most sites should try Cloudflare first and reach for Anubis only when that is not an option.
|
||||
|
||||
## A real, named critique worth reading in full
|
||||
|
||||
Security researcher Tavis Ormandy published an analysis arguing that Anubis's proof-of-work cost is not a meaningful deterrent against a well-resourced scraper. His own account: a native solver, a couple dozen lines of C rather than the JavaScript a browser is forced to run, cleared the challenge for roughly 11,000 separate Anubis-protected sites in about six minutes on a free-tier Google Cloud VM, and he estimated the aggregate compute cost of doing this continuously at well under a cent a month, trivial against the budget of any company running crawlers at scale.
|
||||
|
||||
That critique does not contradict what Anubis's own author and documentation say the tool is for. Read closely, the mechanism's actual value is not raising anyone's compute bill; it is that it "refuse[s] to render an expensive page for any client that will not run a modern browser's worth of JavaScript first," which is a real and different bar than "impose a compute tax a motivated attacker cannot pay." Anubis stops the high-volume, low-effort crawler that spoofs a browser User-Agent but runs no JavaScript at all, cheaply and by design. It does not stop a scraper that has already built a dedicated solver, and by August 2025 Codeberg, one of the forges running it, publicly acknowledged that AI scrapers had learned to solve Anubis's challenges. The tradeoff is asymmetric in a second, less flattering way too: the computational cost lands on every real visitor's device, including low-end and battery-constrained ones, while a determined attacker's marginal cost per site approaches zero once a solver exists.
|
||||
|
||||
## What this means for a real, engine-level browser
|
||||
|
||||
This is the one detector in this whole corpus where the honest answer is: engine realness is close to irrelevant to whether the gate opens. Anubis is not testing whether a browser is lying about its fingerprint, checking canvas output, or looking for automation-framework tells. It is testing one thing: can this client execute a modern JavaScript engine fast enough to solve a SHA-256 search in a reasonable time. Any real browser, patched or unpatched, stealth or not, answers that the same way, because the puzzle does not touch fingerprint surfaces at all. A plain HTTP client with no JavaScript engine fails it regardless of how convincingly its headers are spoofed, which is the entire point: it is a liveness test for "do you run JavaScript like a browser," not a fidelity test for "are you the specific browser you claim to be."
|
||||
|
||||
`invisible_playwright` does not do anything specific to Anubis, and there is nothing Anubis-specific to do: a genuinely real Firefox, C++-patched or stock, solves its puzzle the same way any other real Firefox does, because the puzzle is engine-agnostic by construction. What this page is really useful for is the opposite lesson: not every gate in this space is a fingerprint problem, and treating Anubis as one would be a category error.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Is Anubis actually open source?** Yes, genuinely, MIT-licensed, full source on GitHub, unlike almost everything else covered in this corpus. That is why this page can cite its own repository and documentation as a primary source rather than reconstructing it from the outside.
|
||||
|
||||
**What does the proof-of-work puzzle actually require?** Finding a nonce such that SHA-256 of the challenge string plus that nonce produces a hash with a configured number of leading zero hex digits. Default difficulty (five zeros) takes about a second on a real browser; each added digit multiplies the expected work by sixteen.
|
||||
|
||||
**How long does the cookie last once I solve it?** About a week, via an Ed25519-signed JWT, so a real visitor is not re-solving the puzzle on every page load.
|
||||
|
||||
**Does Anubis check my browser fingerprint?** No, not in the sense this corpus otherwise means. It checks whether you can execute JavaScript at browser speed, not whether your canvas hash, WebGL renderer, or navigator properties look genuine.
|
||||
|
||||
**Is proof-of-work actually a strong defense?** Security researcher Tavis Ormandy's published analysis argues no, against a motivated attacker: he solved challenges for roughly 11,000 Anubis-protected sites in about six minutes using a native solver on a free cloud VM. It is effective against the high-volume, no-JavaScript crawler class it was built for, and by the Anubis maintainers' own framing that JavaScript-execution requirement, not the compute cost itself, is the actual mechanism.
|
||||
|
||||
**Does deploying Anubis affect legitimate crawlers?** Yes, by its own maintainer's admission. It can block smaller scrapers and "good bots" like the Internet Archive, which is a stated, acknowledged tradeoff, not a hidden side effect.
|
||||
|
||||
**Does a real, engine-level Firefox pass Anubis differently than a stock one?** No, and that is the point of this page. Anubis is not testing fingerprint fidelity at all, so there is nothing for engine-level realness to improve here. Any real JavaScript engine running fast enough passes the same way.
|
||||
|
||||
**See also:** [How Kasada's bot detection actually works](kasada-explained.md) for a commercial vendor using proof-of-work as part of a much larger, closed-source stack; [How Cloudflare's AI Labyrinth works](cloudflare-ai-labyrinth-explained.md) for a completely different anti-crawler philosophy, wasting a bot's time with content instead of computation; and [how do websites detect bots?](how-do-websites-detect-bots.md) for where a liveness test like this sits among fingerprint-based layers.
|
||||
|
||||
## Sources
|
||||
|
||||
- [`TecharoHQ/anubis`](https://github.com/TecharoHQ/anubis) on GitHub, retrieved 2026-08-30, the project's own
|
||||
source and README, for the MIT license, the challenge-type directory structure, and the stated tradeoff
|
||||
about blocking smaller scrapers.
|
||||
- Anubis documentation, [Introduction](https://techarohq-anubis.mintlify.app/introduction), retrieved 2026-08-30,
|
||||
for the policy-engine actions (ALLOW/CHALLENGE/DENY/WEIGH), the challenge types, and the metarefresh
|
||||
no-JavaScript fallback.
|
||||
- crawlex.net, ["Browser-based proof-of-work: how Anubis gates crawlers with hash puzzles"](https://blog.crawlex.net/blog/anubis-proof-of-work-crawler-gating/),
|
||||
retrieved 2026-08-30, for the exact difficulty/cost-curve figures, the JWT cookie contents and one-week
|
||||
validity, and the "refuse to render an expensive page" framing of the mechanism's real function.
|
||||
- Wikipedia, [Anubis (software)](https://en.wikipedia.org/wiki/Anubis_(software)), retrieved 2026-08-30, for
|
||||
the creation history (Xe Iaso, January 2025, the Amazon-crawler origin story), the adopter list, and the
|
||||
Tavis Ormandy critique and Codeberg's August 2025 acknowledgment, cross-checked against the crawlex.net
|
||||
account of the same critique.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright), a Firefox
|
||||
patched at the C++ level. Anubis is the one detector here this project can actually read the source of, and
|
||||
the honest conclusion is that engine-level realness has almost nothing to do with passing it: the puzzle
|
||||
tests JavaScript execution speed, not fingerprint fidelity, and any real browser clears it the same way.*
|
||||
@@ -0,0 +1,83 @@
|
||||
---
|
||||
title: "Arkose Labs (FunCaptcha), Explained"
|
||||
description: "FunCaptcha's 3D puzzles are the visible part of a risk engine that decides difficulty before you ever see a puzzle. What Arkose's own materials say, and what independent reverse engineering has worked out about the telemetry behind it."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 32
|
||||
---
|
||||
|
||||
|
||||
# Arkose Labs (FunCaptcha), Explained
|
||||
|
||||
FunCaptcha looks different from the CAPTCHAs it competes with. Instead of distorted text or a grid of storefronts, Arkose Labs presents a small interactive puzzle: rotate a 3D object to the right orientation, match a shape, answer a short audio or logic prompt. Arkose maintains a large, growing library of these, over 1,250 puzzle variants by one practitioner count.
|
||||
|
||||
That puzzle is the part users see. It is also, deliberately, not the main event. Before a puzzle ever renders, Arkose's telemetry has already decided how hard that puzzle should be, and how many of them a given session will have to solve.
|
||||
|
||||
This is one of the vendors in this corpus closer to an actual CAPTCHA than to a silent background check, worth being direct about upfront: nothing on this page is written as, or should be read as, a description of how to solve Arkose's puzzles for someone. It is about the risk mechanism that decides whether you see one, and how hard.
|
||||
|
||||
## What Arkose's own materials say, and where they stop
|
||||
|
||||
Arkose's own public site describes its detection in terms of scale and adaptivity, not mechanism: "225+ risk signals," "dynamic challenges that evolve in real time to counter emerging attack vectors," and device identification that combines "deterministic methods with machine learning similarity detection." Its own numbers past that point are business outcomes, not technical detail, customer satisfaction figures, dollar savings, account-growth multipliers, not the field names or scoring weights behind the 225 signals.
|
||||
|
||||
That is a real limit on what this page can say with a straight face. Arkose does not publish, in the materials checked for this page, the specific list of what those 225+ signals are or how the risk engine weighs them. What follows past this point comes from independent, practitioner-level reverse engineering, not Arkose's own documentation, and is marked as such.
|
||||
|
||||
## What practitioner reverse engineering has converged on
|
||||
|
||||
Multiple independent writeups, none of them Arkose's own source, describe a broadly consistent picture of what the client-side script collects before a puzzle appears: device and browser fingerprint (screen resolution, installed fonts, navigator properties), canvas, WebGL and AudioContext rendering output, the same category of signal [CreepJS](creepjs-explained.md) and [BotD](botd-explained.md) read, and continuous mouse-movement telemetry once the puzzle itself is on screen.
|
||||
|
||||
The mouse-movement layer is where the writeups get specific enough to be worth quoting carefully, with the caveat that this is reconstructed from the outside, not confirmed by Arkose: one practitioner account describes the script computing cursor acceleration ahead of a click, flagging a straight-line `mouse.move()` path (the kind a naive automation script produces) as an anomaly, and treating a press-to-release interval under roughly 50 milliseconds as evidence of programmatic input, on the reasoning that human physiology puts a real click closer to 70 to 100 milliseconds. None of these specific thresholds appear in Arkose's own public materials as retrieved for this page; they are practitioner reconstructions and should be weighed accordingly, the same caveat this corpus applies to reconstructed internals for [Kasada](kasada-explained.md) and [DataDome](datadome-explained.md).
|
||||
|
||||
A separate, independent piece of evidence that this fingerprint surface is real and specific enough to document: a public GitHub repository, `AzureFlow/arkose-fp-docs`, exists specifically to catalog ArkoseLabs' FunCaptcha fingerprinting payload. Its existence corroborates that the payload is large and structured enough to be worth documenting field by field, the same kind of evidence [a public interstitial-payload tool corroborates for DataDome](datadome-explained.md#the-cookie-and-what-happens-when-it-is-missing); this page did not extract its full field list, so it is cited for what it demonstrates (a real, mapped fingerprint surface exists) rather than for its specific contents.
|
||||
|
||||
## Risk tiers, and how a puzzle escalates
|
||||
|
||||
The reverse-engineering writeups agree on the shape of the escalation even where they disagree on exact thresholds: telemetry collected before and during interaction feeds a risk classification, and sessions read as low-risk may see a simpler puzzle or none at all, while sessions read as high-risk face more puzzle steps, a harder variant, or an outright block. A session that appears to be a script calling Arkose's endpoints directly, without a full browser context behind it, reads as an anomaly on arrival: unusual timing, missing events a real interaction would produce, which the writeups describe triggering escalation before a single puzzle attempt has even happened.
|
||||
|
||||
Time pressure is part of the same mechanism by the same accounts: a stalled challenge, one sitting unsolved for roughly fifteen seconds, gets swapped out or escalated rather than waiting indefinitely, which by itself works against slow, deliberate automation as much as it works against distraction.
|
||||
|
||||
## What an engine answers honestly, and what the puzzle itself is not
|
||||
|
||||
Two different layers are worth separating cleanly here, because collapsing them is exactly the framing this page is built to avoid.
|
||||
|
||||
The **fingerprint layer**, canvas, WebGL, AudioContext, navigator properties, is the same category of check covered throughout this corpus: a genuinely real browser engine, patched below the JavaScript layer rather than overridden from a content script, produces these values honestly because it is not simulating them, it is generating them the normal way. That argument holds here exactly as it does for [CreepJS](creepjs-explained.md) and [PerimeterX](perimeterx-explained.md), and it says nothing puzzle-specific: it only affects whether the fingerprint half of Arkose's risk read looks honest or contradictory.
|
||||
|
||||
The **puzzle itself is a different kind of gate entirely**, the same structural point [made about Cloudflare Turnstile's checkbox tier](cloudflare-turnstile-explained.md): once risk scoring has decided a session needs a challenge, solving a 3D rotation puzzle is an interactive task, not a value a browser engine reports about itself. No amount of engine-level fidelity upstream makes that requirement disappear, because the requirement was never a fingerprint question in the first place. And the mouse-dynamics telemetry collected during the solve is a property of whatever is driving the pointer, human or scripted, [which has its own separate treatment in this corpus](mouse-dynamics-behavioural-biometrics.md), not a property of the rendering engine underneath.
|
||||
|
||||
`invisible_playwright` does not include, and will not add, a puzzle-solving or CAPTCHA-solving capability for Arkose or any comparable vendor. That is a deliberate boundary, not a gap this project is working to close: solving FunCaptcha's puzzles on a user's behalf is a different product category from engine-level stealth, and this corpus's naming policy for anti-bot vendors is explicit that a circumvention claim paired with a protection vendor's name is the one thing it does not make. What honest engine behavior changes here is narrower and more mundane: it keeps the fingerprint half of the risk read from contradicting itself, nothing more.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does Arkose Labs publish its risk scoring model?** No, not beyond category-level language ("225+ risk signals," device identification combining deterministic and ML methods). The specific field list and scoring weights are not in Arkose's own public materials as checked for this page.
|
||||
|
||||
**What decides how hard a FunCaptcha puzzle is?** Per Arkose's own framing and independent reverse engineering, a risk classification computed from device fingerprint, behavioral telemetry and reputation signals before the puzzle is shown, with higher-risk sessions facing more or harder puzzle steps.
|
||||
|
||||
**Does mouse movement get scored during the puzzle itself?** Independent writeups describe continuous cursor telemetry during the solve, including acceleration and click-timing checks, though the specific thresholds reported are reconstructed by practitioners, not confirmed by Arkose's own documentation.
|
||||
|
||||
**Is there a real public reverse-engineering project for Arkose's fingerprint?** Yes; `AzureFlow/arkose-fp-docs` on GitHub documents ArkoseLabs' FunCaptcha fingerprinting payload, though this page did not extract its full field-level contents.
|
||||
|
||||
**Does a real browser engine defeat FunCaptcha?** It answers the fingerprint layer honestly, the same argument that applies to any vendor's canvas/WebGL/navigator checks. It has no bearing on the puzzle itself, which is an interactive challenge, not a fingerprint question.
|
||||
|
||||
**Does invisible_playwright solve FunCaptcha puzzles?** No. This project does not include or sell a puzzle-solving or CAPTCHA-solving service for Arkose or any vendor, and this page is not a guide to building one.
|
||||
|
||||
**Why does Arkose escalate a stalled puzzle after about fifteen seconds?** By practitioner accounts, an unsolved challenge sitting past that window gets swapped or escalated rather than left open, which works against slow or hesitant automation the same way it works against a distracted human.
|
||||
|
||||
**See also:** [How Cloudflare Turnstile actually works](cloudflare-turnstile-explained.md) for the same fingerprint-versus-human-gate distinction at a vendor whose interactive tier is a click rather than a puzzle; [What are mouse-dynamics behavioural biometrics?](mouse-dynamics-behavioural-biometrics.md) for the pointer-telemetry layer in depth; and [How CreepJS decides you are lying](creepjs-explained.md) for the fingerprint-consistency argument this page leans on.
|
||||
|
||||
## Sources
|
||||
|
||||
- Arkose Labs, [How Arkose Labs Works](https://www.arkoselabs.com/how-arkose-labs-works/), retrieved 2026-08-30,
|
||||
for the "225+ risk signals," dynamic-challenge and device-identification language quoted above.
|
||||
- [`AzureFlow/arkose-fp-docs`](https://github.com/AzureFlow/arkose-fp-docs) on GitHub, retrieved 2026-08-30,
|
||||
a real public reverse-engineering project documenting ArkoseLabs' FunCaptcha fingerprint payload, cited for
|
||||
its existence as evidence of a mapped fingerprint surface, not for its full field-level contents.
|
||||
- Practitioner reverse-engineering writeups, retrieved 2026-08-30: ["FunCaptcha (Arkose Labs): Principles of Operation, Features, and Methods for Automated Bypass"](https://medium.com/@kentavr00000009/funcaptcha-arkose-labs-principles-of-operation-features-and-methods-for-automated-bypass-780ef786d7c5)
|
||||
and ["Scraping in the Crosshairs of Arkose Labs"](https://medium.com/@koshka00009/scraping-in-the-crosshairs-of-arkose-labs-how-to-bypass-3d-puzzles-browser-fingerprints-and-c5c710091152),
|
||||
for the telemetry categories, the mouse-timing thresholds, and the risk-tier escalation behavior described above;
|
||||
independent, non-vendor sources whose specific numeric thresholds are not corroborated by Arkose's own documentation.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright), a Firefox
|
||||
patched at the C++ level. Arkose's own materials stop at category-level claims about its risk engine,
|
||||
and this page stops there too for anything not independently corroborated. It does not describe, and
|
||||
this project does not build, a way to solve FunCaptcha's puzzles for you.*
|
||||
@@ -0,0 +1,287 @@
|
||||
---
|
||||
title: "Automating an Email OTP / Verification-Link Login with Playwright"
|
||||
description: "Poll your own inbox over IMAP mid-login, parse the one-time code or magic link, and feed it back into the same browser session that requested it - for testing your own application's login flow."
|
||||
parent: "Scraping with Playwright"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 146
|
||||
---
|
||||
|
||||
|
||||
# Automating an Email OTP / Verification-Link Login with Playwright
|
||||
|
||||
This page is about a specific, ordinary automation need: your own application, or an
|
||||
account you control, sends a one-time code or a magic link by email as part of login,
|
||||
and a test or a script needs to complete that flow end to end without a human
|
||||
watching an inbox. That is a normal thing to automate, the same category of work as
|
||||
[reusing a saved session](automating-login-vs-session-reuse.md) or
|
||||
[scraping behind a login](how-to-scrape-behind-login-playwright.md) - it is not about
|
||||
getting into an account that is not yours, and nothing here assumes or requires that.
|
||||
|
||||
The pattern is three steps done in order, inside one browser session: trigger the send,
|
||||
poll the mailbox until the message arrives, extract the code or link and hand it back
|
||||
to the same page that asked for it. The part people get wrong is usually not the code,
|
||||
it is the timing and the identity: polling too aggressively, or redeeming the code from
|
||||
a different browser session than the one that requested it.
|
||||
|
||||
## The shape of the flow
|
||||
|
||||
```python
|
||||
import time
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
SEED = 42
|
||||
|
||||
with InvisiblePlaywright(seed=SEED) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com/login")
|
||||
page.fill("#email", "you@example.com")
|
||||
|
||||
sent_at = time.time() # mark the moment before triggering the send
|
||||
page.click("#send-code")
|
||||
|
||||
code = fetch_code_from_inbox(sent_at) # poll the mailbox; see below
|
||||
|
||||
page.fill("#otp", code)
|
||||
page.click("#verify")
|
||||
page.wait_for_url("https://example.com/account")
|
||||
```
|
||||
|
||||
Everything downstream depends on `sent_at`: without a timestamp marking "before the
|
||||
request," you have no way to tell a fresh code from a stale one already sitting in the
|
||||
inbox from a previous run.
|
||||
|
||||
## Step 1: trigger the send, then start the clock
|
||||
|
||||
Nothing unusual here - it is an ordinary form fill and click, the same as any other
|
||||
login automation. The only detail worth keeping is recording the time immediately
|
||||
before the click, not after, since network latency on the click itself can matter
|
||||
when you are about to poll a mailbox on a short timeout.
|
||||
|
||||
## Step 2: poll the inbox with imaplib
|
||||
|
||||
Python's standard library `imaplib` module is enough for this; nothing extra to
|
||||
install. Its own documentation describes it plainly:
|
||||
|
||||
> "This module defines three classes, `IMAP4`, `IMAP4_SSL` and `IMAP4_stream`, which
|
||||
> encapsulate a connection to an IMAP4 server and implement a large subset of the
|
||||
> IMAP4rev1 client protocol as defined in RFC 3501."
|
||||
|
||||
Use `IMAP4_SSL` for the connection, and pass an explicit SSL context instead of the
|
||||
default one - the standard library is direct about why:
|
||||
|
||||
> "With the default ssl_context, the connection is encrypted but the server certificate
|
||||
> and hostname are not verified. To verify them, pass a context created by
|
||||
> ssl.create_default_context()."
|
||||
|
||||
```python
|
||||
import imaplib
|
||||
import email
|
||||
import re
|
||||
import ssl
|
||||
import time
|
||||
|
||||
def extract_text(msg):
|
||||
# the plain-text part of a possibly multipart message
|
||||
if msg.is_multipart():
|
||||
for part in msg.walk():
|
||||
if part.get_content_type() == "text/plain":
|
||||
return part.get_payload(decode=True).decode(errors="replace")
|
||||
return ""
|
||||
return msg.get_payload(decode=True).decode(errors="replace")
|
||||
|
||||
def fetch_code_from_inbox(sent_at, timeout_s=60, poll_every_s=2):
|
||||
ctx = ssl.create_default_context()
|
||||
deadline = time.time() + timeout_s
|
||||
|
||||
while time.time() < deadline:
|
||||
conn = imaplib.IMAP4_SSL("imap.example.com", ssl_context=ctx)
|
||||
conn.login("you@example.com", "app-specific-password")
|
||||
conn.select("INBOX")
|
||||
|
||||
# UNSEEN keeps this from re-matching an old code from a previous run
|
||||
typ, data = conn.search(None, "UNSEEN", "SUBJECT", '"Your verification code"')
|
||||
ids = data[0].split()
|
||||
|
||||
for msg_id in reversed(ids): # newest first
|
||||
typ, msg_data = conn.fetch(msg_id, "(RFC822)")
|
||||
msg = email.message_from_bytes(msg_data[0][1])
|
||||
|
||||
received = email.utils.parsedate_to_datetime(msg["Date"]).timestamp()
|
||||
if received < sent_at - 5: # a few seconds of clock slack
|
||||
continue
|
||||
|
||||
body = extract_text(msg)
|
||||
match = re.search(r"\b(\d{6})\b", body)
|
||||
if match:
|
||||
conn.logout()
|
||||
return match.group(1)
|
||||
|
||||
conn.logout()
|
||||
time.sleep(poll_every_s)
|
||||
|
||||
raise TimeoutError("no verification code arrived in time")
|
||||
```
|
||||
|
||||
A few details that matter more than they look like they should:
|
||||
|
||||
- **Search `UNSEEN`, and filter by time, not just presence.** A test inbox
|
||||
accumulates old codes; matching "the newest message with the right subject" without
|
||||
a time check will occasionally hand you yesterday's code, which then fails
|
||||
verification for a confusing reason.
|
||||
- **This is polling, not push.** IMAP has no notification mechanism in the basic flow
|
||||
above; you are asking the server "anything new?" on an interval.
|
||||
[`IMAP4.idle()`](https://datatracker.ietf.org/doc/html/rfc2177) exists for a
|
||||
push-like wait on servers that support the `IDLE` extension, but a short poll loop
|
||||
is simpler to reason about and is fine for this use case.
|
||||
- **Most mail providers now require an app-specific password or an OAuth token for
|
||||
IMAP access, not the account's normal login password.** That is a one-time setup
|
||||
step outside Playwright entirely, and which one your provider needs is worth
|
||||
checking before wiring this up, since it is unrelated to anything in this page.
|
||||
- **A test-email API is a reasonable alternative to a real mailbox**, particularly in
|
||||
CI where you do not want a persistent inbox at all. Several providers expose a
|
||||
disposable inbox over a plain REST API instead of IMAP - poll an HTTP endpoint for
|
||||
new messages the same way the loop above polls IMAP, then apply the same
|
||||
time-filtering and parsing logic to whatever it returns.
|
||||
|
||||
## Step 3: parse the code or the link
|
||||
|
||||
Extracting a numeric code is a regex against the plain-text body, as above. A magic
|
||||
link needs one extra step: pull the href out of the HTML part rather than the
|
||||
plain-text alternative, since some providers only put a clickable link in the HTML
|
||||
version of the message.
|
||||
|
||||
```python
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
def extract_magic_link(msg):
|
||||
for part in msg.walk():
|
||||
if part.get_content_type() == "text/html":
|
||||
soup = BeautifulSoup(part.get_payload(decode=True), "html.parser")
|
||||
link = soup.find("a", string=re.compile("verify|confirm|sign in", re.I))
|
||||
if link:
|
||||
return link["href"]
|
||||
return None
|
||||
```
|
||||
|
||||
One thing worth checking before trusting the extracted URL: some sending platforms
|
||||
wrap the real link behind their own click-tracking redirect, so the `href` you pull
|
||||
out of the HTML is not the destination URL itself, it is a tracking link that
|
||||
redirects to it. That is fine to navigate directly - Playwright follows redirects the
|
||||
same as any browser - but do not assume the string you extracted is the final URL if
|
||||
you are trying to match it against something else, like an expected domain.
|
||||
|
||||
## Step 4: feed it back into the same session, not a new one
|
||||
|
||||
This is the part that actually matters for the automation to keep working reliably,
|
||||
and it is easy to get wrong by treating steps 1 through 3 as a separate script from
|
||||
step 4.
|
||||
|
||||
The browser that requested the code and the browser that redeems it have to be the
|
||||
same session: same context, same seed-derived fingerprint, same proxy exit, ideally
|
||||
the same page object still sitting on the login form. A login flow that requests a
|
||||
code from one machine's fingerprint and then submits it from a different one is
|
||||
exactly the cross-session mismatch a fingerprint-aware login already watches for, the
|
||||
same argument made in full on
|
||||
[why automating login is riskier than reusing a session](automating-login-vs-session-reuse.md):
|
||||
replaying credentials from a different fingerprint asks the site to believe the same
|
||||
identity's GPU, canvas hash and TLS handshake all changed mid-flow, independent of
|
||||
whether the code itself is genuine.
|
||||
|
||||
In practice this means: do not send the code request, close the browser, run a
|
||||
separate mail-fetching script, then open a *new* Playwright session to submit the
|
||||
code. Keep the browser open across the whole thing, poll the inbox in the same
|
||||
process, and submit the result into the same `page` object, as the first code block on
|
||||
this page does. If a magic link is what arrived instead of a code, navigate the same
|
||||
page to it rather than opening it in a fresh context:
|
||||
|
||||
```python
|
||||
page.goto(magic_link) # same page, same identity that requested it
|
||||
page.wait_for_url("https://example.com/account")
|
||||
```
|
||||
|
||||
## Timing: the budget you are actually working against
|
||||
|
||||
Two failure directions, and you need a plan for both. Poll too fast and you risk
|
||||
hitting your mail provider's own rate limit on IMAP logins, which is a real and
|
||||
separate throttling layer from anything Playwright touches. Poll too slow, or set too
|
||||
generous a total timeout, and you risk the code or link expiring before you use it -
|
||||
some verification links expire in under two minutes, tighter than the 5 to 15 minutes
|
||||
common for numeric codes. Set an explicit total timeout, back off between polls rather
|
||||
than hammering the server every few hundred milliseconds, and treat a timeout as an
|
||||
expected outcome your code handles, not an exception you were not expecting - the same
|
||||
budget-first thinking as
|
||||
[retrying failed requests with a total time-and-attempt cap](how-to-retry-failed-requests-playwright.md).
|
||||
|
||||
## Conclusion
|
||||
|
||||
An email OTP or magic-link login automates in three ordinary steps: trigger the send
|
||||
with a timestamp, poll the inbox with `imaplib` (or a disposable-inbox API) filtered
|
||||
by that timestamp, and feed the result back into the same browser session that
|
||||
requested it. The mechanics are standard library code; the part worth being careful
|
||||
about is keeping the request and the redemption in one identity, and budgeting the
|
||||
poll loop against both a rate limit on one side and an expiring code on the other.
|
||||
None of this reads or touches an inbox you do not have legitimate access to - it
|
||||
automates a flow you are testing, the same way a saved session automates skipping a
|
||||
login form you already have credentials for.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**How do I automate a login that emails a one-time code?** Trigger the send, poll your
|
||||
inbox with `imaplib` filtered to messages received after the request, extract the code
|
||||
with a regex, and fill it into the same page that requested it.
|
||||
|
||||
**Do I need a real mailbox, or can I use a test-email service?** Either works. A real
|
||||
IMAP mailbox with an app-specific password is the direct route; many providers also
|
||||
offer a disposable inbox reachable over a plain REST API, useful in CI where you do
|
||||
not want a persistent account.
|
||||
|
||||
**Why did the login get flagged even though the code was correct?** Most likely the
|
||||
code was requested and redeemed from two different browser sessions with two
|
||||
different fingerprints. Keep the whole flow, request through redemption, inside one
|
||||
Playwright session with one seed.
|
||||
|
||||
**How long should I poll before giving up?** Set an explicit total timeout rather than
|
||||
polling forever, and back off between attempts. Codes and links both expire, some
|
||||
links in under two minutes, so budget for that rather than assuming you have plenty of
|
||||
time.
|
||||
|
||||
**My IMAP login fails even with the right password. Why?** Most mail providers now
|
||||
require an app-specific password or an OAuth token for IMAP access rather than the
|
||||
normal account password. That is a setup step outside Playwright.
|
||||
|
||||
**How do I handle a magic link instead of a numeric code?** Extract the href from the
|
||||
HTML part of the message (plain text often omits it), then `page.goto()` that URL in
|
||||
the same session that requested it.
|
||||
|
||||
**Is this the same thing as bypassing a site's verification?** No. This automates a
|
||||
flow you have legitimate access to, the same category as reusing a saved login session
|
||||
- it does not solve a challenge meant to keep automation out, and it requires an
|
||||
inbox and credentials that are actually yours.
|
||||
|
||||
## Sources
|
||||
|
||||
- The Python standard library's [`imaplib` documentation](https://docs.python.org/3/library/imaplib.html),
|
||||
retrieved 2026-08-30, for the module description and the `IMAP4_SSL`,
|
||||
`search()` and `fetch()` signatures used above, and for the explicit note that the
|
||||
default SSL context does not verify the server certificate or hostname.
|
||||
- [RFC 3501](https://datatracker.ietf.org/doc/html/rfc3501.html), the IMAP4rev1
|
||||
protocol `imaplib` implements, for `UNSEEN` as a defined search key.
|
||||
- This project's own notes on session and fingerprint consistency, linked throughout,
|
||||
for why the request and the redemption belong in one identity.
|
||||
|
||||
**See also:** [Automating TOTP-Based 2FA Login with Playwright](automating-totp-2fa-login-playwright.md)
|
||||
for the other common second-login-step mechanism, a locally computed authenticator
|
||||
code with no inbox and no polling involved at all, [Why automating login is riskier
|
||||
than reusing a session](automating-login-vs-session-reuse.md)
|
||||
for the fingerprint-consistency argument this page depends on,
|
||||
[how to scrape data behind a login with Playwright](how-to-scrape-behind-login-playwright.md)
|
||||
for the end-to-end session-reuse pattern this flow feeds into, and
|
||||
[how to retry failed requests when scraping with Playwright](how-to-retry-failed-requests-playwright.md)
|
||||
for the same total-budget thinking applied to a poll loop instead of a request retry.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. The code arriving is the easy part; keeping the
|
||||
browser that asked for it and the one that spends it as the same machine is the part
|
||||
worth writing down.*
|
||||
@@ -0,0 +1,273 @@
|
||||
---
|
||||
title: "Automating TOTP-Based 2FA Login with Playwright"
|
||||
description: "Generate a time-based one-time code with pyotp from the same shared secret an authenticator app would scan as a QR code, and feed it straight into the login form. No inbox, no polling, no IMAP - for testing your own application's 2FA flow."
|
||||
parent: "Scraping with Playwright"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 147
|
||||
---
|
||||
|
||||
|
||||
# Automating TOTP-Based 2FA Login with Playwright
|
||||
|
||||
This page is about a specific, ordinary testing need: your own application, or an
|
||||
account you control, has authenticator-app two-factor authentication turned on,
|
||||
and a test or a script needs to complete the login end to end without a human
|
||||
opening Google Authenticator or Authy on a phone. The mechanism is cryptographic,
|
||||
not network-based: a time-based one-time password (TOTP) is computed on the spot
|
||||
from a shared secret you already hold, the same secret an authenticator app would
|
||||
have scanned as a QR code the day 2FA was set up. Nothing here assumes or requires
|
||||
access to an account that is not yours, and the whole point of writing this down
|
||||
is to keep the automation scoped to accounts you actually control.
|
||||
|
||||
## This is not the email-OTP page, on purpose
|
||||
|
||||
If you came here from [automating an email OTP or magic-link
|
||||
login](automating-email-otp-verification-login-playwright.md), the two pages solve
|
||||
the same category of problem, "get past a second login step," with genuinely
|
||||
different mechanics, and it is worth being explicit about which one your situation
|
||||
actually needs.
|
||||
|
||||
| | Email OTP / magic link | TOTP authenticator |
|
||||
|---|---|---|
|
||||
| Where the code comes from | The site generates and emails it *after* you trigger the send | You generate it yourself, locally, from a secret you already hold |
|
||||
| What you need on hand | IMAP credentials, or a test-inbox API | Nothing but the shared secret and a library |
|
||||
| Timing model | Poll a real mailbox against a deadline; codes can take seconds to arrive and can expire in minutes | Instant; no network call, no waiting, no inbox at all |
|
||||
| Failure mode | Mailbox rate limits, expired links, stale messages from old runs | Clock drift between your machine and the server, a mismatched digit/period setting |
|
||||
|
||||
The email-OTP page spends most of its length on `imaplib`, timestamps, and polling
|
||||
loops, because the hard part there is coordinating with a mailbox on the network.
|
||||
None of that exists here. If your two-factor step involves opening a mail client,
|
||||
you want that page. If it involves an authenticator app and a 6-digit code that
|
||||
refreshes every 30 seconds, you want this one.
|
||||
|
||||
## The shape of the flow
|
||||
|
||||
```python
|
||||
import pyotp
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
SEED = 42
|
||||
TOTP_SECRET = "JBSWY3DPEHPK3PXP" # the same secret your authenticator app holds
|
||||
|
||||
with InvisiblePlaywright(seed=SEED) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com/login")
|
||||
page.fill("#email", "you@example.com")
|
||||
page.fill("#password", "your-password")
|
||||
page.click("#sign-in")
|
||||
|
||||
page.wait_for_selector("#totp-code") # the 2FA step actually appeared
|
||||
code = pyotp.TOTP(TOTP_SECRET).now()
|
||||
page.fill("#totp-code", code)
|
||||
page.click("#verify")
|
||||
page.wait_for_url("https://example.com/account")
|
||||
```
|
||||
|
||||
There is no step 2 that waits on anything external. `pyotp.TOTP(TOTP_SECRET).now()`
|
||||
returns a code synchronously, in microseconds, because it is a computation, not a
|
||||
request.
|
||||
|
||||
## Where the secret comes from
|
||||
|
||||
The shared secret is not something you invent; it is the same value your own
|
||||
application generated when you (or a test account you control) turned on
|
||||
authenticator-app 2FA. During that setup flow, most applications show a QR code
|
||||
and, next to it, a plain-text fallback string for anyone whose phone camera does
|
||||
not work. That fallback string is a base32-encoded secret, and it is exactly what
|
||||
an authenticator app decodes out of the QR code before storing it. Google's own
|
||||
specification for the format authenticator apps read, the `otpauth://` URI scheme,
|
||||
states it directly: the QR code encodes a URI whose `secret` parameter is "an
|
||||
arbitrary key value encoded in Base32," and that URI is "what get[s] converted
|
||||
into QR codes during the setup process for authenticator applications." Capture
|
||||
that string once, during your own account's enrollment, store it the way you would
|
||||
store any other test credential, and `pyotp.TOTP(secret)` consumes it identically
|
||||
to how a phone's authenticator app would.
|
||||
|
||||
```python
|
||||
import pyotp
|
||||
|
||||
# provisioning_uri() is what you would render as a QR code for a human;
|
||||
# reading the same secret directly is what a script needs instead.
|
||||
secret = pyotp.random_base32()
|
||||
uri = pyotp.totp.TOTP(secret).provisioning_uri(name="you@example.com", issuer_name="Example App")
|
||||
print(uri) # otpauth://totp/Example%20App:you%40example.com?secret=...&issuer=Example%20App
|
||||
```
|
||||
|
||||
Do not try to re-derive the secret from a screenshot of the QR code on every test
|
||||
run. Capture it once, during setup, the same way you would capture a password.
|
||||
|
||||
## Generating the code
|
||||
|
||||
[PyOTP's own documentation](https://pyotp.readthedocs.io/en/stable/) describes the
|
||||
library plainly: it generates and verifies one-time passwords for two-factor and
|
||||
multi-factor authentication. The call that matters is one line:
|
||||
|
||||
```python
|
||||
import pyotp
|
||||
|
||||
totp = pyotp.TOTP(secret)
|
||||
code = totp.now() # e.g. "492039"
|
||||
```
|
||||
|
||||
`.now()` computes the code for the current 30-second window and returns it as a
|
||||
string. There is no client-server round trip anywhere in this call; the entire
|
||||
value is derived from the secret and the current time.
|
||||
|
||||
### The algorithm, briefly
|
||||
|
||||
TOTP is defined in [RFC 6238](https://datatracker.ietf.org/doc/html/rfc6238) as a
|
||||
time-based variant of HOTP (RFC 4226), the counter-based one-time-password
|
||||
algorithm. The RFC states the relationship directly: `TOTP = HOTP(K, T)`, where
|
||||
`T` is a moving factor computed as `(Current Unix time - T0) / X`, with `X` the
|
||||
time step, 30 seconds by default, and `T0` the Unix epoch. In plain terms: instead
|
||||
of HOTP's incrementing counter, TOTP uses "which 30-second slice of time is it
|
||||
right now" as the counter, and HMACs that against the shared secret the same way
|
||||
HOTP always has. Both your script and the server computing the same thing from the
|
||||
same secret and the same clock arrive at the same 6-digit code, which is the whole
|
||||
mechanism 2FA setup relies on, and the whole reason no network call is involved on
|
||||
either generation or verification.
|
||||
|
||||
### Matching digits, algorithm and period to what the site actually issued
|
||||
|
||||
`pyotp.TOTP()` defaults to 6 digits, SHA1, and a 30-second period, which matches
|
||||
the overwhelming majority of sites' authenticator-app implementations. If your
|
||||
target application's enrollment page shows different values, in an advanced setup
|
||||
screen or in the raw `otpauth://` URI, pass them explicitly:
|
||||
|
||||
```python
|
||||
import hashlib
|
||||
|
||||
totp = pyotp.TOTP(secret, digits=8, digest=hashlib.sha256, interval=60)
|
||||
```
|
||||
|
||||
A code generated with the wrong digit count, algorithm or interval will not match
|
||||
what the server expects, and this looks identical to "the automation is broken"
|
||||
from the outside. Read the parameters out of the actual `otpauth://` URI your
|
||||
application issued rather than assuming the defaults.
|
||||
|
||||
## Clock drift and reuse, the two real failure modes
|
||||
|
||||
Two practical issues account for nearly every TOTP automation failure that is not
|
||||
a plain wrong secret.
|
||||
|
||||
**Clock drift.** TOTP's whole security model rests on both sides agreeing what
|
||||
time it is. If the machine running your script and the server verifying the code
|
||||
disagree by more than roughly one time step, the code you generate is for the
|
||||
wrong window and gets rejected as invalid even though the secret is correct.
|
||||
`pyotp.TOTP.verify()` accepts a `valid_window` argument specifically for this: it
|
||||
checks the current window plus a configurable number of windows on either side,
|
||||
which is the standard tolerance most real verifiers apply server-side too. If
|
||||
you are generating and submitting the code yourself rather than verifying it, the
|
||||
practical fix is keeping the machine running the automation on synced NTP time,
|
||||
not widening a window you do not control on the server end.
|
||||
|
||||
**Code reuse inside the same window.** Some applications reject submitting the
|
||||
same TOTP code twice, even if it is still numerically valid, as a replay defense.
|
||||
If a test suite runs the login flow twice in quick succession and happens to land
|
||||
in the same 30-second window both times, the second attempt can fail for a reason
|
||||
that has nothing to do with the code being wrong. This is intermittent by nature,
|
||||
tied to wall-clock timing rather than your code, and the fix is either spacing
|
||||
runs apart or, if the site's session allows it, not re-authenticating a fresh TOTP
|
||||
challenge more than once per window in automated test loops.
|
||||
|
||||
## Storing the secret safely
|
||||
|
||||
The shared secret is a long-lived credential, not a one-time value; anyone who has
|
||||
it can generate valid codes for as long as 2FA stays configured with it. Treat it
|
||||
the way you would treat a password: an environment variable or a secrets manager
|
||||
in CI, never a literal string committed to a repository. This is the same
|
||||
housekeeping any other test credential needs, and it is worth stating because a
|
||||
TOTP secret is easy to underestimate: unlike a password, it never gets rotated by
|
||||
a failed-login lockout, so a leaked one stays valid indefinitely.
|
||||
|
||||
## Conclusion
|
||||
|
||||
TOTP-based 2FA automates in two lines once you have the secret: `pyotp.TOTP(secret).now()`
|
||||
to compute the current code, and a `page.fill()` into whatever field the login
|
||||
form shows for it. The mechanism is entirely local and cryptographic, RFC
|
||||
6238's HMAC-over-time-step algorithm, with no inbox, no IMAP connection, and no
|
||||
polling loop anywhere in it, which is the whole difference from [the email-OTP
|
||||
flow](automating-email-otp-verification-login-playwright.md) this page is most
|
||||
often confused with. The parts worth being careful about are capturing the secret
|
||||
once during your own account's real enrollment rather than trying to re-scan a QR
|
||||
code every run, matching the digit count, algorithm and period the site actually
|
||||
issued, and keeping the automation's clock in sync so the code you compute lands
|
||||
in the same window the server checks against.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**How do I automate a login protected by an authenticator app?** Get the shared
|
||||
secret from your own account's 2FA enrollment (the base32 string next to the QR
|
||||
code), then call `pyotp.TOTP(secret).now()` to generate the current code and fill
|
||||
it into the login form, in the same script, right after triggering the login.
|
||||
|
||||
**Is this the same as automating an email OTP login?** No. [Email OTP](automating-email-otp-verification-login-playwright.md)
|
||||
requires triggering a send and polling a real mailbox over IMAP until the code
|
||||
arrives. TOTP requires no network call at all: you already hold the secret, and
|
||||
the code is computed instantly and locally from it and the current time.
|
||||
|
||||
**Where do I get the TOTP secret in the first place?** From your own account's 2FA
|
||||
setup screen, the same base32 string an authenticator app decodes out of the QR
|
||||
code. Capture it once during enrollment and store it like any other credential;
|
||||
do not try to re-derive it from a screenshot on every run.
|
||||
|
||||
**Why does the generated code get rejected even though the secret is right?**
|
||||
Almost always clock drift between the machine generating the code and the server
|
||||
verifying it, or a mismatch in digits, hash algorithm or time-step length against
|
||||
what the site actually issued. Check both before assuming the secret itself is
|
||||
wrong.
|
||||
|
||||
**Can I run the login twice in a row with the same code?** Some applications
|
||||
reject reusing a TOTP code inside the same 30-second window as a replay defense,
|
||||
independent of whether the code is still numerically valid. Space repeated
|
||||
automated logins apart if you see intermittent rejections tied to timing.
|
||||
|
||||
**Is this a way to get into an account that is not mine?** No. It only works
|
||||
against an account whose 2FA you set up yourself and whose secret you hold. The
|
||||
technique automates a flow you already have legitimate access to, the same
|
||||
category as reusing a saved session or automating an email OTP for your own
|
||||
inbox; it does not solve, guess or bypass anything, and it is worthless against a
|
||||
secret you were never given.
|
||||
|
||||
## Sources
|
||||
|
||||
- [PyOTP's own documentation](https://pyotp.readthedocs.io/en/stable/) and its
|
||||
[GitHub repository](https://github.com/pyauth/pyotp), for the `TOTP` class,
|
||||
`.now()`, `.verify()` and `valid_window`, and `provisioning_uri()`, retrieved
|
||||
2026-08-30.
|
||||
- [RFC 6238](https://datatracker.ietf.org/doc/html/rfc6238), "TOTP: Time-Based
|
||||
One-Time Password Algorithm," for the `TOTP = HOTP(K, T)` definition and the
|
||||
`T = (Current Unix time - T0) / X` moving-factor formula, retrieved 2026-08-30.
|
||||
- [RFC 4226](https://datatracker.ietf.org/doc/html/rfc4226), the HOTP algorithm
|
||||
TOTP extends with a time-derived counter in place of an incrementing one.
|
||||
- Google's [Key Uri Format](https://github.com/google/google-authenticator/wiki/Key-Uri-Format)
|
||||
specification, for the `otpauth://` URI scheme, the base32 `secret` parameter,
|
||||
and its role as what actually gets encoded into a 2FA setup QR code, retrieved
|
||||
2026-08-30.
|
||||
- Checkly's own [How to Bypass Time-Based 2FA Login Flows With
|
||||
Playwright](https://www.checklyhq.com/docs/learn/playwright/bypass-totp/),
|
||||
verified live this session, for a real, independent walkthrough of the same
|
||||
generate-then-fill pattern (using the JavaScript `otpauth` library against a
|
||||
personal GitHub account's own TOTP secret, explicitly scoped to an account the
|
||||
reader already controls).
|
||||
- Playwrightsolutions.com's [Playwright Login Test With Two Factor Authentication
|
||||
(2FA) Enabled (TOTP)](https://playwrightsolutions.com/playwright-login-test-with-2-factor-authentication-2fa-enabled/),
|
||||
verified live this session, for another independent practitioner writeup of the
|
||||
same mechanism.
|
||||
|
||||
**See also:** [Automating an Email OTP / Verification-Link Login with
|
||||
Playwright](automating-email-otp-verification-login-playwright.md) for the
|
||||
network-polling variant of "get past a second login step" this page deliberately
|
||||
does not overlap with, [why automating login is riskier than reusing a
|
||||
session](automating-login-vs-session-reuse.md) for the fingerprint-consistency
|
||||
argument that applies to any login automation, and [how to scrape data behind a
|
||||
login with Playwright](how-to-scrape-behind-login-playwright.md) for the
|
||||
session-reuse pattern this flow feeds into once the 2FA step is past.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. Generating a code from a secret you already
|
||||
hold is arithmetic, not automation trickery; the browser's realness has nothing to
|
||||
do with whether the math is correct, and the whole flow is worthless without a
|
||||
secret that was legitimately yours to begin with.*
|
||||
@@ -0,0 +1,95 @@
|
||||
---
|
||||
title: "AWS WAF Bot Control, Explained"
|
||||
description: "AWS WAF Bot Control runs two protection levels: Common blocks self-identifying bots by static analysis, Targeted adds a token-backed challenge/CAPTCHA pipeline with machine-learning rules for coordinated activity. Read from AWS's own docs, rule by rule."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 33
|
||||
---
|
||||
|
||||
|
||||
# AWS WAF Bot Control, Explained
|
||||
|
||||
AWS WAF Bot Control is a managed rule group, not a separate product with its own dashboard and SDK ecosystem the way Akamai or DataDome ship one. You add it to a Web ACL (AWS's term for a firewall policy) the same way you'd add any other managed rule group, and unlike most of the vendors in this corpus, AWS documents its rules by name, in public, with what each one inspects and what action it takes by default. That is unusually specific for this category, and this page leans on it: almost everything below is quoted or closely paraphrased from AWS's own developer guide, not reconstructed from outside reverse engineering.
|
||||
|
||||
Read from AWS's own documentation on 2026-08-30.
|
||||
|
||||
## Two protection levels, and what separates them
|
||||
|
||||
Bot Control ships as one managed rule group, `AWSManagedRulesBotControlRuleSet`, with two inspection levels a site chooses between:
|
||||
|
||||
**Common** detects "a variety of self-identifying bots, such as web scraping frameworks, search engines, and automated browsers," using "traditional bot detection techniques, such as static request data analysis." Per AWS's own framing, this level labels the traffic it recognizes and blocks the bots it cannot verify, without needing anything running client-side.
|
||||
|
||||
**Targeted** includes everything Common does and adds detection for bots that do not self-identify, meaning nothing in the request announces what it is. Targeted protections, per AWS, "mitigate bot activity using a combination of rate limiting and CAPTCHA and background browser challenges," and require a JavaScript (or mobile) SDK integration on the protected site, because the targeted rules read information the SDK collects and attaches to a **token**, not just the raw request.
|
||||
|
||||
Two sub-families of targeted rules are named directly by their prefix. Rules beginning `TGT_` use "browser interrogation, fingerprinting, and behavior heuristics." Rules beginning `TGT_ML_` are AWS's machine-learning layer specifically: "automated, machine-learning analysis of website traffic statistics to detect anomalous behavior indicative of distributed, coordinated bot activity," built from traffic statistics like timestamps, browser characteristics, and previous URL visited. AWS states plainly that ML is on by default for Targeted but can be turned off, in which case those rules simply do not evaluate.
|
||||
|
||||
## The token: what ties a session's evidence together
|
||||
|
||||
Targeted detection runs on a **token**, generated by the JavaScript or mobile SDK and carried on subsequent requests, and AWS's rules read the token's state instead of re-deriving everything from scratch on every request. Two labels attached to every token matter most:
|
||||
|
||||
- `awswaf:managed:token:id:{{identifier}}`, a session identifier tied to the specific token in use, changing if the client acquires a new one.
|
||||
- `awswaf:managed:token:fingerprint:{{fingerprint-identifier}}`, a browser fingerprint AWS computes from client signals, which "stays the same across multiple token acquisition attempts" and is explicitly "not unique to a single client," AWS's own words for a value meant to identify a device class, not a specific visitor.
|
||||
|
||||
A token can be `accepted` (present, with a valid, unexpired challenge or CAPTCHA solution, on the right domain), or `rejected` for one of several named reasons: `rejected:not_solved`, `rejected:expired`, `rejected:domain_mismatch`, or `rejected:invalid`. A request can also be `absent` a token entirely, which is its own label and, at volume, its own rule: `TGT_VolumetricIpTokenAbsent` specifically tracks clients sending five or more requests in five minutes without a valid token and issues a Challenge action once that threshold is crossed.
|
||||
|
||||
## What the individual rules actually check
|
||||
|
||||
A sample of named rules, quoted from AWS's own rule listing, gives a concrete sense of what "browser interrogation" and "behavior heuristics" mean in practice, not as marketing language:
|
||||
|
||||
| Rule | What it inspects | Default action |
|
||||
|---|---|---|
|
||||
| `SignalAutomatedBrowser` | Indicators the client browser might be automated | Block |
|
||||
| `SignalNonBrowserUserAgent` | A user-agent string that does not read as a browser at all | Block |
|
||||
| `SignalKnownBotDataCenter` | Traffic originating from IP ranges typically used by bots | Block |
|
||||
| `TGT_SignalBrowserAutomationExtension` | A browser extension that assists automation, e.g. Selenium IDE, present on the client even if unused | CAPTCHA |
|
||||
| `TGT_SignalBrowserInconsistency` | "Inconsistent browser interrogation data" inside the token | CAPTCHA |
|
||||
| `TGT_VolumetricSession` | An abnormally high request volume from one client session in a 5-minute window, versus AWS's own traffic baselines | CAPTCHA (Block at maximum confidence) |
|
||||
| `TGT_ML_CoordinatedActivityLow/Medium/High` | Machine-learning-detected patterns consistent with distributed, coordinated bot activity across many IPs | Challenge / CAPTCHA / CAPTCHA |
|
||||
| `TGT_TokenReuseIpLow/Medium/High` | The same token reused across more than 2, 5, or 8 distinct IPs in 5 minutes | Count / CAPTCHA / Block |
|
||||
| `TGT_TokenReuseCountryLow/Medium/High` | The same token reused across more than 1, 2, or 3 countries in 5 minutes | Count / CAPTCHA / Block |
|
||||
|
||||
The token-reuse family is worth pausing on: it does not ask whether any single request looks automated, it asks whether one browser's proof-of-legitimacy is being shared across more devices, networks or countries than a single real session plausibly touches in five minutes. That is a detection axis with no fingerprint answer at all, honest or otherwise, because the thing being scored is reuse across sessions, not any property of one session's browser.
|
||||
|
||||
AWS is also explicit about a category it treats differently from everything above: a maintained list of verified bots (search engine crawlers, monitoring services, SEO tools) that Bot Control identifies and does not block, adding a `bot:verified` label plus category and organization labels instead. A newer addition, **Web Bot Authentication**, lets a bot cryptographically sign its requests against a public key directory; a verified signature (`web_bot_auth:verified`) causes the category-block and `TGT_TokenAbsent` rules to skip that request entirely, a mechanism for bots that want to identify themselves honestly and be let through, not evade detection.
|
||||
|
||||
## What an engine answers honestly, and what a browser cannot touch
|
||||
|
||||
`SignalAutomatedBrowser`, `TGT_SignalBrowserAutomationExtension`, and `TGT_SignalBrowserInconsistency` are the rules a real, engine-level browser answers by construction: a genuinely real Firefox, patched below the JavaScript layer, not scripted from a content script, does not carry automation-framework tells, does not have a Selenium-style extension installed, and does not produce internally inconsistent browser-interrogation data, because nothing is faking any of those signals from the inside. That is the same argument this corpus makes for [BotD](botd-explained.md) and [CreepJS](creepjs-explained.md), applied to a managed rule group instead of an open-source script.
|
||||
|
||||
Several rule families sit entirely outside what any browser engine can affect. `SignalKnownBotDataCenter` and the cloud-service-provider signal read the network origin, not the browser. The `TGT_VolumetricSession` and `TGT_TokenReuseIp/Country/Asn` families score session and token behavior across time and across requests, a property of how the automation is orchestrated (how many machines, how many networks, how fast) rather than of the browser rendering any one page. And `TGT_ML_CoordinatedActivity`, by AWS's own description, runs on aggregate traffic statistics across a site's whole visitor population, comparing against a baseline no single session's engine fidelity can influence.
|
||||
|
||||
`invisible_playwright` does not claim to defeat AWS WAF Bot Control's targeted protections as a system. It answers the automation-signature and browser-consistency rules honestly, because there is no override for them to catch, and it has nothing to say about IP reputation, token-reuse patterns across a fleet of sessions, or AWS's own traffic-baseline machine learning, all of which are orchestration-level properties, not engine-level ones.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What is the difference between Common and Targeted protection?** Common uses static, self-identifying signals (user-agent strings, known scraping-framework patterns) and needs no client-side code. Targeted adds fingerprinting and behavior heuristics via a JavaScript/mobile SDK, plus a token that carries proof of a passed challenge or CAPTCHA across requests.
|
||||
|
||||
**What is the AWS WAF token, exactly?** A piece of state the SDK generates and attaches to requests, carrying a session identifier, a browser-fingerprint identifier, and the status of any challenge or CAPTCHA solve. Rules check the token's status (`accepted`, `rejected:*`, `absent`) rather than re-scoring every request from nothing.
|
||||
|
||||
**Does AWS WAF Bot Control use machine learning?** Yes, in the `TGT_ML_` rule family specifically, trained on traffic statistics like timestamps, browser characteristics and prior URLs visited, aimed at distributed coordinated activity rather than any single request. It is on by default for Targeted protection and can be disabled.
|
||||
|
||||
**What is token reuse, and why does it matter?** The same proof-of-legitimacy token appearing across multiple IPs, countries, or ASNs within a five-minute window. It is a detection axis with no browser-level answer, because it scores how a token is being shared, not what any individual session's browser does.
|
||||
|
||||
**Does Bot Control block search engines and other known-good bots?** No. AWS maintains a verified-bot list that gets labeled and passed rather than blocked, and a newer cryptographic mechanism, Web Bot Authentication, lets a bot sign requests to prove its identity instead of being challenged.
|
||||
|
||||
**Does a real browser engine defeat AWS WAF Bot Control?** It answers the automation-signature and browser-consistency rules honestly, which removes that whole failure class. It has no bearing on IP/data-center signals, token-reuse-across-sessions rules, or the ML-based coordinated-activity detection, all of which operate above the level of any single browser.
|
||||
|
||||
**Does invisible_playwright bypass AWS WAF Bot Control?** No. This project does not sell or claim a bypass service for AWS WAF or any comparable vendor.
|
||||
|
||||
**See also:** [How do websites detect bots?](how-do-websites-detect-bots.md) for where a managed-rule-group check like this sits among the other layers; [ASN and IP reputation in bot detection](asn-and-ip-reputation-in-bot-detection.md) for the network-origin signals Bot Control's data-center rule leans on; and [How Cloudflare Turnstile actually works](cloudflare-turnstile-explained.md) for a comparably-documented token-and-challenge model from a different vendor.
|
||||
|
||||
## Sources
|
||||
|
||||
- AWS, [AWS WAF Bot Control components](https://docs.aws.amazon.com/waf/latest/developerguide/waf-bot-control-components.html),
|
||||
retrieved 2026-08-30, for the Common/Targeted protection-level distinction, the `TGT_`/`TGT_ML_` rule-name conventions, and the SDK/token integration requirement.
|
||||
- AWS, [AWS WAF Bot Control rule group](https://docs.aws.amazon.com/waf/latest/developerguide/aws-managed-rule-groups-bot.html),
|
||||
retrieved 2026-08-30, for the full rule listing quoted in the table above, the token status labels (`accepted`/`rejected:*`/`absent`), the verified-bot list and Web Bot Authentication mechanism, and the token-reuse rule thresholds.
|
||||
- AWS, [Using managed rule groups in AWS WAF](https://docs.aws.amazon.com/waf/latest/developerguide/waf-managed-rule-groups.html),
|
||||
retrieved 2026-08-30, for how a managed rule group is added to a Web ACL.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright), a Firefox
|
||||
patched at the C++ level. AWS documents its Bot Control rules more specifically, by name and by
|
||||
default action, than almost any other vendor in this corpus, which is why this page quotes rule
|
||||
names directly rather than reconstructing them from outside reverse engineering.*
|
||||
@@ -41,13 +41,13 @@ internally consistent identity per session - GPU, canvas, audio, fonts, screen,
|
||||
concrete things move:
|
||||
|
||||
- **The engine the screenshots come from.** The pixels the model sees are rendered by a
|
||||
browser whose fingerprint, TLS handshake and driver layer read as a genuine Firefox
|
||||
rather than as an automation build announcing itself. This is why it clears most
|
||||
browser whose fingerprint, TLS handshake and driver layer read as a genuine Firefox,
|
||||
not as an automation build announcing itself. This is why it clears most
|
||||
fingerprint, TLS and driver-layer checks: it is built to look like a real browser
|
||||
driven by a real person, not to suppress signals. A suppressed or blank surface is its
|
||||
own tell, so the goal is a present, plausible value, not a missing one.
|
||||
- **The page the clicks land on.** Coordinate clicks arrive on a page inside that engine,
|
||||
and pointer motion between them follows a Bezier curve rather than teleporting from
|
||||
and pointer motion between them follows a Bezier curve instead of teleporting from
|
||||
point to point.
|
||||
|
||||
What it does not touch is equally important, and the next section is about that.
|
||||
|
||||
@@ -20,7 +20,7 @@ That single fact turns the Battery API into a small but reliable consistency che
|
||||
page that claims to be Firefox in its user agent, and then successfully obtains a
|
||||
battery object, has not measured your battery. It has caught a browser that is lying
|
||||
about what it is. This page explains why that happens, why the honest answer is to have
|
||||
no Battery API rather than a convincing fake one, and how a genuine Firefox build gets
|
||||
no Battery API instead of a convincing fake one, and how a genuine Firefox build gets
|
||||
that for free.
|
||||
|
||||
## What the Battery Status API was, and why Firefox dropped it
|
||||
|
||||
@@ -0,0 +1,211 @@
|
||||
---
|
||||
title: "Beyond robots.txt: How Sites Actually Block AI Crawlers Now"
|
||||
description: "robots.txt is a request a crawler can ignore, not a lock. What sites actually run underneath it in 2026: rate limiting, behavioral bot scoring, IP and ASN blocking, and decoy mazes, read from Cloudflare's own docs and real practitioner writeups."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 37
|
||||
---
|
||||
|
||||
|
||||
# Beyond robots.txt: How Sites Actually Block AI Crawlers Now
|
||||
|
||||
`robots.txt` is a text file a crawler can read and ignore. Nothing about HTTP forces
|
||||
a client to fetch it, parse it, or honor a single line inside it. It has worked as
|
||||
well as it has for thirty years because the crawlers that mattered, mostly search
|
||||
engines with a reputation to protect, chose to honor it. A crawler with no brand to
|
||||
protect and a mandate to collect training data has a different set of incentives, and
|
||||
2026 is the year that gap became a line item.
|
||||
|
||||
This page is about what a site actually runs underneath robots.txt once it decides a
|
||||
polite request is not enough. None of it is exotic. All of it is documented by the
|
||||
vendors running it or reported by people who watched it happen to their own traffic.
|
||||
|
||||
## Why the file alone was never going to hold
|
||||
|
||||
Cloudflare's own numbers make the gap concrete. As of a mid-2026 measurement, only
|
||||
2.98% of the top one million web properties actively blocked AI crawlers, even though
|
||||
38.73% of them were seeing AI-bot traffic hit their servers. Separately, Cloudflare
|
||||
found that only 37% of the top 10,000 domains have a robots.txt file at all, and most
|
||||
of those never got around to adding an AI-specific disallow line. A file nobody wrote
|
||||
blocks nothing, and a file that only asks nicely blocks only the crawlers that were
|
||||
already going to comply.
|
||||
|
||||
Cloudflare says the quiet part directly in its own writing on the subject: "user
|
||||
agents are trivial for bot operators to change." A `Disallow` line keyed to a
|
||||
crawler's declared name works only until that crawler stops declaring its name, and
|
||||
nothing about the standard requires it to keep declaring it.
|
||||
|
||||
## Layer 1: rate limiting
|
||||
|
||||
The simplest response treats crawler traffic as a load problem rather than an
|
||||
identity problem: cap how many requests one IP or session can make in a window.
|
||||
Scraping-infrastructure writeups describe the logic plainly, a real visitor rarely
|
||||
loads dozens of pages a second, a scripted crawler often will, so a request-rate cap
|
||||
catches the volume even when the requester's identity is unknown. It is cheap to run
|
||||
and it is also the layer a distributed crawler defeats almost by construction: spread
|
||||
the same total request volume across enough source addresses and every individual
|
||||
address stays under the cap while the aggregate load on the origin does not move.
|
||||
Practitioner accounts of the current AI-crawler wave describe exactly that shape,
|
||||
several large model crawlers hitting a site concurrently producing a load pattern
|
||||
that looks, from the server's side, functionally identical to an unintentional
|
||||
denial-of-service.
|
||||
|
||||
## Layer 2: behavioral scoring, underneath the user agent
|
||||
|
||||
Cloudflare's blocking toggle is not, underneath, a user-agent filter. It runs a
|
||||
machine-learned bot score against every request, built from what Cloudflare calls its
|
||||
own global traffic signals, and the score is what a WAF rule actually keys on: block
|
||||
or challenge everything scoring under a threshold, independent of what the request
|
||||
claims to be. Cloudflare's own writeup on a specific evasive crawler makes the point
|
||||
directly: the traffic it examined scored "firmly below 30" on its bot scale even after
|
||||
the operator had already started rotating its declared identity, because the score is
|
||||
not reading the declared identity in the first place. This is the same family of idea
|
||||
behind [how a fingerprint separates a real engine from a claimed one](what-is-a-browser-fingerprint.md),
|
||||
applied to a crawler instead of a browser tab.
|
||||
|
||||
## Layer 3: IP and ASN blocking, and why it is a losing race
|
||||
|
||||
A site can also block by network origin instead of by header: known crawler IP
|
||||
ranges, or entire hosting-provider ASNs, dropped at the firewall. It works cleanly
|
||||
against a crawler that publishes its ranges and only operates from them. It works
|
||||
badly against everything else, because most AI crawlers do not publish complete
|
||||
ranges, and a scraper that wants to keep collecting has residential proxy pools and
|
||||
rotating cloud addresses available to it at commodity prices. [What ASN and IP
|
||||
reputation actually score, and how fast an address's reputation decays once it
|
||||
changes hands, is covered on its own page](asn-and-ip-reputation-in-bot-detection.md);
|
||||
the short version is that blocking by address is a race the crawler operator can
|
||||
choose to run, and choosing not to fight that race is why sites reach for the layers
|
||||
below instead.
|
||||
|
||||
## Layer 4: honeypots, tarpits, and the AI-specific version of both
|
||||
|
||||
A honeypot is a link or field a real visitor never sees and a script that blindly
|
||||
processes every element in the DOM will trigger. [How that trick actually works, the
|
||||
CSS that hides it and the reason `opacity: 0` is a different case from
|
||||
`display: none`, has its own page](honeypot-fields-explained.md). A tarpit is the
|
||||
same idea aimed at whole pages: serve a crawler an endless sequence of generated
|
||||
content instead of a block page, so the crawler keeps consuming CPU and bandwidth
|
||||
instead of your actual pages.
|
||||
|
||||
Cloudflare ships a purpose-built version of this aimed specifically at AI training
|
||||
crawlers, called AI Labyrinth. Per Cloudflare's own documentation, the mechanism adds
|
||||
invisible links carrying a `nofollow` directive throughout a protected site. A crawler
|
||||
that honors `nofollow`, which is most of the ones with a reputation to protect, simply
|
||||
never follows them and never notices the trap exists. A crawler that ignores it walks
|
||||
into "a maze of never-ending links" generated to look like real content. Cloudflare's
|
||||
own description of what happens next: "their details are recorded and used by all
|
||||
Cloudflare customers who choose to block AI bots," turning one site's trap into a
|
||||
shared blocklist entry rather than a one-off inconvenience for a single crawler
|
||||
operator.
|
||||
|
||||
## Layer 5: the policy layer catching up to the traffic
|
||||
|
||||
The newest development is not a new detection mechanism at all, it is Cloudflare
|
||||
restructuring what "block AI bots" even means. Starting September 15, 2026, per
|
||||
Cloudflare's own announcement, the single AI-bot toggle splits into three named
|
||||
categories: **Search** ("any behavior that collects or indexes your content, so it
|
||||
can answer questions about it later"), **Agent** ("automated behavior that is acting,
|
||||
usually in real time, on a person's behalf, to get something done right now"), and
|
||||
**Training** ("a crawler taking your content to train or fine-tune a model"). New
|
||||
domains onboarding after that date get Training and Agent blocked by default on
|
||||
pages that carry ads, while Search stays allowed by default. Cloudflare's own
|
||||
documentation is direct about the collateral effect: a crawler that serves more than
|
||||
one purpose, and Cloudflare names Googlebot, Applebot and Bingbot specifically, gets
|
||||
treated by whichever rule is most restrictive, so a site that blocks Training blocks
|
||||
those crawlers too unless it opts back in. Alongside the free managed-robots.txt
|
||||
feature Cloudflare also ships, which prepends its own `Disallow` directives for
|
||||
crawlers like `Google-Extended` and `Applebot-Extended` ahead of whatever a site
|
||||
already had, the policy layer is now doing work the plain-text file never could on
|
||||
its own: it is enforced at the edge, not merely requested in a file a crawler is free
|
||||
to skip.
|
||||
|
||||
## Where a real browser engine fits, and where it does not
|
||||
|
||||
This corpus exists because a page that runs JavaScript can tell a genuine browser
|
||||
engine from a scripted stand-in, and layer 2 above, the behavioral bot score sitting
|
||||
under every request, is exactly that kind of check. A crawler that is a real browser
|
||||
engine rather than a bare HTTP client answers a JavaScript-backed consistency check
|
||||
the way any other real instance of that engine does, for the same reason [a real
|
||||
Firefox passes most of BotD's detector list for free](botd-explained.md): there is
|
||||
nothing spoofed to catch.
|
||||
|
||||
That is the entire boundary, and it is worth being precise about it. Layers 1, 3 and
|
||||
5 above have nothing to do with what a browser engine is. A rate limit counts
|
||||
requests regardless of what sent them. An IP block reads the network address a
|
||||
connection arrives on, which [no fingerprint changes](can-websites-detect-a-datacenter-proxy-ip.md).
|
||||
A site's choice to block the Training category under the new policy layer is a
|
||||
classification decision made before your request is even inspected. None of that is
|
||||
a promise this project or any browser-identity tool makes, and a claim that engine
|
||||
realness clears a rate limit or an IP block would be false on its face.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does robots.txt actually stop AI crawlers from scraping a site?** No, by design.
|
||||
It is an advisory convention every well-known standard describes as voluntary. A
|
||||
crawler that chooses not to read it, or reads it and ignores it, faces no protocol-level
|
||||
consequence for doing so.
|
||||
|
||||
**What actually stops a non-compliant crawler, if not robots.txt?** A layered stack:
|
||||
rate limiting by request volume, a machine-learned bot score independent of declared
|
||||
identity, IP/ASN blocking, honeypots and tarpits that catch a scraper's own
|
||||
crawling logic, and, as of late 2026, a policy layer that treats Search, Agent and
|
||||
Training traffic as three separately blockable categories.
|
||||
|
||||
**Can IP blocking alone keep an AI crawler out?** Only against one that only operates
|
||||
from published, stable ranges. Most large-scale scraping today runs on rotating
|
||||
residential or cloud addresses precisely because a fixed-range block is easy to set
|
||||
up and easy to route around.
|
||||
|
||||
**What is Cloudflare's AI Labyrinth?** A honeypot built for crawlers specifically:
|
||||
invisible, `nofollow`-tagged links that a compliant crawler skips and a non-compliant
|
||||
one falls into, generating an endless sequence of decoy pages while logging the
|
||||
crawler for Cloudflare's shared blocklist.
|
||||
|
||||
**Will blocking the "Training" category also block Google Search?** It can. Cloudflare's
|
||||
own documentation states that a multi-purpose crawler like Googlebot gets treated by
|
||||
whichever category rule is strictest, so blocking Training blocks Googlebot's crawl
|
||||
on the pages that rule covers unless the site opts back in.
|
||||
|
||||
**Does invisible_playwright help get past any of this?** Only the part that is
|
||||
actually a browser-identity check. A real, engine-level Firefox answers a
|
||||
JavaScript-backed consistency probe honestly, which is what behavioral bot scoring
|
||||
partly measures. It changes nothing about a rate limit, an IP or ASN block, a
|
||||
honeypot your own crawling logic walks into, or a site's policy decision to block a
|
||||
traffic category outright.
|
||||
|
||||
## Sources
|
||||
|
||||
- Cloudflare, ["Declare your AIndependence: block AI bots, scrapers and crawlers with
|
||||
a single click"](https://blog.cloudflare.com/declaring-your-aindependence-block-ai-bots-scrapers-and-crawlers-with-a-single-click/),
|
||||
retrieved 2026-08-30, for the 2.98%/38.73% blocking-versus-traffic figures, the
|
||||
machine-learned bot-score mechanism, and the "user agents are trivial... to change"
|
||||
quote.
|
||||
- Cloudflare, ["Control content use for AI training with Cloudflare's managed
|
||||
robots.txt and blocking for monetized content"](https://blog.cloudflare.com/control-content-use-for-ai-training/),
|
||||
retrieved 2026-08-30, for the 37%-of-top-10,000-domains robots.txt figure, the
|
||||
managed robots.txt mechanism, and the ad-page-only blocking feature.
|
||||
- Cloudflare, ["Your site, your rules: new AI traffic options for all customers"](https://blog.cloudflare.com/content-independence-day-ai-options/),
|
||||
retrieved 2026-08-30, for the Search/Agent/Training three-tier system, its
|
||||
September 15, 2026 effective date, the default-blocking rules, and the
|
||||
multi-purpose-crawler quote naming Googlebot, Applebot and Bingbot.
|
||||
- Cloudflare, [AI Labyrinth](https://developers.cloudflare.com/bots/additional-configurations/ai-labyrinth/),
|
||||
retrieved 2026-08-30, for the invisible `nofollow`-link mechanism and the shared
|
||||
detection quote.
|
||||
- Stytch, ["How to block AI web crawlers without breaking your site"](https://stytch.com/blog/how-to-block-ai-web-crawlers/),
|
||||
retrieved 2026-08-30, for the named-crawler landscape, the rate-limiting and IP/UA
|
||||
blocking mechanics and their stated limitations, and the honeypot/tarpit
|
||||
description.
|
||||
|
||||
**See also:** [Honeypot fields and hidden links: how sites trap scrapers](honeypot-fields-explained.md),
|
||||
[what ASN and IP reputation score in bot detection](asn-and-ip-reputation-in-bot-detection.md),
|
||||
[can websites detect a datacenter or proxy IP?](can-websites-detect-a-datacenter-proxy-ip.md),
|
||||
and [how Cloudflare Turnstile actually works](cloudflare-turnstile-explained.md) for the
|
||||
challenge layer that sits beside, not instead of, everything on this page.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. It answers the
|
||||
browser-identity layer honestly; it does not touch a rate limit, an IP block, a
|
||||
honeypot your own code walks into, or a site's decision to block a traffic category
|
||||
outright.*
|
||||
@@ -35,7 +35,7 @@ look. Line them up and the confusion evaporates:
|
||||
belongs to the same visitor as before. It is about linkability, not about looking
|
||||
automated.
|
||||
- **A reCAPTCHA v3 score** is a risk estimate between 0.0 and 1.0, built mostly from
|
||||
behaviour and reputation rather than from what the DOM reports at all.
|
||||
behaviour and reputation, not from what the DOM reports at all.
|
||||
|
||||
| Number | The question it answers | What it reads | What moves it |
|
||||
|---|---|---|---|
|
||||
|
||||
+14
-177
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "browser-use gets detected: what you can and cannot change"
|
||||
description: "browser-use drives Chrome over CDP. What BrowserProfile lets you change, what stays out of reach on a server, and the timing tell specific to AI agents."
|
||||
description: "browser-use drives Chrome over CDP. What BrowserProfile lets you change and what stays out of reach. This page moved to the AIHawk wiki."
|
||||
parent: "AI Agents and Frameworks"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 2
|
||||
@@ -9,182 +9,19 @@ nav_order: 2
|
||||
|
||||
# browser-use gets detected: what you can and cannot change
|
||||
|
||||
If your browser-use agent works locally and gets challenge pages on a server, the
|
||||
problem is usually not the agent and not the prompt. It is the browser it drives and the
|
||||
machine it runs on, and only some of that is reachable from configuration.
|
||||
This page moved to the AIHawk wiki, where the agent-experience content now
|
||||
lives:
|
||||
|
||||
This page is what `BrowserProfile` actually exposes, what those settings fix, what stays
|
||||
out of reach, the signal that is specific to agent-driven sessions, and the honest answer
|
||||
about swapping in a different engine.
|
||||
**[browser-use getting blocked: what you can and cannot change](https://github.com/feder-cr/AIHawk/wiki/browser-use-getting-blocked)**
|
||||
|
||||
## What browser-use gives you to change
|
||||
The unchanged short answer: browser-use exposes a real set of levers
|
||||
(`executable_path`, `user_data_dir`, `proxy`, `headless`, `args`), all of
|
||||
them Chromium-family, and none of them reaches the machine underneath - the
|
||||
GPU, fonts, audio and screen a server answers with. A stealth-patched Firefox
|
||||
is not a drop-in for its CDP driver; the route that accepts a different
|
||||
engine is MCP.
|
||||
|
||||
browser-use's `BrowserProfile` lets you change six things: which browser binary
|
||||
launches, its channel, a persistent profile directory, proxy, headless mode, and extra
|
||||
command-line arguments. Everything else about the browser and the machine it runs on is
|
||||
out of its reach. These fields are read from `browser_use/browser/profile.py`, the
|
||||
configuration surface:
|
||||
|
||||
| Field | What it does |
|
||||
|---|---|
|
||||
| `executable_path` | which browser binary to launch |
|
||||
| `channel` | a Chromium channel |
|
||||
| `user_data_dir` | a persistent profile directory |
|
||||
| `proxy` | proxy settings for the session |
|
||||
| `headless` | headless or headed |
|
||||
| `args` | extra command-line arguments |
|
||||
|
||||
That is a real set of levers, and three of them matter more than people use them for.
|
||||
|
||||
### executable_path, and what it expects
|
||||
|
||||
`executable_path` exists, and it expects a **Chromium-family** browser. The surrounding
|
||||
code in `browser_use/browser/chrome.py` is entirely Chrome logic: finding a Chrome
|
||||
executable, deriving the Chrome user-data directory from it, enumerating Chrome profiles.
|
||||
The channel type is a Chromium channel.
|
||||
|
||||
The practical use of that field is pointing at your **real installed Chrome** rather
|
||||
than the bundled Chromium. [Those are not the same browser](chromium-is-not-chrome.md):
|
||||
the codec set differs, the branding differs, and a real Chrome install is a far more
|
||||
common thing to be than a bundled test build.
|
||||
|
||||
### user_data_dir, which is underused
|
||||
|
||||
Pointing this at a profile that has genuinely been used is the single highest-value
|
||||
change available in the configuration, because it is the only one that addresses history
|
||||
rather than hardware.
|
||||
|
||||
An agent session starting from an empty profile is a browser that has never been
|
||||
anywhere, which is
|
||||
[most of why a fresh browser scores badly](recaptcha-v3-score.md). The traps that come
|
||||
with persistent profiles are covered separately in
|
||||
[what a persistent profile fixes and breaks](persistent-profiles.md), and the pairing
|
||||
rule there applies here too.
|
||||
|
||||
## What configuration cannot reach
|
||||
|
||||
Everything about the machine. None of the fields above changes any of these, and on a
|
||||
server all of them are true at once:
|
||||
|
||||
- **No GPU**, so WebGL reports a software renderer.
|
||||
[What those strings mean](webgl-renderer-strings.md).
|
||||
- **A container font set** that does not match the claimed platform.
|
||||
[Why installing more is not the fix](headless-fonts-differ.md).
|
||||
- **No audio device**, so the audio values fall back to defaults.
|
||||
[The seven values](audiocontext-fingerprinting.md).
|
||||
- **A screen with no taskbar** and a default resolution.
|
||||
[The relationships that have to hold](screen-size-headless-tells.md).
|
||||
- **Codec support** that describes a slim build rather than a desktop install, including
|
||||
whether decoding is hardware accelerated.
|
||||
[Three surfaces in one API](codec-fingerprinting.md).
|
||||
- **A TLS handshake** decided before any of this by the network stack.
|
||||
[Which no page-level layer can touch](ja3-ja4-tls-fingerprint.md).
|
||||
|
||||
This is why "it works on my laptop and not in Docker" is the most common shape of the
|
||||
problem. The agent is identical; the machine is not.
|
||||
[The container version of this list](playwright-docker-detection.md) goes through it in
|
||||
order.
|
||||
|
||||
## The tell that is specific to agent-driven sessions
|
||||
|
||||
The tell specific to agent-driven sessions is timing, not fingerprint: an agent pauses to
|
||||
think between actions, and those pauses cluster around model latency in a shape that human
|
||||
reading never produces. This part does not apply to ordinary scraping and does apply to
|
||||
browser-use.
|
||||
|
||||
An agent thinks between actions. It reads the page, calls a model, waits for a response,
|
||||
then acts. That produces
|
||||
[an interaction rhythm with a very particular shape](ai-agent-timing-signal.md):
|
||||
|
||||
- **Long, similar pauses before each action**, clustered around model latency rather than
|
||||
around reading speed.
|
||||
- **No movement during the pause.** A person reading a page moves the pointer, scrolls
|
||||
slightly, drifts. An agent's pointer is perfectly still for two seconds and then
|
||||
arrives exactly on a button.
|
||||
- **Actions that land dead centre** on their targets, because coordinates come from the
|
||||
accessibility tree rather than from a hand.
|
||||
- **No wasted actions.** People scroll past things, hover over what they do not click,
|
||||
and change their minds.
|
||||
|
||||
None of that is fixed by a stealth setting, and it is worth knowing because it explains
|
||||
blocks that arrive **after** a few interactions rather than at the first page load. That
|
||||
timing is the diagnostic:
|
||||
[a block at first load points at the fingerprint or the address, a block after an
|
||||
interaction points at behaviour](playwright-detected-as-bot.md).
|
||||
|
||||
## Can I use a stealth-patched Firefox with browser-use?
|
||||
|
||||
No, and it is better to say so plainly than to publish a workaround that does not work.
|
||||
|
||||
browser-use drives its browser over the Chrome DevTools Protocol, with Chrome-specific
|
||||
arguments and Chrome profile handling. A Firefox binary in `executable_path` is not a
|
||||
drop-in: the driver would be speaking a protocol the browser does not implement.
|
||||
|
||||
If you specifically want an engine whose fingerprint is set in its own source, the route
|
||||
that works for agents is a different driver. Microsoft's
|
||||
[`playwright-mcp`](https://playwright.dev/docs/getting-started-mcp) accepts a browser
|
||||
and an executable path and speaks MCP, so an agent framework that talks MCP can drive a
|
||||
patched Firefox through it.
|
||||
[That integration is written up here](integrations/playwright-mcp.md).
|
||||
|
||||
That is a genuine trade: you give up browser-use's agent loop and get an engine-level
|
||||
fingerprint. Which one matters depends on whether your blocks are arriving because of the
|
||||
browser or because of the behaviour, and the timing test above tells you which.
|
||||
|
||||
## Conclusion
|
||||
|
||||
browser-use exposes enough configuration to fix the two things configuration can fix:
|
||||
which browser binary runs, and whether the profile has a past. Point it at a real Chrome
|
||||
and at a profile that has been used, and you have taken the available wins.
|
||||
|
||||
Everything else divides into two piles. The machine-level tells are shared with every
|
||||
other automation tool and are fixed by changing the machine or the engine, neither of
|
||||
which is a browser-use setting. The agent-rhythm tells are specific to this class of tool
|
||||
and are not fixed by any fingerprint work at all.
|
||||
|
||||
Knowing which pile you are in takes one experiment: note whether the block arrives at the
|
||||
first request or after a few actions.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Why does my browser-use agent get blocked on a server but not locally?** Because the
|
||||
server has no GPU, few fonts, no audio device and a default screen, and the agent is
|
||||
identical in both places.
|
||||
|
||||
**Can I set a custom browser in browser-use?** Yes, `executable_path` in
|
||||
`BrowserProfile`, and it expects a Chromium-family browser. Pointing it at your real
|
||||
Chrome rather than the bundled Chromium is worth doing.
|
||||
|
||||
**Can I use a stealth Firefox with browser-use?** No. It drives over CDP, which Firefox
|
||||
does not implement in the way the driver expects.
|
||||
|
||||
**Does a persistent profile help?** Yes, more than most settings, because it is the only
|
||||
one that addresses having no history. Read the traps first.
|
||||
|
||||
**Why do blocks arrive after a few actions rather than immediately?** That usually points
|
||||
at behaviour rather than fingerprint, and agent pacing has a recognisable shape.
|
||||
|
||||
**Does adding a proxy fix it?** It changes where you come from. If the browser is
|
||||
announcing a datacenter through its GPU and fonts, the address was not the problem.
|
||||
|
||||
**See also:** [the checklist for being detected on one site](playwright-detected-as-bot.md),
|
||||
which is the order to work in,
|
||||
[Playwright in Docker](playwright-docker-detection.md), for the server case, and
|
||||
[Playwright MCP](integrations/playwright-mcp.md), for the agent route that does accept a
|
||||
different engine.
|
||||
|
||||
## Sources
|
||||
|
||||
- `browser_use/browser/profile.py`, which defines the configuration fields listed above,
|
||||
and `browser_use/browser/chrome.py`, which is the Chrome executable and profile
|
||||
handling. Read 2026-07-27.
|
||||
- [Playwright's own MCP documentation](https://playwright.dev/docs/getting-started-mcp),
|
||||
which lists `firefox` among the supported `--browser` values, confirming that route
|
||||
(unlike browser-use) is not Chromium-only. Read 2026-08-06.
|
||||
- The machine-level surfaces are each documented on their own page, linked above.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. This page says our engine does not fit browser-use,
|
||||
because it does not, and a guide claiming otherwise would waste your afternoon.*
|
||||
The mechanism layer stays on this wiki:
|
||||
[Playwright in Docker and the datacenter machine](playwright-docker-detection.md),
|
||||
[WebGL renderer strings](webgl-renderer-strings.md), and
|
||||
[why headless fonts differ](headless-fonts-differ.md).
|
||||
@@ -65,7 +65,7 @@ most of why people get confused.
|
||||
- **ClientRects.** Reads the sub-pixel bounding boxes of positioned elements with
|
||||
[`getClientRects()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getClientRects).
|
||||
Like canvas, the exact fractional geometry varies with the
|
||||
rendering stack, so it is a fingerprint rather than a setting.
|
||||
rendering stack, so it is a fingerprint instead of a setting.
|
||||
|
||||
There are more pages - TLS, HTTP headers, geolocation, DNS - but these five are the ones
|
||||
people arrive worried about, and they are all raw-value readouts with no cross-check
|
||||
|
||||
@@ -71,13 +71,13 @@ something isn't in its bundle-only list, and each of those defaults quietly reac
|
||||
the host if you don't close it explicitly:
|
||||
|
||||
- One backend's safety fallback, when the bundle is unreadable, is to fail toward an
|
||||
empty list rather than the host - which breaks rendering visibly instead of leaking
|
||||
empty list instead of the host - which breaks rendering visibly instead of leaking
|
||||
silently, the correct failure direction for a fingerprinting surface.
|
||||
- Another's default path, taken naively, falls straight through to a live host
|
||||
enumeration call the moment the bundle-only condition isn't satisfied.
|
||||
- The third had no bundle-only mode at all going in; it enumerates host and bundled
|
||||
fonts through the same single API call, so keeping the host out requires filtering
|
||||
every result rather than skipping a call.
|
||||
every result instead of skipping a call.
|
||||
|
||||
Closing all three took a different patch per backend, because "don't enumerate the
|
||||
host" means something different to DirectWrite, to fontconfig, and to CoreText. There
|
||||
@@ -89,7 +89,7 @@ CoreText's version of this fix shipped later than Windows' and Linux's, and not
|
||||
because it was harder to write. It was harder to *know was wrong*, because nobody
|
||||
doing the work had a Mac to run it on.
|
||||
|
||||
**Layer one, found by reading the code rather than running it:** the block-at-birth
|
||||
**Layer one, found by reading the code instead of running it:** the block-at-birth
|
||||
hook that stops each backend from falling back to a live host enumeration had been
|
||||
wired into the Windows and Linux font backends, and simply never ported to CoreText.
|
||||
Reading the three backends side by side made that omission visible without running
|
||||
@@ -108,7 +108,7 @@ built in. A hook that is correct and a build that never includes it produce the
|
||||
observed nothing.
|
||||
|
||||
Both layers are closed now, and CoreText enumerates the identical family set the
|
||||
other two backends do. The reason this is worth telling as one story rather than two
|
||||
other two backends do. The reason this is worth telling as one story, not two
|
||||
separate fixes: the first fix looked complete by every check available without a
|
||||
real Mac, and was not. The only thing that caught the second layer was an automated
|
||||
run on the actual operating system, checking the actual output, after the fix that
|
||||
@@ -122,18 +122,18 @@ bundle, zero host fonts leaking through on either,
|
||||
[generic CSS families](https://www.w3.org/TR/css-fonts-4/) (serif, sans,
|
||||
monospace, and the per-script CJK generics) resolving to the same bundled fonts rather
|
||||
than collapsing to whatever the host happens to have. The same check on macOS runs in
|
||||
CI rather than locally, for the ordinary reason that not every setup has a Mac to test
|
||||
CI, not locally, for the ordinary reason that not every setup has a Mac to test
|
||||
on, and it has passed there too.
|
||||
|
||||
The cost is real and worth naming rather than glossing over. The binary is
|
||||
meaningfully larger, because it now carries real font files rather than relying on
|
||||
The cost is real and worth naming instead of glossing over. The binary is
|
||||
meaningfully larger, because it now carries real font files instead of relying on
|
||||
whatever the OS already had installed. And a fixed bundle also fixes the family list
|
||||
in time: unlike a live host, the browser cannot pick up a font a real Windows Update
|
||||
might add later. Both are the price of an answer that has no per-platform seams to find.
|
||||
|
||||
## Where it still leaks, named rather than hidden
|
||||
## Where it still leaks, named, not hidden
|
||||
|
||||
Consistent with treating a suppressed signal as a fail rather than a pass, the honest
|
||||
Consistent with treating a suppressed signal as a fail instead of a pass, the honest
|
||||
gaps in this approach, found and not yet closed:
|
||||
|
||||
- One backend's [CSS `local()`](https://www.w3.org/TR/css-fonts-4/) font lookup path
|
||||
|
||||
@@ -54,7 +54,7 @@ string](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_debug_renderer_in
|
||||
says so in plain text: a basic or generic renderer name, or the well-known software
|
||||
rasterizer strings. A real desktop reports a specific GPU model from a specific vendor.
|
||||
This is the single loudest VM tell
|
||||
in the browser, because it is a string you can read directly rather than a statistic
|
||||
in the browser, because it is a string you can read directly instead of a statistic
|
||||
you have to accumulate.
|
||||
|
||||
Worse, the string and the pixels can disagree: a renderer that
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
---
|
||||
title: "Why the same canvas draws differently on Windows and Linux"
|
||||
description: "Canvas fingerprints differ across Windows and Linux because the rasteriser, font files, hinting and GPU path differ, not the canvas drawing code."
|
||||
parent: "Canvas, WebGL, Fonts and Audio"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 15
|
||||
---
|
||||
|
||||
|
||||
# Why the same canvas draws differently on Windows and Linux
|
||||
|
||||
Two machines running the exact same `fillText()` and `toDataURL()` calls can return
|
||||
different bytes. A canvas hash never measures the drawing code alone: it measures the
|
||||
text rasteriser, the actual font file behind that family name, the subpixel and
|
||||
hinting policy, and whether a GPU or a software path drew it. Change any one and the
|
||||
pixels change, with nothing wrong in the script itself.
|
||||
|
||||
## What actually differs, mechanically, between two operating systems
|
||||
|
||||
A `fillText()` call looks like one instruction, but several layers sit underneath it
|
||||
before a pixel comes back, and any one of them can move the output between two
|
||||
machines running the identical script.
|
||||
|
||||
### The text rasteriser and its hinting policy
|
||||
|
||||
Windows draws glyphs through DirectWrite, or the older GDI path; Linux desktops
|
||||
typically use FreeType, fed by fontconfig. Both decide, pixel by pixel, how much of
|
||||
each pixel a glyph edge covers, and that depends on the hinting level in force. A
|
||||
glyph spanning eleven and a half pixels gets rounded differently by rasterisers with
|
||||
different hinting rules, and the rounding shows up directly in the readback.
|
||||
|
||||
### Which font file actually backs the family name
|
||||
|
||||
`ctx.font = "16px Arial"` does not point at one universal file. On Windows it
|
||||
resolves to Microsoft's own Arial. On a Linux desktop without Microsoft's fonts
|
||||
installed, the same family name commonly falls back to a metric-compatible substitute
|
||||
such as Liberation Sans, matching Arial's advance widths but not its glyph outlines.
|
||||
Same request, same font name, a different file drawing every letter.
|
||||
|
||||
### Subpixel geometry and antialiasing
|
||||
|
||||
A desktop session with subpixel rendering on draws each glyph edge using a display's
|
||||
red, green and blue sub-elements, producing colour fringing invisible at normal
|
||||
viewing distance but visible in a raw pixel readback. A headless or virtualised
|
||||
environment usually falls back to plain grayscale antialiasing instead, since there
|
||||
is no subpixel layout to target. The glyph looks the same to a human; the bytes do
|
||||
not match.
|
||||
|
||||
### GPU-accelerated versus software rendering paths
|
||||
|
||||
Canvas content can be composited by the GPU or rasterised in software, and which path
|
||||
a machine takes depends on driver support. A software rasteriser and a
|
||||
GPU-accelerated one do not have to agree on sub-pixel rounding, so identical draw
|
||||
commands can differ by a handful of values before fonts even enter the picture.
|
||||
|
||||
## Why text is the least stable element on a canvas
|
||||
|
||||
Draw a plain filled rectangle and the pixel values are close to universal: a solid
|
||||
colour passes through a rasteriser mostly unchanged, so a flat-colour hash tends to
|
||||
agree across machines that disagree on everything else. Draw text instead, and every
|
||||
layer named above gets involved at once: rasteriser, font file, hinting, subpixel
|
||||
policy, GPU path. That is why a text-free canvas is far more stable across machines,
|
||||
and why fingerprinting scripts almost always put a mixed-case string on the probe
|
||||
canvas rather than a plain shape.
|
||||
|
||||
## A canvas hash is a platform tell as much as a machine tell
|
||||
|
||||
Because font rendering is tied so tightly to the operating system, a canvas hash
|
||||
carries platform information whether anyone intended it to.
|
||||
[Windows implies Segoe UI and a specific CJK set; a bare Linux desktop implies
|
||||
DejaVu and Liberation and little else](headless-fonts-differ.md), and text rendered
|
||||
through those two stacks does not converge. That gives a page a checkable claim
|
||||
rather than a rare value: a browser whose user agent says Windows, drawing text whose
|
||||
antialiasing looks like Linux's FreeType instead of Windows' DirectWrite, has
|
||||
contradicted itself, and the check needs only one sample of each platform, not a
|
||||
notion of "normal" in the abstract.
|
||||
|
||||
## What this project does about it, and what it does not
|
||||
|
||||
For the values a page can read back from a canvas, this project ties the output to
|
||||
the session's own seed rather than to whatever the host has, which is what lets [the
|
||||
same identity return the same canvas and WebGL hash on Windows and on
|
||||
Linux](canvas-webgl-cross-platform-consistency.md); [`measureText()`'s numeric fields
|
||||
get the same treatment through a different mechanism](measuretext-textmetrics-fingerprinting.md).
|
||||
That is a statement about what a page can observe, not a claim that the rendering
|
||||
pipeline was rewritten to erase itself: rasterisation here is real drawing, done by
|
||||
[a real, bundled font stack](bundled-fonts-cross-platform.md) rather than a
|
||||
substituted picture, which is why a screenshot still shows real text instead of
|
||||
noise. The honest limit: the fix covers only the readback calls a page can make
|
||||
today, and any new export path a future engine adds needs the same treatment first.
|
||||
|
||||
## Conclusion
|
||||
|
||||
A canvas hash is not a single number a browser decides to report. It is the visible
|
||||
output of a rasteriser, a font file, a hinting policy and a rendering path, four
|
||||
layers a stock browser never controls independently of its operating system. Text
|
||||
draws through all four at once, which is why a text-bearing canvas is the first
|
||||
readback worth checking when a hash looks wrong for the platform a session claims to
|
||||
be.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Why does my canvas fingerprint differ between Windows and Linux?** The pixels come
|
||||
from the OS's rasteriser, its font files, its hinting and subpixel policy, and
|
||||
whether the GPU or software drew the glyph, not from the drawing code.
|
||||
|
||||
**Does the same drawing code produce the same canvas hash on every OS?** No, not on
|
||||
a stock browser. Identical calls run through a different rasteriser and font file on
|
||||
each platform, and the readback reflects that.
|
||||
|
||||
**Is a canvas fingerprint a browser tell or a platform tell?** Mostly a platform
|
||||
tell. Two browsers on the same OS, drawing the same text, agree far more closely
|
||||
than one browser does across two operating systems.
|
||||
|
||||
**Does removing text make the hash more stable?** Yes. Solid fills pass through a
|
||||
rasteriser largely unchanged, while text pulls in the font stack, hinting and
|
||||
subpixel geometry at once.
|
||||
|
||||
**Can a browser match its canvas hash to a claimed operating system exactly?** Only
|
||||
by controlling what a page reads back, since the render itself comes from whichever
|
||||
rasteriser and font files are actually installed.
|
||||
|
||||
**See also:** [canvas fingerprint noise and why per-call randomising
|
||||
fails](canvas-fingerprint-noise.md), [why a canvas fingerprint changes every
|
||||
run](canvas-fingerprint-changes-every-run.md), and [measureText and TextMetrics as a
|
||||
fingerprinting surface](measuretext-textmetrics-fingerprinting.md).
|
||||
|
||||
## Sources
|
||||
|
||||
- [MDN: `CanvasRenderingContext2D.fillText()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillText),
|
||||
[MDN: `HTMLCanvasElement.toDataURL()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL)
|
||||
and [MDN: `CanvasRenderingContext2D.getImageData()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/getImageData),
|
||||
for the calls above.
|
||||
- MDN, `CanvasRenderingContext2D.measureText()`,
|
||||
https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/measureText -
|
||||
it "returns a TextMetrics object that contains information about the measured text
|
||||
(such as its width, for example)", which is the surface this page's text argument rests
|
||||
on. Read 5 September 2026.
|
||||
- This project's own measurements on font rendering, font bundling and canvas
|
||||
readback, referenced via the linked pages on this wiki.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. A canvas hash was never
|
||||
really about the canvas; it was always about everything underneath it.*
|
||||
@@ -8,7 +8,7 @@ nav_order: 3
|
||||
|
||||
# Chromium is not Chrome, and detectors know the difference
|
||||
|
||||
**Short answer:** no, they are not the same, and the gap moved in 2026 rather than closing.
|
||||
**Short answer:** no, they are not the same, and the gap moved in 2026 instead of closing.
|
||||
Playwright's default Chromium - Chrome for Testing since v1.57 - now plays the same
|
||||
H.264/AAC codecs as real Chrome, checked directly in a live session. It still fails
|
||||
Chrome's [Widevine DRM check](https://developer.mozilla.org/en-US/docs/Web/API/Encrypted_Media_Extensions_API), and that part cannot be patched from JavaScript because it is
|
||||
@@ -20,16 +20,16 @@ The gap is real, it moved in 2026, and one part of it is still a **compiled-in c
|
||||
that a page can test for directly and that no amount of JavaScript patching can produce.
|
||||
|
||||
This page is what Playwright actually ships today, what changed and what didn't, why the
|
||||
part that remains cannot be patched, why spoofing the user agent makes it worse rather than
|
||||
part that remains cannot be patched, why spoofing the user agent makes it worse, not
|
||||
better, and why Firefox has no equivalent gap.
|
||||
|
||||
## What Playwright ships today, checked directly rather than assumed
|
||||
## What Playwright ships today, checked directly, not assumed
|
||||
|
||||
Playwright's own browser documentation used to be the whole answer: the default managed
|
||||
Chromium was an open-source build, missing the proprietary parts Google adds on top. As of
|
||||
[Playwright 1.57](https://playwright.dev/docs/release-notes), that changed. The default managed binary - launched with no `channel` set
|
||||
at all - is now **Chrome for Testing**, Google's own dedicated distribution for automated
|
||||
testing, pinned to the Playwright version rather than auto-updating.
|
||||
testing, pinned to the Playwright version instead of auto-updating.
|
||||
|
||||
Chrome for Testing is not the stripped-down build the old default was. It ships the same
|
||||
proprietary codec support as the Chrome a real visitor runs. Checked directly, in a live
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
---
|
||||
title: "Closed shadow roots: what Playwright cannot see"
|
||||
description: "Stock Playwright finds nothing inside a closed shadow root, in Firefox and Chromium alike. Measured, with the page that reproduces it and what this engine does instead."
|
||||
parent: "The Automation Layer"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 45
|
||||
---
|
||||
|
||||
|
||||
# Closed shadow roots: what Playwright cannot see
|
||||
|
||||
A closed shadow root makes `element.shadowRoot` return `null`, and stock
|
||||
Playwright locators stop at that boundary: measured on 5 September 2026
|
||||
against a page with one open and one closed root, stock Firefox and stock
|
||||
Chromium both matched the open content and returned zero matches for the
|
||||
closed content. The engine this wiki documents returns one match for the
|
||||
same closed content, and the page still reads `null`.
|
||||
|
||||
For the ordinary case, open shadow roots, Playwright crosses them by itself
|
||||
and there is nothing to configure: see
|
||||
[how to scrape shadow DOM content with Playwright](how-to-scrape-shadow-dom-playwright.md).
|
||||
This page is about the other case, and it starts with a number rather than
|
||||
an opinion.
|
||||
|
||||
## The measurement, and the page that reproduces it
|
||||
|
||||
The test page defines two custom elements. One attaches its shadow root with
|
||||
`mode: "open"`, the other with `mode: "closed"`, and each puts a unique
|
||||
string inside. Served from `127.0.0.1`, so no network variability, and the
|
||||
same file for every arm.
|
||||
|
||||
```html
|
||||
<open-widget></open-widget>
|
||||
<closed-widget></closed-widget>
|
||||
<script>
|
||||
class OpenWidget extends HTMLElement {
|
||||
connectedCallback() {
|
||||
const r = this.attachShadow({mode: "open"});
|
||||
r.innerHTML = '<p id="inner-open">OPEN_SECRET_VALUE_7788</p>';
|
||||
}
|
||||
}
|
||||
class ClosedWidget extends HTMLElement {
|
||||
connectedCallback() {
|
||||
const r = this.attachShadow({mode: "closed"});
|
||||
r.innerHTML = '<p id="inner-closed">CLOSED_SECRET_VALUE_9911</p>';
|
||||
this.readIt = () => r.querySelector("#inner-closed").textContent;
|
||||
}
|
||||
}
|
||||
customElements.define("open-widget", OpenWidget);
|
||||
customElements.define("closed-widget", ClosedWidget);
|
||||
</script>
|
||||
```
|
||||
|
||||
Three arms, one instrument, same page:
|
||||
|
||||
| arm | `#inner-open` | `#inner-closed` | text inside the closed root | `closed.shadowRoot` |
|
||||
|---|---|---|---|---|
|
||||
| Playwright, stock Firefox | 1 match | 0 matches | 0 matches | `null` |
|
||||
| Playwright, stock Chromium | 1 match | 0 matches | 0 matches | `null` |
|
||||
| Playwright, this engine | 1 match | **1 match** | **1 match** | `null` |
|
||||
|
||||
The stock rows are exactly what Playwright's own documentation promises:
|
||||
"Closed-mode shadow roots are not supported." The third row is this engine,
|
||||
and the last column is the part that matters most: from the page's point of
|
||||
view nothing changed. `element.shadowRoot` still reads `null`, because the
|
||||
resolution happens beneath the page's JavaScript rather than by rewriting
|
||||
what the page can see.
|
||||
|
||||
## Why the boundary exists at all
|
||||
|
||||
`attachShadow({ mode: "closed" })` is defined to hide the subtree from
|
||||
outside code. MDN puts it plainly: elements inside the shadow root "cannot
|
||||
be accessed from JavaScript via the `shadowRoot` property, which is set to
|
||||
`null`". The mode does not hide anything from the component itself, because
|
||||
`attachShadow()` returns the root to the code that called it, and that code
|
||||
keeps the reference for the life of the page.
|
||||
|
||||
So a closed root is an encapsulation choice by the component author, not a
|
||||
protection against automation, and it is not a detection surface either.
|
||||
Nothing about a closed root tells a site who is visiting.
|
||||
|
||||
## How to recognise one in ten seconds
|
||||
|
||||
Three signals together, never one alone. The element renders visible
|
||||
content. A selector aimed inside it returns nothing. And the host's
|
||||
`.shadowRoot`, read from the console, comes back `null`.
|
||||
|
||||
That last signal does not separate a closed root from an element with no
|
||||
shadow root at all. Pair it with the host's own `textContent`: on our test
|
||||
page the closed host returns an empty string while text is plainly on
|
||||
screen, which is the tell. Content you can see, text you cannot read from
|
||||
the host, and a `null` shadow root is a closed root every time.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42, headless=True) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("http://127.0.0.1:8731/page.html")
|
||||
|
||||
host = page.query_selector("closed-widget")
|
||||
print(host.evaluate("el => el.shadowRoot !== null")) # False: null, as the spec says
|
||||
print(host.evaluate("el => el.textContent")) # '' while text is on screen
|
||||
print(page.locator("#inner-closed").count()) # 1 on this engine, 0 on stock
|
||||
```
|
||||
|
||||
## What still works when a selector will not reach
|
||||
|
||||
On stock Playwright the closed subtree is off limits to selectors, and
|
||||
three routes remain, each for a different reason.
|
||||
|
||||
The component's own script keeps full access, so any interface the author
|
||||
deliberately exposed on the host still answers. On the test page above the
|
||||
component sets a `readIt()` method on its host, and `page.evaluate` calling
|
||||
that method returned the closed string on every arm, stock included. A well
|
||||
built component publishes properties, methods, or events dispatched with
|
||||
`composed: true`, and that public surface is the door the author intended.
|
||||
|
||||
Input reaches the component regardless. The host sits in ordinary light DOM,
|
||||
so it has a real bounding box, it can be clicked, and keyboard focus moves
|
||||
into the controls inside it. Neither route lets you name what you are
|
||||
touching, but both reach it.
|
||||
|
||||
And the data usually exists before the component renders it. Most closed
|
||||
components are filled from a network response, and
|
||||
[waiting for that response](wait-for-specific-api-response-playwright.md)
|
||||
sidesteps the rendered tree entirely.
|
||||
|
||||
## The workaround that is worse than the problem
|
||||
|
||||
You will find snippets that patch `Element.prototype.attachShadow` before
|
||||
the page's scripts run so every later call becomes `mode: "open"`. It has
|
||||
two problems. It only wins a timing race you rarely control, and it changes
|
||||
what the page itself can observe: after the patch, `element.shadowRoot`
|
||||
stops being `null` on components whose authors asked for `null`. That is a
|
||||
difference a consistency check can read, which is the opposite of the goal
|
||||
on a wiki like this one.
|
||||
|
||||
The measurement above is the argument against it. Reaching the content while
|
||||
leaving `shadowRoot` at `null` is strictly better than reaching it by making
|
||||
the page lie about itself.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Why does my Playwright locator find nothing when the element is visible?**
|
||||
If the host's `.shadowRoot` reads `null` while text renders on screen, the
|
||||
content is inside a closed shadow root. Stock Playwright locators stop
|
||||
there, in Firefox and Chromium alike.
|
||||
|
||||
**Does Playwright support closed shadow roots?** No. Its documentation says
|
||||
so directly, and the measurement above confirms it on both stock engines:
|
||||
zero matches for content that is plainly rendered.
|
||||
|
||||
**How do I tell an open root from a closed one?** Read `element.shadowRoot`.
|
||||
An object means open. `null` means closed, or no shadow root at all, and the
|
||||
host's empty `textContent` next to visible text separates those two.
|
||||
|
||||
**Can I force a closed root open?** You can patch `attachShadow` before the
|
||||
component runs, and you should not. It depends on a race you do not control
|
||||
and it changes what the page can observe about itself.
|
||||
|
||||
**What if the data only exists inside a closed root?** Call whatever the
|
||||
component exposes on its host, or read the network response that filled it.
|
||||
On this engine, a locator also reaches the content directly.
|
||||
|
||||
**See also:** [scraping open shadow DOM with Playwright](how-to-scrape-shadow-dom-playwright.md),
|
||||
[scraping iframe content with Playwright](how-to-scrape-iframe-content-playwright.md),
|
||||
and [waiting for a specific API response](wait-for-specific-api-response-playwright.md).
|
||||
|
||||
## Sources
|
||||
|
||||
- MDN, `Element.attachShadow()`,
|
||||
https://developer.mozilla.org/en-US/docs/Web/API/Element/attachShadow -
|
||||
the `closed` mode definition and the quoted sentence about `shadowRoot`
|
||||
being set to `null`. Read 5 September 2026.
|
||||
- Playwright, Locators,
|
||||
https://playwright.dev/python/docs/locators - "All locators in Playwright
|
||||
by default work with elements in Shadow DOM" and "Closed-mode shadow roots
|
||||
are not supported". Read 5 September 2026.
|
||||
- Our own measurement, 5 September 2026: the page above served from
|
||||
`127.0.0.1`, run against stock Playwright Firefox, stock Playwright
|
||||
Chromium and this engine, same script for all three arms.
|
||||
|
||||
---
|
||||
|
||||
*From [invisible_playwright](https://github.com/feder-cr/invisible_playwright).
|
||||
The three-arm table is our own run and the test page is printed above so you
|
||||
can reproduce it rather than take our word for it.*
|
||||
@@ -0,0 +1,86 @@
|
||||
---
|
||||
title: "Cloudflare's AI Labyrinth, Explained"
|
||||
description: "Instead of blocking a crawler that ignores robots.txt, Cloudflare feeds it an endless maze of real, AI-generated but irrelevant pages, wasting its time while quietly confirming it is a bot. Read from Cloudflare's own announcement and current docs."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 35
|
||||
---
|
||||
|
||||
|
||||
# Cloudflare's AI Labyrinth, Explained
|
||||
|
||||
Every other page in this corpus is about a gate: a check that decides whether a request gets through. AI Labyrinth is a different idea entirely. It does not block anything. When Cloudflare's systems flag a crawler that is ignoring the site's stated crawl preferences, instead of returning a 403 or a challenge, they hand that crawler an endless supply of real, readable, AI-generated pages that link to more of the same, and let it keep "succeeding" indefinitely against content that was never the site it thinks it is reading.
|
||||
|
||||
Cloudflare announced this on 2025-03-19 as a free, opt-in feature available to every customer, including those on free plans. Read from Cloudflare's own announcement post and its current developer documentation, both retrieved 2026-08-30.
|
||||
|
||||
## Why not just block it
|
||||
|
||||
Cloudflare's own stated reasoning for building a maze instead of a wall is a deliberate, named tradeoff: "blocking malicious bots can alert the attacker that you are on to them, leading to a shift in approach." A blocked crawler learns something immediately, that this site is defended, and can retool: rotate IPs, change its user agent, slow down, try a different path. A crawler wandering deep into a maze of plausible-looking, internally-linked pages does not get that signal. It keeps crawling, believing it is still succeeding, for as long as it is willing to follow links that go nowhere real.
|
||||
|
||||
The scale problem this exists to address is stated plainly too: Cloudflare's own figures describe "AI Crawlers generat[ing] more than 50 billion requests to the Cloudflare network every day," a volume where per-request blocking decisions compete for the same infrastructure the crawlers are hammering in the first place.
|
||||
|
||||
## How the maze is actually built
|
||||
|
||||
The mechanism, per Cloudflare's own description, uses "Workers AI with an open source model to create unique HTML pages on diverse topics." Two details matter for understanding what this is and is not:
|
||||
|
||||
**The content is real, but deliberately unrelated.** Cloudflare states the generated pages cover "scientific facts, just not relevant or proprietary to the site being crawled." It is not garbage text and not misinformation by design, it is genuine, coherent content that has nothing to do with the site a crawler thinks it is scraping, chosen specifically so the maze does not itself become a source of false claims circulating under someone else's domain.
|
||||
|
||||
**It is pre-generated, not created live per request.** Cloudflare's post describes "a pre-generation pipeline that sanitizes the content to prevent any XSS vulnerabilities," with pages stored (in Cloudflare's own infrastructure, via R2 object storage), not generated fresh for every hit. That is a performance and safety choice: generating unique HTML live for every crawler request at Cloudflare's traffic volume would be its own cost and attack surface, and pre-screening for injected script content closes an obvious way a maze of AI-generated pages could otherwise be turned against the very sites serving them.
|
||||
|
||||
## It is also a honeypot, not just a delay tactic
|
||||
|
||||
The links into the maze are placed where, per Cloudflare's own framing, "no human would deliberately explore deep into a maze of AI-generated nonsense." Cloudflare's developer documentation describes these as invisible, `nofollow`-tagged links: they carry no SEO effect and are "only seen by bots," never rendered in a way a real visitor would notice or click. A compliant crawler that honors a site's no-crawl signals never encounters them either, since triggering the maze specifically requires already having decided to ignore those signals.
|
||||
|
||||
That makes following one of these links close to unambiguous evidence of automated, non-compliant crawling. Cloudflare states this data feeds directly back into its detection systems: identifying a crawler this way "with high confidence" contributes fingerprinting signal that improves the machine-learning models Cloudflare uses for bot identification more broadly, shared, per Cloudflare's own materials, across the customer base that opts into blocking AI bots. A single crawler's decision to wander into the maze on one site can sharpen detection everywhere Cloudflare's bot-management systems run.
|
||||
|
||||
## Enabling it, and what changed since launch
|
||||
|
||||
Cloudflare's current documentation describes activation as a single dashboard toggle: navigate to Security settings, filter to bot traffic, and switch AI Labyrinth on, with no additional configuration required. It produces, per Cloudflare's own current wording, "no impact [on] your search engine optimization (SEO) or your website's appearance."
|
||||
|
||||
AI Labyrinth was one early piece of a larger shift in how Cloudflare treats AI crawler traffic broadly. By mid-2026, Cloudflare had extended its crawler-management framing into three explicit categories, Search crawlers (which index and return referral traffic), Agent crawlers (executing real-time tasks on a user's behalf, the same category [an LLM-driven browser agent falls into](ai-agent-timing-signal.md)), and Training crawlers (scraping to embed content into a model permanently), alongside an extension to the `robots.txt` Content Signals format letting a site express which of the three it welcomes. Cloudflare's own announced default, effective 2026-09-15, blocks "mixed-use" crawlers by default specifically on pages that carry advertising. AI Labyrinth sits underneath that broader policy shift as one enforcement mechanism among several, not a standalone feature frozen at its 2025 launch state.
|
||||
|
||||
## What this means for a real, engine-level browser
|
||||
|
||||
This is worth being direct about, because it is a genuinely different kind of mechanism from everything else in this corpus: **AI Labyrinth is not a fingerprint check at all.** It does not read canvas output, WebGL parameters, TLS handshakes, or navigator properties. It is triggered by crawling behavior, following invisible links a normal rendering and interaction pattern never reaches, after a site's crawl preferences have already been ignored. There is no honest-engine argument to make here the way there is for [CreepJS](creepjs-explained.md) or [DataDome's device layer](datadome-explained.md), because nothing about being a genuinely real browser engine changes whether a crawling process follows every link it finds on a page, including invisible ones humans never see.
|
||||
|
||||
`invisible_playwright` is browser-automation infrastructure, not a crawling framework, and this project makes no claim about how any particular scraping logic built on top of it handles hidden links or robots.txt. What is worth stating plainly: a scraper that respects a site's stated crawl preferences and does not follow invisible, `nofollow`-tagged links in the first place never encounters this mechanism at all. AI Labyrinth is aimed at crawlers that have already chosen not to do that.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What is Cloudflare's AI Labyrinth?** A feature that, instead of blocking a crawler ignoring a site's crawl preferences, serves it an endless sequence of real but irrelevant AI-generated pages linking to more of the same, wasting the crawler's resources rather than alerting it to being detected.
|
||||
|
||||
**Why not just block the crawler outright?** Cloudflare's own stated reasoning: blocking tells an attacker they have been noticed, which can prompt them to change tactics. A maze keeps a non-compliant crawler engaged without revealing that it has been identified.
|
||||
|
||||
**Is the maze content fake or harmful?** The pages are genuine, coherent AI-generated content (Cloudflare cites scientific-fact topics as an example), deliberately unrelated to the site being protected, and pre-screened for XSS before being served, per Cloudflare's own description.
|
||||
|
||||
**Does AI Labyrinth affect real visitors or SEO?** No, per Cloudflare's own documentation. The maze's links are invisible, `nofollow`-tagged, and only reachable by something crawling the raw page structure rather than rendering it the way a human browsing session does.
|
||||
|
||||
**Does following a maze link get a crawler blocked immediately?** Cloudflare's own framing treats it primarily as a high-confidence detection signal that feeds its broader bot-identification models, rather than describing an automatic, standalone block triggered by that action alone.
|
||||
|
||||
**Is AI Labyrinth still the whole story on Cloudflare's AI crawler policy?** No. By mid-2026 Cloudflare had layered a three-category crawler framework (Search/Agent/Training) and a `robots.txt` Content Signals extension on top of it, with default blocking rules for certain crawler types phasing in through September 2026. AI Labyrinth is one enforcement mechanism inside that larger, evolving policy.
|
||||
|
||||
**Does a real, engine-level Firefox change whether AI Labyrinth triggers?** No. This mechanism is not a fingerprint check at all; it responds to crawling behavior (following invisible, non-rendered links after ignoring stated crawl preferences), which is a property of the scraping logic driving the browser, not of the browser engine's realness.
|
||||
|
||||
**See also:** [Anubis: the proof-of-work firewall, explained](anubis-proof-of-work-explained.md) for a completely different anti-crawler philosophy built on computational cost rather than deception; [How Cloudflare Turnstile actually works](cloudflare-turnstile-explained.md) for Cloudflare's fingerprint-and-challenge mechanism aimed at human visitors rather than crawlers; and [the AI-agent timing signal](ai-agent-timing-signal.md) for how Cloudflare's own Agent-crawler category overlaps with LLM-driven browser automation.
|
||||
|
||||
## Sources
|
||||
|
||||
- Cloudflare, [Denying AI Bots (announcement post)](https://blog.cloudflare.com/ai-labyrinth/), retrieved 2026-08-30,
|
||||
for the launch date, the "blocking... alerts the attacker" reasoning, the Workers AI generation pipeline, the
|
||||
XSS-sanitization and R2 storage detail, and the honeypot/detection-feedback framing.
|
||||
- Cloudflare, [AI Labyrinth developer documentation](https://developers.cloudflare.com/bots/additional-configurations/ai-labyrinth/),
|
||||
retrieved 2026-08-30, for the current activation steps, the invisible/`nofollow` link mechanism, and the
|
||||
"no impact on SEO" statement.
|
||||
- Cloudflare, [Your site, your rules: new AI traffic options for all customers](https://blog.cloudflare.com/content-independence-day-ai-options/),
|
||||
retrieved 2026-08-30, for the Search/Agent/Training crawler categories, the Content Signals `robots.txt`
|
||||
extension, and the 2026-09-15 default-blocking date for mixed-use crawlers on ad-bearing pages.
|
||||
- Press coverage of the original launch: [Cloudflare Unveils AI Labyrinth: A New Approach to Exhaust AI Crawlers](https://cybersecuritynews.com/cloudflare-unveils-ai-labyrinth-a-new-approach-to-exhaust-ai-crawlers/),
|
||||
retrieved 2026-08-30, cross-checked against Cloudflare's own post for the 2025-03-19 announcement date and
|
||||
free/opt-in availability.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright), a Firefox
|
||||
patched at the C++ level. This mechanism has nothing to do with browser fingerprinting, so this page has
|
||||
nothing to claim about engine realness one way or the other, honestly: a scraper that respects a site's
|
||||
crawl preferences and does not chase invisible links never triggers it in the first place.*
|
||||
@@ -0,0 +1,239 @@
|
||||
---
|
||||
title: "Cloudflare Bot Management, Explained"
|
||||
description: "Cloudflare Bot Management is the always-on scoring engine behind Cloudflare's edge, not the Turnstile widget: a 1-99 bot score from JA3/JA4, HTTP fingerprinting, ML and behavior, computed on nearly every request. Read from Cloudflare's own docs."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 44
|
||||
---
|
||||
|
||||
|
||||
# Cloudflare Bot Management, Explained
|
||||
|
||||
Cloudflare Bot Management is not a widget anyone sees. It is the scoring system running in
|
||||
the background on almost every request to a Cloudflare-protected site, whether that site
|
||||
ever shows a visitor a challenge or not. [Turnstile](cloudflare-turnstile-explained.md), the
|
||||
checkbox-or-nothing widget covered elsewhere on this site, is a separate product a site
|
||||
opts into and embeds on specific pages. Bot Management is the always-on system behind the
|
||||
scenes that produces a score, which can feed a WAF rule, a Turnstile risk decision, or
|
||||
nothing visible at all, depending on how the site owner wired it up.
|
||||
|
||||
Cloudflare sells both under the same "bot" umbrella, and a lot of practitioner writing
|
||||
blends them into one paragraph. This page keeps them apart: what the scoring engine
|
||||
measures, the score itself, the three product tiers it ships in, and where it hands off to
|
||||
Turnstile rather than replacing it. Built from Cloudflare's own developer documentation and
|
||||
one independent technical write-up, retrieved 2026-08-30.
|
||||
|
||||
## The bot score: 1 to 99, and what the number means
|
||||
|
||||
Cloudflare's own definition is direct: "a score of 1 means Cloudflare is quite certain
|
||||
the request was automated, while a score of 99 means Cloudflare is quite certain the
|
||||
request came from a human." Lower is more automated, not the other way around, which
|
||||
trips people up the first time they read a Bot Analytics dashboard.
|
||||
|
||||
The documented bands:
|
||||
|
||||
| Score | Category |
|
||||
|---|---|
|
||||
| 1 | Automated, high confidence |
|
||||
| 2-29 | Likely automated |
|
||||
| 30-99 | Likely human |
|
||||
| Verified bot | A non-malicious, declared automation (search engine crawlers, uptime monitors) scored separately from the numeric band |
|
||||
| 0 | Not computed at all for this request |
|
||||
|
||||
That last row matters more than it looks: a score of 0 is not "definitely human," it means
|
||||
Bot Management never ran a scoring pass on that request, for reasons Cloudflare does not
|
||||
fully enumerate. Reading 0 as a clean bill of health is a misreading of the vendor's own
|
||||
scale.
|
||||
|
||||
Granular, per-request scores are an Enterprise-with-Bot-Management feature. Sites on lower
|
||||
tiers see traffic bucketed into groupings in a dashboard, not the raw 1-99 number, which the
|
||||
tier section below spells out.
|
||||
|
||||
## What actually produces the score
|
||||
|
||||
Cloudflare names four detection engines, and they do not all run on every request or plan:
|
||||
|
||||
| Engine | What it does | Plan requirement |
|
||||
|---|---|---|
|
||||
| Heuristics | Matches every request against "a growing database of malicious fingerprints"; runs on all requests, all plans | All plans |
|
||||
| JavaScript Detections (JSD) | Lightweight, invisible client-side script injection aimed at "headless browsers and other malicious fingerprints"; feeds its result to the other engines | All plans, optional |
|
||||
| Machine Learning (ML) | Cloudflare states this engine "accounts for the majority of all detections," using supervised learning over "headers, session characteristics, and browser signals" to set the final 1-99 score | Business and Enterprise |
|
||||
| Anomaly Detection (AD) | Unsupervised learning against a per-domain traffic baseline to flag outliers | Enterprise, and Cloudflare has been deprecating it |
|
||||
|
||||
Cloudflare's own docs name the categories and stay vague on field-level detail: the company
|
||||
does not publish which headers, timing values or JavaScript properties the ML engine
|
||||
weighs, or what JSD's script reads once injected. A Scrapfly write-up, working from the
|
||||
outside, describes the JS-side probing as covering canvas and WebGL rendering output
|
||||
alongside mouse-movement and click-cadence behavior, reconstructed from observation, the
|
||||
same caveat this corpus applies to [Akamai's sensor payload](akamai-bot-manager-explained.md)
|
||||
and [Imperva's reese84 cookie](imperva-incapsula-explained.md).
|
||||
|
||||
One documented mechanism sits underneath all of this: the `__cf_bm` cookie, necessary for
|
||||
Bot Management (and the free Bot Fight Mode) to function, generated per-site, expiring
|
||||
after 30 minutes of inactivity, and used, in Cloudflare's own words, to "smooth out the bot
|
||||
score and reduce false positives" by carrying a session's established pattern forward
|
||||
instead of re-deriving it cold on every request.
|
||||
|
||||
## The network layer: JA3/JA4 as one input, not the whole score
|
||||
|
||||
TLS fingerprinting is a documented, named input. Cloudflare's own description of JA3/JA4:
|
||||
they "identify TLS clients based on how they initiate connections," and the resulting
|
||||
fingerprint is "a stable identifier across different destination IPs, ports, and
|
||||
certificates." JA4 exists because JA3 decayed: modern browsers randomize TLS extension
|
||||
order per connection, which used to make JA3 hashes inconsistent for the same real browser,
|
||||
and JA4 fixes that by sorting extensions before hashing instead of hashing arrival order.
|
||||
The mechanics of both, and why one can be patched and the other cannot, are covered in
|
||||
depth on [the JA3/JA4 page](ja3-ja4-tls-fingerprint.md) and
|
||||
[the HTTP/2 fingerprint page](http2-fingerprint-detection.md); this page only needs that
|
||||
Cloudflare treats JA3/JA4 and HTTP/2 metadata (SETTINGS values, pseudo-header order) as
|
||||
inputs, exposed to Enterprise customers as `cf.bot_management.ja3_hash` and `ja4` fields
|
||||
for custom WAF rules.
|
||||
|
||||
A matching TLS fingerprint is one input clearing, not a passed score. The same point is
|
||||
made at length for a comparable vendor, where a byte-identical JA3/JA4/HTTP2 fingerprint
|
||||
still did not stop a block on one deployment: see
|
||||
[the documented Camoufox case](akamai-bot-manager-explained.md#the-case-that-shows-matching-fingerprint-is-not-passing).
|
||||
Cloudflare's own ML engine is described the same way, as combining "headers, session
|
||||
characteristics, and browser signals," never any one of those alone.
|
||||
|
||||
## Three tiers, and what each one actually adds
|
||||
|
||||
Cloudflare sells bot detection at three levels; the free and mid tiers use the same
|
||||
underlying engines as Enterprise Bot Management, with less control over what happens next.
|
||||
|
||||
| Tier | Plan | What it adds |
|
||||
|---|---|---|
|
||||
| Bot Fight Mode | Free | Challenges or blocks obvious bots; no per-category actions, no custom rules |
|
||||
| Super Bot Fight Mode | Pro, Business | Adds, in Cloudflare's own phrasing, "configurable actions per bot category, bot analytics, and the ability to create exceptions using WAF custom rules," across three groupings: "Definitely automated," "Likely automated," "Verified bots" |
|
||||
| Bot Management | Enterprise, paid add-on | Per-request numeric scores instead of groupings, JA3/JA4 signal fields for custom rules, dedicated Bot Analytics; Cloudflare recommends it specifically for "API or mobile app traffic" |
|
||||
|
||||
A site on Super Bot Fight Mode and one on full Bot Management run the same engines
|
||||
described above; the difference is what the owner can see and do with the result, not a
|
||||
different sensor underneath. The two are also mutually exclusive on a zone: enabling
|
||||
Enterprise Bot Management replaces the Bot Fight Mode / Super Bot Fight Mode toggles
|
||||
rather than stacking with them.
|
||||
|
||||
## Where Turnstile actually fits into this
|
||||
|
||||
This distinction is worth being precise about, because the two products get merged in
|
||||
casual writing constantly. Bot Management is the always-on scoring system: it runs whether
|
||||
or not the page shows anything, and its output is a number a site owner's rules can act on.
|
||||
[Turnstile](cloudflare-turnstile-explained.md)
|
||||
is a widget a site chooses to embed on a specific page, most often a login, checkout, or
|
||||
comment form, with its own non-interactive checks (proof-of-work, proof-of-space, API
|
||||
probing, covered in full on the Turnstile page) and its own token verified server-side
|
||||
against Siteverify. The two often work together: a site can wire a low Bot Management
|
||||
score into a rule that shows Turnstile specifically to the traffic already flagged,
|
||||
rather than to everyone. But Turnstile is not how Bot Management works, and passing one
|
||||
is not evidence about the other. A visitor with a clean Turnstile pass on one page can
|
||||
still carry a low background bot score on the next request if that page has no Turnstile
|
||||
embedded to act on it, because the underlying score is computed independently of whether
|
||||
any widget is present at all.
|
||||
|
||||
## The ecosystem around it, and what it actually claims
|
||||
|
||||
A real, actively maintained open-source project,
|
||||
[`cloudscraper`](https://github.com/VeNoMouS/cloudscraper) (6.7k stars at the time of
|
||||
writing), is worth naming because it shows what practitioner tooling in this space actually
|
||||
targets: its README describes handling Cloudflare's older "I'm Under Attack Mode"
|
||||
JavaScript challenges (v1-v3) and, since its 3.0 release, Turnstile CAPTCHA challenges,
|
||||
using a JavaScript engine to solve the puzzle payload served. That is a different problem
|
||||
from the one this page describes. Solving a visible challenge is downstream of a decision
|
||||
Bot Management already made to show one; it says nothing about the numeric score itself,
|
||||
never exposed to the client, or the session history the ML engine weighs alongside the
|
||||
current request. Reliably solving every challenge a site serves is not the same as learning
|
||||
what score triggered it.
|
||||
|
||||
## The honest boundary
|
||||
|
||||
An engine-level, patched Firefox like this project answers the client-observable layer
|
||||
honestly: the TLS handshake and the resulting JA3/JA4 hash come from the real network
|
||||
stack, not a JavaScript override, and the canvas, WebGL, font and navigator surfaces JSD's
|
||||
script can read are produced by an actually-genuine engine rather than simulated. That is
|
||||
real, and only part of what Cloudflare's own documentation says the ML engine weighs.
|
||||
|
||||
What stays outside anything a browser build touches: the bot score itself, a server-side
|
||||
number never disclosed to the client that generated it; IP and ASN reputation, which
|
||||
travels with the exit connection, not the browser; `__cf_bm` cookie state accumulated
|
||||
across a session; and whatever the supervised model learned from "billions of daily
|
||||
requests," which no outside party has visibility into. `invisible_playwright` does not
|
||||
claim to defeat, bypass, or predict Cloudflare's bot score. A real engine changes whether
|
||||
the client-side half of that score is computed on honest inputs or spoofed ones; it has no
|
||||
effect on the half that never reaches the client at all.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Is Cloudflare Bot Management the same thing as Turnstile?** No. Bot Management runs on
|
||||
requests regardless of whether a widget is present. Turnstile is a separate, opt-in
|
||||
challenge widget a site embeds on specific pages. The two can be wired together, but
|
||||
neither is a mode of the other.
|
||||
|
||||
**What does a Cloudflare bot score of 1 mean, and what does 99 mean?** 1 is Cloudflare's
|
||||
highest-confidence "this was automated" reading; 99 is the highest-confidence "this was a
|
||||
human" reading. A score of 0 means no scoring pass ran at all, not a clean result.
|
||||
|
||||
**What is Super Bot Fight Mode?** The Pro/Business-tier product, using the same detection
|
||||
engines as Enterprise Bot Management, adding per-category actions across three bot
|
||||
groupings, bot analytics, and WAF custom-rule exceptions the free Bot Fight Mode lacks.
|
||||
|
||||
**Does a matching TLS (JA3/JA4) fingerprint mean a request passes Cloudflare's scoring?**
|
||||
No. It is one documented input among several (heuristics, JavaScript detections, machine
|
||||
learning, and historically anomaly detection). The same "necessary, not sufficient" pattern
|
||||
is documented in detail for a comparable vendor in
|
||||
[the Akamai Bot Manager case study](akamai-bot-manager-explained.md).
|
||||
|
||||
**Can a browser automation tool guarantee a good Cloudflare bot score?** No. The score is
|
||||
computed server-side from reputation and session history a browser build has no way to see
|
||||
or influence.
|
||||
|
||||
**Does invisible_playwright bypass Cloudflare Bot Management?** No. It does not solve
|
||||
Turnstile's interactive tier, does not predict or spoof the bot score, and makes no claim
|
||||
to defeat the scoring pipeline as a whole. It answers the client-observable inputs to that
|
||||
pipeline (TLS handshake, canvas, WebGL, fonts, navigator surface) honestly, because they
|
||||
come from a genuinely real engine rather than a script overriding them.
|
||||
|
||||
**See also:** [How Cloudflare Turnstile actually works](cloudflare-turnstile-explained.md)
|
||||
for the widget product this page deliberately does not re-cover; [How Akamai Bot Manager
|
||||
actually works](akamai-bot-manager-explained.md) for a comparably-structured scoring
|
||||
pipeline and a documented case where a matching network fingerprint was not enough; [JA3
|
||||
and JA4: why a TLS fingerprint cannot be patched](ja3-ja4-tls-fingerprint.md) and [HTTP/2
|
||||
fingerprint: the layer above the TLS handshake](http2-fingerprint-detection.md) for the
|
||||
network-layer inputs above; and [Browser trust scores explained](browser-trust-score-explained.md)
|
||||
for why a Cloudflare bot score, a CreepJS trust score and a reCAPTCHA v3 score do not imply
|
||||
each other.
|
||||
|
||||
## Sources
|
||||
|
||||
- Cloudflare, [Bot scores](https://developers.cloudflare.com/bots/concepts/bot-score/),
|
||||
retrieved 2026-08-30, for the 1-99 scale, the documented score bands, and the `__cf_bm`
|
||||
cookie's role.
|
||||
- Cloudflare, [Bot detection engines](https://developers.cloudflare.com/bots/concepts/bot-detection-engines/),
|
||||
retrieved 2026-08-30, for the Heuristics, JavaScript Detections, Machine Learning and
|
||||
Anomaly Detection descriptions and plan requirements.
|
||||
- Cloudflare, [Bot Management for Enterprise](https://developers.cloudflare.com/bots/plans/bm-subscription/),
|
||||
retrieved 2026-08-30, for the Enterprise tier's capabilities and its mutual exclusivity
|
||||
with Bot Fight Mode / Super Bot Fight Mode.
|
||||
- Cloudflare, [Super Bot Fight Mode overview](https://developers.cloudflare.com/bots/get-started/super-bot-fight-mode/),
|
||||
retrieved 2026-08-30, for plan availability, the three bot groupings, and the difference
|
||||
from free Bot Fight Mode.
|
||||
- Cloudflare, [JA3/JA4 fingerprint](https://developers.cloudflare.com/bots/additional-configurations/ja3-ja4-fingerprint/),
|
||||
retrieved 2026-08-30, for the TLS fingerprint description and the exposed
|
||||
`cf.bot_management.ja3_hash` / `ja4` fields.
|
||||
- Cloudflare, [Cloudflare Cookies](https://developers.cloudflare.com/fundamentals/reference/policies-compliances/cloudflare-cookies/),
|
||||
retrieved 2026-08-30, for the `__cf_bm` cookie's per-site generation, 30-minute
|
||||
inactivity expiry, and stated purpose.
|
||||
- Scrapfly, ["How Cloudflare Detects Bots: TLS, HTTP/2, Canvas, and Turnstile
|
||||
Explained"](https://scrapfly.io/blog/posts/how-cloudflare-detects-bots), retrieved
|
||||
2026-08-30, a practitioner write-up (not Cloudflare's own documentation) for the
|
||||
reconstructed canvas/WebGL and behavioral detail behind JavaScript Detections.
|
||||
- [`VeNoMouS/cloudscraper`](https://github.com/VeNoMouS/cloudscraper), GitHub, retrieved
|
||||
2026-08-30, for what a real, actively maintained practitioner tool in this space targets
|
||||
(IUAM JavaScript challenges and Turnstile CAPTCHA pages), distinct from the scoring
|
||||
engine this page describes.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level and driven by stock Playwright. Bot Management's actual
|
||||
score never reaches the client that earned it; what this page can speak to is the half of
|
||||
the pipeline a real browser engine touches, and it stops exactly where that half stops.*
|
||||
@@ -0,0 +1,247 @@
|
||||
---
|
||||
title: "How Cloudflare Turnstile actually works"
|
||||
description: "Turnstile is not a puzzle widget, it is a signal-gathering decision engine: non-interactive JS challenges, proof-of-work, a risk-scored escalation to a checkbox, and a server-side token check. Read from Cloudflare's own docs."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 23
|
||||
---
|
||||
|
||||
|
||||
# How Cloudflare Turnstile actually works
|
||||
|
||||
Turnstile is not a captcha with the images swapped for a checkbox. Most of the time
|
||||
there is no checkbox at all: the widget runs a set of quiet JavaScript checks in the
|
||||
background, decides the visitor is probably fine, and hands back a token before a
|
||||
human would even notice anything happened. The checkbox is the fallback path, shown
|
||||
only when those quiet checks come back uncertain.
|
||||
|
||||
This page is about that mechanism, read from Cloudflare's own developer
|
||||
documentation rather than guessed at from a blocked request. Not how to get past it,
|
||||
how it decides.
|
||||
|
||||
## What the widget actually is
|
||||
|
||||
A Turnstile deployment has two halves. The client-side widget is a script loaded
|
||||
from `https://challenges.cloudflare.com/turnstile/v0/api.js` and dropped into a page
|
||||
either implicitly, by adding a `cf-turnstile` container div and letting the script
|
||||
scan for it on load, or explicitly, by calling `turnstile.render()` yourself when
|
||||
you need control over timing, such as a form that only appears after some other
|
||||
interaction. Each widget carries a public sitekey and is bound to a private secret
|
||||
key that never leaves your server.
|
||||
|
||||
When the widget finishes its checks, it produces a token and writes it into a hidden
|
||||
`cf-turnstile-response` field (or hands it to a callback you registered). That token
|
||||
is not proof of anything by itself. It has to be checked, server-side, against
|
||||
Cloudflare's Siteverify API, which is the second half of the deployment and the part
|
||||
a lot of first attempts skip.
|
||||
|
||||
## The part that runs before you ever see a checkbox
|
||||
|
||||
Cloudflare's own description of the mechanism is that it runs "a series of small
|
||||
non-interactive JavaScript challenges" to gather signals about the visitor and the
|
||||
browser environment, and names the categories directly: proof-of-work, proof-of-space,
|
||||
probing for web APIs, and other checks aimed at browser quirks and human behavior.
|
||||
|
||||
**Proof-of-work** is a small computational puzzle the browser has to solve, the same
|
||||
family of idea as Hashcash: spend a measurable amount of CPU on something that is
|
||||
cheap for the server to verify. A script that can run arbitrary JavaScript pays this
|
||||
cost the same as a real browser does; a client with no JS engine at all cannot pay it
|
||||
and never produces a token.
|
||||
|
||||
**Proof-of-space** is the storage-based cousin of the same idea, trading disk or
|
||||
memory instead of CPU cycles.
|
||||
|
||||
**Web API probing** and **browser-quirk detection** are the categories that matter
|
||||
most for anything driving a real browser: calling real, specified APIs and checking
|
||||
whether the answers are internally consistent with each other and with the engine the
|
||||
page claims to be. Cloudflare does not publish the exact list of properties it reads,
|
||||
and the widget script itself is not meant to be human-readable, so anyone claiming a
|
||||
precise inventory of what it checks is going further than Cloudflare's own
|
||||
documentation does. What is documented is the shape of the approach, not the field
|
||||
names.
|
||||
|
||||
The point of running all of this before showing anything is stated plainly in
|
||||
Cloudflare's docs too: the goal is to "fine-tune the difficulty of the challenge to
|
||||
the specific request and avoid showing a visual or interactive puzzle to a user" who
|
||||
does not need one. Most visitors, automated or not, never see a widget at all if the
|
||||
non-interactive layer is satisfied.
|
||||
|
||||
## The three modes, and when a checkbox appears
|
||||
|
||||
A site owner picks one of three widget modes when they create a sitekey, and the
|
||||
mode decides whether an interactive step exists at all.
|
||||
|
||||
| Mode | What the visitor sees | When it appears |
|
||||
|---|---|---|
|
||||
| Managed | Nothing, or a checkbox | Non-interactive checks run first; a checkbox appears only if visitor risk is high enough |
|
||||
| Non-Interactive | A loading spinner, never a checkbox | Verification always runs silently in the background |
|
||||
| Invisible | Nothing at all | No visible widget or loading indicator under any outcome |
|
||||
|
||||
Managed is the one most sites use and the recommended default in Cloudflare's own
|
||||
guidance, because it is the only mode that can show an interactive step, and it only
|
||||
does so when the signal-gathering layer above flags the visitor as worth a second
|
||||
look. Non-Interactive and Invisible never show a checkbox by design, no matter what
|
||||
the signals say; a site that wants a hard human gate has to use Managed.
|
||||
|
||||
## The managed challenge: a human gate, not a fingerprint gate
|
||||
|
||||
When Managed mode does decide to show something, Cloudflare's own documentation
|
||||
describes it as a "simple checkbox that the visitor must click to proceed", explicitly
|
||||
not an image puzzle or text to transcribe. This is the point worth being precise
|
||||
about: the checkbox is not another fingerprint probe layered on top of the earlier
|
||||
ones. It is a click, gated behind whatever risk score the earlier signals produced.
|
||||
|
||||
That distinction matters for what a real engine can and cannot do about it. Everything
|
||||
in the non-interactive layer, the proof-of-work, the API probing, the consistency
|
||||
checks, is answered by whatever is running the JavaScript. A genuine browser engine
|
||||
answers those honestly because it is not simulating the answers, it is producing
|
||||
them the normal way, the same way it would for any other page. The interactive
|
||||
checkbox tier is a different kind of gate: it exists specifically for the visitors
|
||||
the earlier layer could not clear on signal alone, and clicking it is a human action,
|
||||
not a value a browser reports. No amount of engine-level fidelity changes what that
|
||||
tier is checking for, because it stopped checking the browser and started checking
|
||||
for a click.
|
||||
|
||||
## The token, and why passing the widget is not the finish line
|
||||
|
||||
A successful pass, interactive or not, produces a token. Cloudflare's own
|
||||
documentation is direct about what that token is worth on its own: "You must call
|
||||
the Siteverify API to complete your Turnstile implementation. The client-side widget
|
||||
alone does not protect your forms." The token proves the widget ran and returned
|
||||
success; it proves nothing to your server until your server checks it.
|
||||
|
||||
The check is a server-to-server call:
|
||||
|
||||
```
|
||||
POST https://challenges.cloudflare.com/turnstile/v0/siteverify
|
||||
```
|
||||
|
||||
with the site's secret key and the token as the two required parameters (an optional
|
||||
`remoteip` and an `idempotency_key` for safe retries are also accepted). The response
|
||||
is JSON: a `success` boolean, a `challenge_ts` timestamp, the `hostname` the challenge
|
||||
ran on, an `action` and `cdata` if the integration set them, and an `error-codes`
|
||||
array when it fails.
|
||||
|
||||
Two properties of the token matter for anyone thinking about this mechanically.
|
||||
It expires 300 seconds after it is issued, and it is single-use: presenting the same
|
||||
token to Siteverify twice returns a `timeout-or-duplicate` error on the second call.
|
||||
A token cannot be harvested once and replayed later, and a token generated for one
|
||||
page load does not answer for the next one.
|
||||
|
||||
## What one real deployment looked like
|
||||
|
||||
Security researcher Troy Hunt wrote up putting invisible Turnstile in front of an API
|
||||
endpoint that was under sustained bot traffic, and the numbers are a useful reality
|
||||
check on what the mechanism actually filters in practice. Over roughly five months
|
||||
and more than 100 million challenges issued, he reported a 91% pass rate among issued
|
||||
tokens, around 990,000 requests rejected for arriving without a valid token, and
|
||||
traffic that had previously spiked to 121,300 requests in a five-minute window during
|
||||
attacks dropping to zero abnormal spikes after deployment. He also noted that 40% of
|
||||
the requests that failed validation traced back to just five distinct JA3 TLS
|
||||
fingerprints, a network-layer signal outside anything the JavaScript layer measures.
|
||||
|
||||
That is one deployment, on one endpoint, and it is not a claim that every Turnstile
|
||||
deployment behaves identically. It is real, named, and checkable, which is more than
|
||||
most numbers floating around this topic can claim.
|
||||
|
||||
## Where an engine-level browser actually helps, and where it does not
|
||||
|
||||
The non-interactive layer is built to read real signals from a real JavaScript
|
||||
environment: whether a proof-of-work computation lands where a real engine's timing
|
||||
puts it, whether the web APIs it probes answer the way the engine they claim to be
|
||||
actually answers, whether the browser-quirk checks find the quirks a genuine build of
|
||||
that engine has. A browser that is genuinely the engine it presents, patched at the
|
||||
level that produces those answers rather than overridden from a content script,
|
||||
answers this layer the same way any other real instance of that engine does, because
|
||||
there is no simulated answer to catch, only the real one.
|
||||
|
||||
What that does not change is the interactive tier. If Managed mode's risk scoring
|
||||
decides a visitor needs to click the checkbox, an honest engine fingerprint does not
|
||||
make that requirement disappear, because the requirement was never about the
|
||||
fingerprint in the first place. It is a human-verification gate sitting downstream of
|
||||
the signal layer, and no amount of realness upstream removes a gate that is checking
|
||||
for something else entirely.
|
||||
|
||||
None of this is a claim that any tool solves Turnstile, and a captcha-solving promise
|
||||
is not one this project makes: `invisible_playwright` does not click checkboxes for
|
||||
you or defeat the interactive tier. What a real, engine-level Firefox does is answer
|
||||
the non-interactive layer honestly, the same way a real Firefox always would, which is
|
||||
the layer that decides whether most visitors ever see a checkbox at all.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does Cloudflare Turnstile detect headless browsers?** The non-interactive layer is
|
||||
built to catch the gap between a browser's claimed engine and its actual JavaScript
|
||||
environment, which is exactly the kind of gap an incomplete or scripted environment
|
||||
tends to have. Cloudflare does not publish a specific "headless" flag; it publishes
|
||||
signal categories, not a checklist.
|
||||
|
||||
**What is the difference between Turnstile's three modes?** Managed can show an
|
||||
interactive checkbox when the earlier signals look risky; Non-Interactive always
|
||||
verifies silently behind a spinner and never shows a checkbox; Invisible shows nothing
|
||||
at all under any outcome. Only Managed has a human-click tier.
|
||||
|
||||
**Does passing the checkbox mean I passed everything?** No. The checkbox produces a
|
||||
token, and the token only counts once your server has validated it against
|
||||
Siteverify. A token that is never checked server-side protects nothing.
|
||||
|
||||
**Can a Turnstile token be reused or harvested for later?** No. It expires after 300
|
||||
seconds and Siteverify rejects a second submission of the same token with a
|
||||
`timeout-or-duplicate` error.
|
||||
|
||||
**Is Turnstile the same thing as a captcha?** No, and Cloudflare's own framing leans
|
||||
on that distinction: it is a low-friction check that tries to avoid ever showing a
|
||||
visual or interactive puzzle, reserving the checkbox for visitors its non-interactive
|
||||
signals could not already clear.
|
||||
|
||||
**Does a real browser engine bypass Turnstile?** It answers the non-interactive
|
||||
signal layer the way any genuine instance of that engine does, because those answers
|
||||
are not overridden, they are the real ones. It has no effect on the interactive
|
||||
checkbox tier, which is a human-verification gate, not a fingerprint check.
|
||||
|
||||
**Where does the actual detection logic live?** Cloudflare does not publish the exact
|
||||
properties the widget reads or the scoring behind the risk decision. What is
|
||||
documented is the category list (proof-of-work, proof-of-space, web API probing,
|
||||
browser-quirk and behavior checks) and the three-mode structure; the internals below
|
||||
that are not public.
|
||||
|
||||
**See also:** [navigator.webdriver is not the tell you think it is](navigator-webdriver-explained.md),
|
||||
for the one property every detector checks first and why patching it alone changes
|
||||
little; [Function.prototype.toString and the \[native code\] check](tostring-native-code-detection.md),
|
||||
for why a JavaScript-level override of a Web API is itself detectable; [Playwright
|
||||
detected as a bot: the checklist to fix it](playwright-detected-as-bot.md), for a
|
||||
troubleshooting order when one site starts showing automation a different page; and
|
||||
[what mouse-dynamics behavioral biometrics score](mouse-dynamics-behavioural-biometrics.md),
|
||||
for the kind of human-behavior signal Cloudflare's category list names but does not
|
||||
detail.
|
||||
|
||||
## Sources
|
||||
|
||||
- Cloudflare, [Turnstile overview](https://developers.cloudflare.com/turnstile/),
|
||||
retrieved 2026-08-30, for the non-interactive challenge categories (proof-of-work,
|
||||
proof-of-space, web API probing, browser-quirk and behavior detection) and the
|
||||
stated goal of avoiding a visual puzzle where possible.
|
||||
- Cloudflare, [Turnstile widgets](https://developers.cloudflare.com/turnstile/concepts/widget/),
|
||||
retrieved 2026-08-30, for the Managed, Non-Interactive and Invisible mode
|
||||
definitions and when each one can show a checkbox.
|
||||
- Cloudflare, [Turnstile challenge types](https://developers.cloudflare.com/cloudflare-challenges/challenge-types/turnstile/),
|
||||
retrieved 2026-08-30, for the signal-based decision framing and the description of
|
||||
the interactive challenge as a checkbox click.
|
||||
- Cloudflare, [Embed the widget](https://developers.cloudflare.com/turnstile/get-started/client-side-rendering/),
|
||||
retrieved 2026-08-30, for the widget script URL, implicit vs. explicit rendering,
|
||||
and the `cf-turnstile-response` token field.
|
||||
- Cloudflare, [Server-side validation](https://developers.cloudflare.com/turnstile/get-started/server-side-validation/),
|
||||
retrieved 2026-08-30, for the Siteverify endpoint, its parameters and response
|
||||
fields, and the 300-second single-use token behavior.
|
||||
- Troy Hunt, ["Fighting API Bots with Cloudflare's Invisible Turnstile"](https://www.troyhunt.com/fighting-api-bots-with-cloudflares-invisible-turnstile/),
|
||||
retrieved 2026-08-30, for the real deployment numbers quoted above: challenge
|
||||
volume, pass rate, rejected requests, and the JA3-fingerprint concentration among
|
||||
failures.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level and driven by stock Playwright. This page describes
|
||||
a mechanism, not a workaround: the product does not solve captchas or click Turnstile's
|
||||
interactive tier for you, and any tool that claims to defeat Cloudflare wholesale is
|
||||
promising more than the docs above actually say.*
|
||||
@@ -56,6 +56,9 @@ need rendering. Each page below states where the other tool covers more.
|
||||
- [Do I need an anti-detect browser or just Playwright?](do-i-need-an-antidetect-browser.md) - What a paid anti-detect GUI adds over stock Playwright driving a patched Firefox.
|
||||
- [Migrating from Puppeteer to Playwright for stealth](migrate-puppeteer-to-playwright-stealth.md) - The near one-to-one API mapping, and what changes for detection off the CDP stack.
|
||||
- [Migrating from Selenium to Playwright for stealth](migrate-selenium-to-playwright-stealth.md) - Map driver.get and find_element to page.goto and locators, dropping the WebDriver server.
|
||||
- [Why Playwright Locators Never Throw StaleElementReferenceException](playwright-vs-selenium-stale-element-reference.md) - Selenium's WebElement holds a live reference that goes stale; Playwright's Locator re-resolves on every action.
|
||||
- [How to Read a Stealth-Browser Benchmark Without Being Misled](how-to-read-a-stealth-browser-benchmark.md) - What to check before trusting a comparison, including this project's own, since almost every published one ranks itself first.
|
||||
- [Web Scraping Proxy Costs: Build vs. Buy Your Stealth Stack](web-scraping-proxy-costs-build-vs-buy.md) - Proxy spend, engineering maintenance time and vendor lock-in, without the invented totals most build-vs-buy pages lead with.
|
||||
|
||||
## Patched-engine, driver-patch and stealth-plugin tools
|
||||
|
||||
@@ -89,6 +92,8 @@ need rendering. Each page below states where the other tool covers more.
|
||||
- [invisible_playwright vs hrequests](vs-hrequests.md) - A hybrid TLS-impersonating HTTP client plus a browser mode with injected fingerprints.
|
||||
- [tls-client vs a real browser: when TLS is enough](vs-tls-client.md) - When JA3/HTTP2 socket spoofing suffices on JSON and HTML, and where JS forces a full browser.
|
||||
|
||||
- [invisible_playwright vs browser-use: different jobs](vs-browser-use.md) - An LLM-driven agent framework against an engine you drive yourself, and where each one fits.
|
||||
|
||||
## Unmaintained tools
|
||||
|
||||
- [puppeteer-extra-plugin-stealth: unmaintained since 2024](puppeteer-extra-stealth-unmaintained.md) - No real update since mid-2024; old patches still work but the checklist froze.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "Computer-use agents and browser fingerprint detection"
|
||||
description: "Computer-use agents click by pixel, not DOM, so driver flags are moot for them. Engine fingerprint and action rhythm remain the detectable signals."
|
||||
description: "Clicking by pixel makes driver flags moot; the engine fingerprint and action rhythm stay checkable. This page moved to the AIHawk wiki."
|
||||
parent: "AI Agents and Frameworks"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 6
|
||||
@@ -9,193 +9,20 @@ nav_order: 6
|
||||
|
||||
# Computer-use agents and browser fingerprint detection
|
||||
|
||||
A computer-use agent (CUA) does not read the DOM to decide where to act. It takes a
|
||||
screenshot, sends the image to a vision model, gets back a pixel coordinate, clicks
|
||||
there, and takes another screenshot. That loop is the whole architecture of OpenAI's
|
||||
Computer-Using Agent and of Anthropic's computer-use tool, and it changes which
|
||||
detection signals matter and which stop mattering.
|
||||
This page moved to the AIHawk wiki, retargeted at the question people
|
||||
actually search:
|
||||
|
||||
This page is about that shift: why the automation flags people usually worry about are
|
||||
moot for a coordinate agent, what is still checkable underneath it, and where
|
||||
invisible_playwright helps and where you still have to do the work yourself.
|
||||
**[Claude computer use detected as a bot](https://github.com/feder-cr/AIHawk/wiki/claude-computer-use-detected-as-bot)**
|
||||
|
||||
## Why the driver flags stop mattering
|
||||
The core of it, kept here in brief: a coordinate-clicking agent never
|
||||
generates the DOM-automation tells, so `navigator.webdriver` advice mostly
|
||||
does not apply to it. What remains checkable is the engine fingerprint of the
|
||||
machine the click lands in, the address it arrives from, and the
|
||||
screenshot-think-click rhythm.
|
||||
|
||||
A CUA never triggers the DOM-automation flags sites check for, because its click is a
|
||||
coordinate delivered through the input pipeline the same way a real click is, not a
|
||||
script reaching into the page. Most bot-detection advice targets that automation layer
|
||||
anyway: [`navigator.webdriver`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/webdriver),
|
||||
leftover automation globals, DOM mutations that only a driver produces, an untrusted
|
||||
event dispatched from code rather than from hardware. Those signals exist because a
|
||||
selector-driven script reaches into the page and touches elements directly.
|
||||
|
||||
A CUA does not do that. It never calls `querySelector`, never sets an element's
|
||||
value from script, never dispatches a synthetic event at a node it located by selector.
|
||||
So the whole family of DOM-automation tells is [mostly not the thing that catches
|
||||
it](navigator-webdriver-explained.md) - not because the agent hides them, but because
|
||||
it never generates them in the first place.
|
||||
|
||||
That is the part people get wrong. They read that agents are hard to detect and assume
|
||||
the fingerprint is solved. It is not solved. It is bypassed by the input method, and
|
||||
two other surfaces are completely untouched by that fact.
|
||||
|
||||
## What stays checkable: the engine fingerprint
|
||||
|
||||
The agent clicks by coordinate, but the click still lands in a browser, and that
|
||||
browser answers JavaScript. The site's own scripts still ask the engine what it is:
|
||||
the WebGL renderer string, the canvas hash, the audio context, the installed fonts, the
|
||||
screen geometry, the codec list. None of that goes through the DOM the agent avoids. It
|
||||
goes through the ordinary JS surface every page can read, and a stock automation build
|
||||
running on a server answers those questions like a server.
|
||||
|
||||
This is the surface invisible_playwright is built for. It is a Firefox patched at the
|
||||
C++ level so the engine renders like a real Windows Firefox: the GPU strings, the
|
||||
canvas and audio hashes, the font set and the screen all report values a real desktop
|
||||
would report, derived from one seed so they stay consistent with each other. A
|
||||
detector cross-checking those fields against one another finds agreement instead of the
|
||||
contradictions a [half-patched or double-patched stack](playwright-stealth-levels.md)
|
||||
produces.
|
||||
|
||||
The two-line launch is the same whether a human or a vision model drives it:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# seed=42 makes the whole fingerprint reproducible run to run
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
|
||||
# the screenshot -> click(x, y) -> screenshot loop a CUA runs
|
||||
png = page.screenshot() # frame you hand to the vision model
|
||||
x, y = 480, 320 # coordinate the model returns
|
||||
page.mouse.click(x, y) # lands through the real input pipeline
|
||||
png = page.screenshot() # next frame
|
||||
```
|
||||
|
||||
`browser` here is a real Playwright
|
||||
[`Browser`](https://playwright.dev/python/docs/api/class-browser), so
|
||||
[`page.screenshot()`](https://playwright.dev/python/docs/api/class-page#page-screenshot)
|
||||
and [`page.mouse.click()`](https://playwright.dev/python/docs/api/class-mouse#mouse-click)
|
||||
are the ordinary documented methods - the same ones a coordinate-clicking agent already
|
||||
calls. There is no special CUA API to adopt. You feed the screenshot to whatever model
|
||||
you use and feed its coordinate back to `page.mouse.click`.
|
||||
|
||||
## What stays checkable: the action rhythm
|
||||
|
||||
The second surface the input method does not fix is timing, and it is the one specific
|
||||
to agents.
|
||||
|
||||
A CUA's loop has a shape. Screenshot, then a pause while a model processes the image and
|
||||
decides, then a click, then another screenshot. That thinking pause is roughly the same
|
||||
length every step because it is model latency, not human hesitation, and it repeats with
|
||||
a regularity no person produces. A human pause varies with what is on screen, drifts,
|
||||
gets distracted, double-checks. A model's pause is a distribution centered on its
|
||||
inference time.
|
||||
|
||||
invisible_playwright gives the pointer a Bezier-curve path between coordinates rather
|
||||
than a teleport, which removes the crudest motion tell. It does not reshape the
|
||||
step-to-step rhythm of your agent loop, because that rhythm is produced by your model
|
||||
and your code, not by the browser. If your loop clicks every 1.9 seconds because that is
|
||||
how long the model takes, the engine cannot know to vary it. You add the variance:
|
||||
jitter the delay between steps, and do not click the instant a screenshot returns. This
|
||||
is [the pause shaped like model latency](ai-agent-timing-signal.md), and it is
|
||||
behaviour, which no fingerprint layer reaches.
|
||||
|
||||
## What invisible_playwright does not do
|
||||
|
||||
Being honest about the boundary is the point, because a coordinate agent makes it easy
|
||||
to believe more is handled than actually is.
|
||||
|
||||
- **It does not change your IP.** The engine can look like a real Windows desktop and
|
||||
still be sitting on a datacenter address that a site distrusts on sight. A perfect
|
||||
fingerprint on a known-bad exit still loses. Bring a clean proxy; the engine cannot
|
||||
supply one.
|
||||
- **It does not fix per-account quotas or rate limits.** Those are counted server-side
|
||||
against your account and address, and no browser property touches them.
|
||||
- **It does not pace your agent.** The step rhythm above is yours to vary. The engine
|
||||
handles the pointer path, not the schedule your loop runs on.
|
||||
- **It does not see the DOM for you.** A CUA works by pixels precisely because it does
|
||||
not read structure. invisible_playwright does not add DOM understanding; it makes the
|
||||
browser those pixels are rendered in look real.
|
||||
|
||||
What it does do is remove the engine fingerprint from the list of things that give you
|
||||
away, so that TLS, the driver layer and the render surface read as a genuine Firefox.
|
||||
That is why it passes most fingerprint checks. It is not why a session with a bad IP and
|
||||
a metronome rhythm passes, because it does not claim to fix those.
|
||||
|
||||
## A measurement worth trusting more than a verdict
|
||||
|
||||
The useful test for a CUA setup is not "did the suite say human". It is a field-by-field
|
||||
comparison against a stock browser on the same machine, because the agent's own loop can
|
||||
introduce timing the browser knows nothing about.
|
||||
|
||||
Open a fingerprinting page under invisible_playwright and under a stock Firefox on the
|
||||
same host, and diff the reports. On the engine surface the two should agree: same GPU
|
||||
family, a canvas hash that is stable across two reads in the same session (a hash that
|
||||
changes per call is [a randomiser announcing itself](canvas-fingerprint-noise.md)), a
|
||||
font list that belongs to the platform the user agent claims. Where they still differ,
|
||||
after the address, is your candidate. A [software WebGL renderer or a
|
||||
datacenter-shaped machine](playwright-docker-detection.md) survives every property patch
|
||||
because it is not the engine's to change, and it is the most common reason a clean-looking
|
||||
agent still gets a different page. Run it ten times, not once, because this domain is not
|
||||
deterministic and a single green run is not a pass.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Vision and coordinate agents move the detection problem, they do not remove it. The
|
||||
DOM-automation flags that dominate ordinary Playwright advice are moot for them, because
|
||||
a click delivered by pixel never generates those flags. What remains is the engine
|
||||
fingerprint the site reads through its own JavaScript, and the machine-regular rhythm of
|
||||
the screenshot-click loop. invisible_playwright answers the first: it makes the browser
|
||||
render like a real Windows Firefox, seed-reproducible and self-consistent. The second is
|
||||
yours - vary the timing - and so is the IP - bring a clean one. Handle all three and the
|
||||
agent looks like a person on a real machine. Handle only the browser and you have a real
|
||||
browser clicking like a robot.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Do computer-use agents get detected as bots?** Not usually through `navigator.webdriver`
|
||||
or DOM automation flags, because a coordinate click never produces them. They get caught
|
||||
on the engine fingerprint, on the IP, or on the regular timing of the screenshot-click
|
||||
loop.
|
||||
|
||||
**Does invisible_playwright work with OpenAI or Anthropic computer-use?** Yes. It returns
|
||||
a real Playwright `Browser`, so `page.screenshot()` and `page.mouse.click(x, y)` - the
|
||||
two calls a coordinate agent needs - work exactly as documented, on a Firefox that
|
||||
renders like a real Windows desktop.
|
||||
|
||||
**If the agent clicks by pixel, is the fingerprint irrelevant?** No. The click method
|
||||
avoids DOM tells, but the site still reads the engine through JavaScript. GPU, canvas,
|
||||
audio, fonts and screen are all still checkable, and a stock server build answers them
|
||||
like a server.
|
||||
|
||||
**Will it stop my agent being rate-limited?** No. Quotas and rate limits are counted
|
||||
server-side against your account and address. No browser property changes them.
|
||||
|
||||
**How do I make the timing look human?** Jitter the delay between loop steps and do not
|
||||
click the instant a screenshot returns. The engine varies the pointer path; the
|
||||
step-to-step rhythm is produced by your model and your code, so you vary that.
|
||||
|
||||
**Does it fix my IP?** No. It makes the browser look real; it does not change the exit.
|
||||
A real-looking browser on a datacenter address still loses, so bring a clean proxy.
|
||||
|
||||
## Sources
|
||||
|
||||
- OpenAI's own announcement, [Computer-Using Agent](https://openai.com/index/computer-using-agent/),
|
||||
retrieved 2026-08-28, and Anthropic's own documentation, [Computer use tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool),
|
||||
retrieved 2026-08-28, both of which drive a browser through a screenshot to
|
||||
coordinate-click to screenshot loop rather than by DOM selector.
|
||||
- This project's own fingerprint gates and the stock-browser comparison method used to
|
||||
separate an engine tell from a machine tell from a timing tell.
|
||||
|
||||
**See also:** [why AI agents have their own timing signal](ai-agent-timing-signal.md) for the
|
||||
agent-specific timing tell in depth, [browser-use and what you can change](browser-use-detection.md)
|
||||
for a selector-driven agent by contrast, and [why you can be blocked with a clean
|
||||
fingerprint](why-blocked-with-a-clean-fingerprint.md) for the surfaces past the browser.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The engine makes the
|
||||
browser real; the pacing and the proxy are still yours to bring.*
|
||||
The mechanism layer stays on this wiki:
|
||||
[navigator.webdriver, explained](navigator-webdriver-explained.md),
|
||||
[what a website can detect about a virtual machine](can-a-website-detect-a-virtual-machine.md),
|
||||
and [the AI-agents integration pages](guides-ai-agents.md) for wiring a real
|
||||
engine under a computer-use loop:
|
||||
[back a computer-use agent with a real browser](back-computer-use-agent-real-browser.md).
|
||||
@@ -0,0 +1,196 @@
|
||||
---
|
||||
title: "Content-Security-Policy Blocks Playwright's Injected Scripts"
|
||||
description: "A page's CSP header can refuse addInitScript and evaluate the same way it refuses any other unauthorized script. bypassCSP fixes it and changes what the page actually enforces while you test it."
|
||||
parent: "Testing and Troubleshooting"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 23
|
||||
---
|
||||
|
||||
|
||||
# Content-Security-Policy Blocks Playwright's Injected Scripts
|
||||
|
||||
A page that ships a
|
||||
[`Content-Security-Policy`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy)
|
||||
header restricting `script-src` does not treat Playwright's injected code as special. A
|
||||
`page.add_init_script()` payload, or code passed to `page.evaluate()` in certain
|
||||
injection paths, is just another script the page did not explicitly authorize, and a
|
||||
strict `script-src` blocks unauthorized inline and dynamically-injected script
|
||||
execution the same way it blocks a stray `<script>` tag or a compromised third-party
|
||||
widget. The failure is silent in the way CSP failures usually are: no exception in your
|
||||
Python code, a console warning in the browser you likely never read, and code that
|
||||
simply never ran.
|
||||
|
||||
## What CSP actually restricts
|
||||
|
||||
By default, a policy that sets `default-src` or `script-src` blocks inline `<script>`
|
||||
tags, inline event-handler attributes, `javascript:` URLs, and dynamic evaluation via
|
||||
`eval()`, `Function()`, or a string passed to `setTimeout()`. A page can loosen this with
|
||||
a `'nonce-<value>'` that has to match between the header and the script tag, or with
|
||||
`'unsafe-inline'`, which defeats the point of having the policy at all and is
|
||||
correspondingly rare on a page that bothered to set one.
|
||||
|
||||
None of these exceptions are things Playwright can produce on your behalf. Your injected
|
||||
code did not ship with the page's nonce, because the nonce is generated server-side per
|
||||
request specifically so a script that was not part of that response cannot forge it.
|
||||
|
||||
## Playwright's option, and what it actually does
|
||||
|
||||
`browser.new_context(bypass_csp=True)` (or the equivalent `bypassCSP` in JavaScript)
|
||||
tells the browser context to skip CSP enforcement outright:
|
||||
|
||||
```python
|
||||
context = browser.new_context(bypass_csp=True)
|
||||
page = context.new_page()
|
||||
page.goto("https://example.com")
|
||||
# an init script that a strict CSP would otherwise have refused now runs
|
||||
```
|
||||
|
||||
The option's own documented default is `False`, and what it does is exactly what the
|
||||
name says: it toggles bypassing the page's Content-Security-Policy, entirely, for every
|
||||
resource load in that context, not just for Playwright's own injections. It does not
|
||||
repair a misconfigured policy, does not add your script's origin to an allowlist, and
|
||||
does not tell you whether the same page would work for a real visitor whose browser
|
||||
still enforces the header normally.
|
||||
|
||||
## The honest tradeoff
|
||||
|
||||
There are two different reasons you might reach for this flag, and only one of them
|
||||
survives contact with what the flag actually does.
|
||||
|
||||
**Legitimate testing need: your own code, your own CSP.** If you are testing a page you
|
||||
control and the point of the test is the page's functionality instead of its CSP
|
||||
configuration, bypassing CSP to let your own instrumentation or a third-party testing
|
||||
widget run is a reasonable, disclosed tradeoff. You know the header is there, you know
|
||||
you are turning it off for the test, and the production page a real visitor loads still
|
||||
enforces it normally. This is CSP getting in the way of your own test tooling, not CSP
|
||||
doing its job against something adversarial.
|
||||
|
||||
**A deviation a real browser would never make.** If the target is not yours and the
|
||||
question is "does my automated session look like a real visitor," bypassing CSP changes
|
||||
what the page is allowed to do in ways a genuine visitor's browser never would. A real
|
||||
person's browser enforces the header exactly as written; a session that quietly disables
|
||||
it is not rendering the page the way the page's own operator configured it to render, and
|
||||
that is a difference from a genuine session, not a neutral convenience. Whether a
|
||||
specific target's own logic could ever observe that difference from inside the page is a
|
||||
separate question this page cannot answer for you, but the premise underneath
|
||||
"bypassing CSP is invisible" does not hold: it is a real change to how the page executes,
|
||||
not a transparent workaround.
|
||||
|
||||
The practical rule: use `bypassCSP` when you are testing your own integration against
|
||||
your own header and you know exactly why it is there. Treat it as a real behavioral
|
||||
deviation, not a free pass, on anything else.
|
||||
|
||||
## Diagnosing it before reaching for the flag
|
||||
|
||||
**Confirm CSP is actually the cause.** Open the browser console (or read
|
||||
`page.on("console")` events in your script) and look for a message naming
|
||||
`Content-Security-Policy` and the specific directive it refused. This distinguishes CSP
|
||||
from a plain script error, which is a different bug with a different fix.
|
||||
|
||||
```python
|
||||
page.on("console", lambda msg: print(msg.type, msg.text))
|
||||
page.goto("https://example.com")
|
||||
```
|
||||
|
||||
**Read the actual header**, not just the console message, to see which directives are
|
||||
restrictive:
|
||||
|
||||
```python
|
||||
response = page.goto("https://example.com")
|
||||
print(response.headers.get("content-security-policy"))
|
||||
```
|
||||
|
||||
**Check whether the restriction is `script-src` specifically**, versus something CSP also
|
||||
covers but unrelated to your failure, like `connect-src` blocking an XHR your page tries
|
||||
to make, or `frame-ancestors` unrelated to injected code entirely. Bypassing CSP for a
|
||||
`script-src` problem also bypasses every other directive on the same header, which is
|
||||
broader than most cases need.
|
||||
|
||||
**Known limitation:** documented reports exist of `bypassCSP` not resolving every CSP or
|
||||
CORS error depending on the specific directive and browser version, so confirm the
|
||||
console warning is actually gone after setting the option instead of assuming the flag
|
||||
is unconditionally comprehensive.
|
||||
|
||||
## Diagnostic checklist
|
||||
|
||||
1. Check the browser console for a `Content-Security-Policy` message naming the refused
|
||||
directive before assuming your injection code is broken.
|
||||
2. Read the response's `content-security-policy` header directly to see the actual
|
||||
policy instead of guessing from the symptom.
|
||||
3. Confirm the refusal is `script-src` (or `default-src` covering it), not an unrelated
|
||||
directive that happens to also block something in your flow.
|
||||
4. Decide whether this is your own page under test or a third-party target, and apply
|
||||
the tradeoff above instead of reaching for `bypass_csp` reflexively.
|
||||
5. After setting `bypass_csp=True`, re-check the console to confirm the specific warning
|
||||
is gone; a version-specific gap means it is not always comprehensive.
|
||||
|
||||
## What invisible_playwright does and does not touch here
|
||||
|
||||
CSP enforcement is the browser's networking and script-execution security layer,
|
||||
untouched by this project's fingerprint patching. `bypass_csp` is a standard Playwright
|
||||
context option that behaves identically on a patched Firefox and a stock one; the engine
|
||||
work here does not add, remove, or interact with CSP handling. The tradeoff above -
|
||||
disclosed test convenience against a real behavioral deviation on someone else's page -
|
||||
applies the same way regardless of which browser build enforces or bypasses the header.
|
||||
|
||||
## Conclusion
|
||||
|
||||
A CSP-restricted page refuses Playwright's injected scripts for the same reason it
|
||||
refuses any other unauthorized code: that is precisely what the header is configured to
|
||||
do. `bypass_csp=True` removes the restriction entirely rather than repairing it, which is
|
||||
a fair trade when you are testing your own integration against your own policy and a real
|
||||
deviation from how a genuine visitor's browser behaves everywhere else. Confirm CSP is
|
||||
actually the cause before reaching for the flag, and know which of the two situations you
|
||||
are actually in before you flip it.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Why does my `addInitScript` silently not run?** A page's Content-Security-Policy header
|
||||
can block unauthorized script execution, including injected init scripts, the same way it
|
||||
blocks any other script it did not explicitly allow. Check the browser console for a CSP
|
||||
message before assuming the injection failed for another reason.
|
||||
|
||||
**Does `bypassCSP` fix a broken CSP header?** No. It disables enforcement of the header
|
||||
entirely for that context; it does not repair the policy, approve your script's origin,
|
||||
or change what a real visitor's browser would do with the same page.
|
||||
|
||||
**Is bypassing CSP always safe to use for testing?** It is a reasonable, disclosed
|
||||
tradeoff on your own page under your own policy. On a third-party target, it is a real
|
||||
deviation from how a genuine browser renders the page, not a neutral workaround.
|
||||
|
||||
**Why doesn't a nonce fix my injected script?** Nonces are generated per-request and
|
||||
embedded in the page's own script tags server-side; code Playwright injects afterward was
|
||||
never part of that response and cannot carry a nonce it never received.
|
||||
|
||||
**Does bypassing CSP also disable CORS?** No. `bypassCSP` addresses Content-Security-Policy
|
||||
enforcement specifically and does not disable cross-origin resource sharing checks, which
|
||||
are a separate mechanism.
|
||||
|
||||
**Will bypassCSP always resolve the console warning?** Documented reports show it does not
|
||||
always resolve every CSP or CORS error depending on the specific directive and browser
|
||||
version, so confirm the warning is actually gone rather than assuming it is comprehensive.
|
||||
|
||||
## Sources
|
||||
|
||||
- Playwright's own API reference, [`browser.new_context()`](https://playwright.dev/python/docs/api/class-browser#browser-new-context-option-bypass-csp),
|
||||
for the exact `bypass_csp` option description and its `false` default.
|
||||
- Mozilla Developer Network, [Content-Security-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy),
|
||||
for what `script-src` restricts by default and how nonces and `'strict-dynamic'` work.
|
||||
- Microsoft Playwright issue [#20078](https://github.com/microsoft/playwright/issues/20078),
|
||||
a report of CSP and `--disable-web-security` not behaving as expected in a specific
|
||||
configuration, evidence for the "known limitation" section above.
|
||||
- Microsoft Playwright issue [#27696](https://github.com/microsoft/playwright/issues/27696),
|
||||
a feature request to set `bypassCSP` on an already-created context rather than only at
|
||||
context-creation time.
|
||||
|
||||
**See also:** [Playwright TargetClosedError: the causes and the fixes](playwright-targetclosederror-causes.md),
|
||||
for another case where the page's own defenses are the actual variable rather than
|
||||
anything wrong with the browser, and [How to test bot detection without a false pass](how-to-test-bot-detection.md),
|
||||
for the broader discipline of treating a bypassed restriction as a documented deviation
|
||||
rather than a free pass.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. CSP enforcement is the
|
||||
browser's own security layer, unaffected by fingerprint patching in either direction.*
|
||||
@@ -0,0 +1,305 @@
|
||||
---
|
||||
title: "How DataDome's bot detection actually works"
|
||||
description: "DataDome scores a request on three layers before the page finishes loading: TLS and HTTP fingerprint, a JavaScript device and behavior collector, and a cookie that remembers the verdict. Read from DataDome's own docs and confirmed reverse engineering."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 24
|
||||
---
|
||||
|
||||
|
||||
# How DataDome's bot detection actually works
|
||||
|
||||
DataDome is not a library you install and read the source of. It is a paid
|
||||
service run partly on its own servers, so most of what circulates about it
|
||||
online is reverse-engineered from the outside rather than read from a
|
||||
repository. That is a real gap in a corpus like this one: DataDome sits in
|
||||
front of a large share of retail, travel and ticketing traffic, and "datadome
|
||||
bypass" and "datadome cookie playwright" are two of the most consistently
|
||||
searched anti-bot terms there are.
|
||||
|
||||
This page separates what DataDome documents about its own product from what
|
||||
independent reverse engineering has confirmed, and says which is which. The
|
||||
short version: a request is scored on three layers before the page finishes
|
||||
loading, the TLS/HTTP handshake, a JavaScript collector that checks the
|
||||
device and, over the session, your behavior, and a cookie that remembers the
|
||||
verdict so the first two do not run again. None of the three are secret in
|
||||
outline. The scoring model behind them is.
|
||||
|
||||
Read from DataDome's own documentation on 2026-08-30
|
||||
([`docs.datadome.co`](https://docs.datadome.co/docs/device-check), the
|
||||
Device Check, JavaScript Tag, cookie and pre-activation checklist pages) and
|
||||
from practitioner reverse engineering also read 2026-08-30 (Scrapfly,
|
||||
ZenRows, and a public GitHub tool built to talk to DataDome's own challenge).
|
||||
Anything sourced only to the second group is marked as such below.
|
||||
|
||||
## Three layers, in the order a request meets them
|
||||
|
||||
| Layer | What it checks | Runs where |
|
||||
|---|---|---|
|
||||
| Network | TLS handshake (JA3/JA4-class fingerprint), HTTP/2 frame order, IP and ASN reputation | On the wire, before any page content is served |
|
||||
| Device and behavior | Canvas, WebGL, audio and font signals, automation-framework tells, then mouse, scroll, click and typing patterns over the session | An in-page JavaScript tag |
|
||||
| Session memory | An encrypted `datadome` cookie holding the last verdict | Your cookie jar, read on every subsequent request |
|
||||
|
||||
A request that fails the network layer badly enough never needs the other
|
||||
two. A request that looks fine on the network but has no cookie, or an
|
||||
expired one, gets the JavaScript layer. A request with a valid cookie mostly
|
||||
skips straight through: DataDome says plainly that once a device or visitor
|
||||
has been verified, "DataDome remembers the outcome and does not repeat the
|
||||
verification."
|
||||
|
||||
## The network layer: before your JavaScript even runs
|
||||
|
||||
The TLS `ClientHello`, sent before either side has exchanged a single
|
||||
application byte, encodes which cipher suites, TLS version and extensions
|
||||
the client supports, and it differs by TLS library in ways JavaScript cannot
|
||||
touch, because JavaScript has not started running yet. DataDome's own
|
||||
engineering blog (read via its Security Boulevard reprint, since the
|
||||
original page on `datadome.co` blocked direct retrieval this session) states
|
||||
the fingerprint is "quite stable and unique for a device type, browser, and
|
||||
OS," and that the same model catches two patterns: bots whose TLS stack has
|
||||
a fingerprint nothing else shares, and clients claiming to be one thing
|
||||
(Chrome 102, say) while their handshake belongs to something else. [How JA3
|
||||
and JA4 actually work, and why neither can be patched from inside the
|
||||
browser](ja3-ja4-tls-fingerprint.md); [the HTTP/2 SETTINGS frame and header
|
||||
order sit one layer above it, and DataDome reads that too](http2-fingerprint-detection.md).
|
||||
|
||||
Same source: DataDome states its engine processes on the order of three
|
||||
trillion signals a day (2022 figure). A separate 2026 write-up from
|
||||
Scrapfly, a scraping infrastructure vendor, cites five trillion a day and
|
||||
"over 85,000 customer-specific and use-case-specific models," one set per
|
||||
protected site instead of one global model. Four years apart and not
|
||||
necessarily in tension, but neither figure is audited, so treat both as
|
||||
vendor reporting, not something this page verified independently.
|
||||
|
||||
IP and ASN sit in the same layer conceptually: whether the address is
|
||||
residential, mobile or datacenter, its distance from the claimed timezone,
|
||||
how many recent requests share it. [What ASN and IP reputation actually
|
||||
score, and how fast it decays, is covered separately](asn-and-ip-reputation-in-bot-detection.md);
|
||||
DataDome's docs do not detail IP scoring, so this leans on the practitioner
|
||||
writeups, not DataDome's own pages.
|
||||
|
||||
## The device check: what the JavaScript tag actually collects
|
||||
|
||||
DataDome's own JavaScript Tag documentation describes an inline script meant
|
||||
to sit at the very start of `<head>`, before any other resource loads, so it
|
||||
can intercept `XMLHttpRequest` and `fetch` calls and show a challenge before
|
||||
the page's own requests go out:
|
||||
|
||||
```html
|
||||
<script>
|
||||
window.ddjskey = 'YOUR_DATADOME_JS_KEY';
|
||||
window.ddoptions = {};
|
||||
</script>
|
||||
<script src="https://js.datadome.co/tags.js" async></script>
|
||||
```
|
||||
|
||||
`ddjskey` is the site's own public key, set by whoever integrates DataDome,
|
||||
not something generated per visitor. According to DataDome's own docs, the
|
||||
tag collects two kinds of data: "behavioral data from the client... such as
|
||||
mouse movements or key strokes," and "generic information about the OS, the
|
||||
browser itself, the GPU, etc." It also runs, in DataDome's own words,
|
||||
consistency checks aimed specifically at Headless Chrome, Puppeteer,
|
||||
Puppeteer Extra Stealth and modified Selenium builds. The payload is POSTed
|
||||
to `api-js.datadome.co/js/`.
|
||||
|
||||
DataDome does not publish the individual checks inside that collector, so
|
||||
the specifics here come from reverse engineering, not `docs.datadome.co`.
|
||||
ZenRows' own deobfuscation of a live DataDome bundle reports "over 35
|
||||
functions" prefixed `dd_`, gathering canvas, WebGL and font signals alongside
|
||||
the automation-framework checks DataDome's docs already name. Scrapfly's
|
||||
breakdown, published as part of its own bypass product, adds more: dual-
|
||||
probing 19 MIME types twice, checking WebGL parameter coherence, reading
|
||||
`navigator.keyboard.getLayoutMap()`, battery status, `speechSynthesis` voice
|
||||
lists, camera/microphone permission state, and two separate sets of
|
||||
User-Agent Client Hints. A vendor selling a bypass product has an obvious
|
||||
incentive to make its own reverse engineering sound thorough, so read this
|
||||
list as corroborated in outline, two unrelated writeups converge on canvas,
|
||||
WebGL, fonts and automation-framework checks, not verified line by
|
||||
line.
|
||||
|
||||
DataDome's own **Device Check** feature is the name for the invisible
|
||||
version of this: it fires, per DataDome's docs, "when a bot is detected...
|
||||
but the evidence of bot activity is not strong enough to block it," or when
|
||||
the requested resource looks sensitive on its own. It is enabled by default,
|
||||
"collect[s] hundreds of signals and perform[s] several checkpoints on the
|
||||
device and environment," and returns one of three outcomes: block, allow, or
|
||||
escalate to a visible challenge. DataDome states plainly that "no personal
|
||||
information is collected" by this step.
|
||||
|
||||
## The cookie, and what happens when it is missing
|
||||
|
||||
DataDome's own cookie documentation is specific: named `datadome`,
|
||||
documented at roughly 128 bytes, expiring after about a year, its value
|
||||
encrypted and, per DataDome, holding no personally identifying information.
|
||||
The same page instructs site owners never to mark it `HttpOnly` or move its
|
||||
`Domain`/`Path`, because DataDome's own JavaScript needs to read and write it
|
||||
directly, the opposite of how a typical session-security cookie is usually
|
||||
configured. DataDome describes the cookie's job as enabling "both
|
||||
server-side and client-side detection to assess the legitimacy of a
|
||||
request." [Reading and setting cookies through a Playwright context, and why
|
||||
a hand-set cookie can look unearned next to one a real visit produced, has
|
||||
its own page](read-set-cookies-playwright-context.md).
|
||||
|
||||
For what happens when that cookie is missing, expired, or fails validation,
|
||||
DataDome's pre-activation docs name two default challenge types per
|
||||
protected endpoint: **Slider**, the primary one, and **Device Check** as the
|
||||
automatic fallback if Slider is turned off for that endpoint. If an operator
|
||||
disables both for an endpoint, requests there are simply allowed through,
|
||||
per DataDome's own docs, a genuine gap and not a weakness anyone has to
|
||||
guess at.
|
||||
|
||||
The page a browser sees when neither a valid cookie nor a passing Device
|
||||
Check is present is what people who reverse-engineer DataDome call the
|
||||
"interstitial" or the "5-second challenge", terms from that community, not
|
||||
DataDome's own published vocabulary in what this page could retrieve. A
|
||||
concrete example of that reverse engineering: a public GitHub project,
|
||||
`Datadome-Interstital-Encryptor`, builds exactly the encrypted payload this
|
||||
challenge expects. Its README shows the inputs, a `datadome` cookie, a
|
||||
per-site hash, and named "signals" added one at a time before the tool
|
||||
encrypts them into a payload submitted back in exchange for a fresh
|
||||
`datadome` cookie that lets the next request through. The tool proves the
|
||||
shape of the exchange is real; it does not reveal what DataDome's server
|
||||
does with the signals, because that part is not public from either side.
|
||||
|
||||
## Behavior does not stop being scored once you are past the door
|
||||
|
||||
A passing Device Check or a valid cookie is not a permanent pass. Per
|
||||
Scrapfly's description, DataDome keeps scoring mouse trajectories, scroll
|
||||
velocity, click coordinates, typing cadence and dwell time across the whole
|
||||
session, comparing that behavioral signature against models trained on that
|
||||
specific site's own legitimate traffic, which is what the per-customer-model
|
||||
figure above describes. [What mouse-dynamics behavioral biometrics actually
|
||||
score, distribution by distribution rather than field by field, is covered
|
||||
separately](mouse-dynamics-behavioural-biometrics.md). This is also where an
|
||||
automation *script* creates its own signal, independent of the engine it
|
||||
drives: a click that always lands dead-center, a scroll that jumps to the
|
||||
same offset on a fixed interval, or fields filled at an inhumanly constant
|
||||
rhythm all read as machine regularity, no matter how faithfully the engine
|
||||
underneath renders canvas or answers TLS.
|
||||
|
||||
## What an engine answers honestly, and what sits outside its reach
|
||||
|
||||
This is the honest boundary, and it matters more here than almost anywhere
|
||||
else in this corpus, because DataDome checks span from the TLS library up
|
||||
through months of session history.
|
||||
|
||||
**What a genuinely real Firefox engine answers correctly, by construction,
|
||||
with nothing spoofed at the JavaScript layer:** the TLS handshake and the
|
||||
HTTP/2 frame order, because they come from a real Firefox stack rather than
|
||||
an impersonation of one; canvas, WebGL and AudioContext output, because they
|
||||
come out of the real rendering and audio paths instead of a patched return
|
||||
value; native function `toString()` output, `navigator.webdriver` and the
|
||||
rest of the automation-framework tells DataDome's own docs name, because
|
||||
there is no CDP-driven Chromium underneath pretending; and font enumeration
|
||||
and OS-backed values like `navigator.keyboard.getLayoutMap()`, because they
|
||||
come from a real OS-facing path instead of a JavaScript-level override. That
|
||||
is a claim about which category of check has nothing to find, not a claim
|
||||
that any specific vendor's model is defeated.
|
||||
|
||||
**What sits entirely outside what any browser engine, real or patched, can
|
||||
answer:** IP reputation and ASN, a property of the network path rather than
|
||||
the browser; DataDome's server-side ML score and its per-site models, which
|
||||
run on DataDome's own infrastructure and are not observable from the client
|
||||
at all; and account or session history, since the `datadome` cookie's own
|
||||
roughly year-long lifetime exists specifically to reward continuity a single
|
||||
fresh session cannot have. Behavioral scoring sits in a third category: it
|
||||
is produced by whatever is driving the browser, not the browser itself, a
|
||||
property of the automation code and its pacing, [which has its own, separate
|
||||
discussion](ai-agent-timing-signal.md), not of engine realness.
|
||||
|
||||
And the interactive **Slider** challenge specifically is a puzzle a visitor
|
||||
solves, not a fingerprint a browser answers. `invisible_playwright` is
|
||||
engine-level work: a patched Firefox that answers the device and consistency
|
||||
checks in the table above the way a real Firefox would. It does not include,
|
||||
and does not sell, a captcha or puzzle-solving service, and nothing here
|
||||
should be read as a claim that it clears DataDome's slider, its behavioral
|
||||
scoring, or its server-side risk model. Those are different problems from
|
||||
the one an honest engine solves, and no amount of engine fidelity
|
||||
substitutes for a clean, reputable IP or human-paced interaction.
|
||||
|
||||
One 2026 wrinkle worth noting: DataDome's own pre-activation checklist now
|
||||
lists **MCP** (Model Context Protocol) alongside Web Browsers, Mobile Apps
|
||||
and APIs as a "Traffic Source," with a separate "Agentic Trust" setting for
|
||||
scoring AI-agent traffic. It is the same three-layer model applied to a
|
||||
newer client, not a new mechanism: an LLM-driven agent still opens a TLS
|
||||
connection, still runs (or fails to run) the collector, and still produces a
|
||||
behavioral trace, [which has a signature of its own that no fingerprint
|
||||
fixes](ai-agent-timing-signal.md).
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What is DataDome?** A commercial anti-bot and WAF-adjacent service that
|
||||
protects a site's traffic by scoring the TLS/HTTP handshake, an in-page
|
||||
JavaScript device and behavior collector, and a session cookie, then
|
||||
blocking, challenging or allowing each request.
|
||||
|
||||
**What triggers DataDome's challenge?** A missing or invalid `datadome`
|
||||
cookie, a network-layer signal that looks wrong (an inconsistent TLS
|
||||
fingerprint, a flagged IP), or a JavaScript-layer signal that looks wrong
|
||||
(an automation-framework tell, an inconsistent device fingerprint). Any one
|
||||
of the three can be enough on its own.
|
||||
|
||||
**What is the difference between Device Check and the Slider challenge?**
|
||||
Per DataDome's own docs, Slider is the default, primary interactive
|
||||
challenge; Device Check is the automatic, invisible fallback if Slider is
|
||||
turned off for that endpoint, and can also run on its own when evidence
|
||||
against a request is present but not strong enough to block outright.
|
||||
|
||||
**Does a real, unpatched browser engine beat DataDome?** It correctly
|
||||
answers the device and consistency layer, the one an engine can honestly
|
||||
answer. It says nothing about IP reputation, DataDome's server-side ML score,
|
||||
session history, or the Slider puzzle itself, which are separate problems.
|
||||
|
||||
**Does invisible_playwright solve DataDome's captcha for me?** No. It is
|
||||
engine-level realness, a patched Firefox that answers device checks
|
||||
honestly. It does not include a puzzle-solving or captcha-solving service of
|
||||
any kind.
|
||||
|
||||
**Why would a request still get challenged with a clean fingerprint?**
|
||||
Because the fingerprint is one of three layers. A datacenter IP, a session
|
||||
with no history, or a behavioral pattern that reads as machine-regular can
|
||||
each trigger a challenge on their own, independent of whether the device
|
||||
fingerprint was clean.
|
||||
|
||||
**See also:** [JA3 and JA4: why a TLS fingerprint cannot be patched](ja3-ja4-tls-fingerprint.md),
|
||||
[what ASN and IP reputation score, and how fast it decays](asn-and-ip-reputation-in-bot-detection.md),
|
||||
[what mouse-dynamics behavioral biometrics actually measure](mouse-dynamics-behavioural-biometrics.md),
|
||||
and [the checklist for when one site detects you](playwright-detected-as-bot.md).
|
||||
|
||||
## Sources
|
||||
|
||||
- DataDome's own documentation, read 2026-08-30: [Device Check](https://docs.datadome.co/docs/device-check),
|
||||
[JavaScript Tag](https://docs.datadome.co/docs/javascript-tag),
|
||||
[cookie and stored data](https://docs.datadome.co/docs/cookie-session-storage), and the
|
||||
[pre-activation checklist](https://docs.datadome.co/docs/checklist-before-activating-protection),
|
||||
for trigger conditions, JS Tag behavior, cookie name/size/expiry, and the
|
||||
Slider/Device Check pairing including the MCP/Agentic Trust category.
|
||||
- DataDome's own engineering blog on TLS fingerprinting, read via its
|
||||
[Security Boulevard reprint](https://securityboulevard.com/2022/10/how-tls-fingerprinting-reinforces-datadomes-protection/)
|
||||
(the original `datadome.co` page returned a 403 to this session's fetch
|
||||
tool), read 2026-08-30, for the "three trillion signals a day" figure and
|
||||
the two TLS-mismatch patterns it detects.
|
||||
- Press coverage of the Device Check launch, [Help Net Security, 2023-12-12](https://www.helpnetsecurity.com/2023/12/12/datadome-device-check/),
|
||||
read 2026-08-30, for the company's self-reported accuracy and
|
||||
SDK-deployment figures at launch.
|
||||
- Scrapfly, read 2026-08-30: its [DataDome bypass product page](https://scrapfly.io/bypass/datadome)
|
||||
for the detection-layer chain and collector checks (codec dual-probe,
|
||||
keyboard layout map, WebGL coherence), and its [blog post on bypassing
|
||||
DataDome](https://scrapfly.io/blog/posts/how-to-bypass-datadome-anti-scraping)
|
||||
for the 85,000-model and five-trillion-signal figures, both self-reported
|
||||
by a vendor selling a competing bypass product.
|
||||
- ZenRows' [DataDome bypass writeup](https://www.zenrows.com/blog/datadome-bypass),
|
||||
read 2026-08-30, for its own deobfuscation results (the `dd_`-prefixed
|
||||
function count) and its TLS/header check description.
|
||||
- [`glizzykingdreko/Datadome-Interstital-Encryptor`](https://github.com/glizzykingdreko/Datadome-Interstital-Encryptor)
|
||||
on GitHub, read 2026-08-30, a real public reverse-engineering project, for
|
||||
the concrete shape of the interstitial payload (cookie, site hash, named
|
||||
signals) practitioners have independently worked out.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright).
|
||||
DataDome does not publish its scoring model or the full list of what its
|
||||
collector checks, so this page draws a line between DataDome's own
|
||||
documentation and outside reverse engineering everywhere that line exists,
|
||||
rather than presenting both as equally certain.*
|
||||
@@ -94,7 +94,7 @@ consumer operating system, and that mismatch is the signal.
|
||||
|
||||
Claiming Windows in the user agent while the font vector is a Linux base image
|
||||
is a one-line contradiction, and it is exactly the kind of internal disagreement
|
||||
that [a browser that inspects consistency rather than values](how-to-test-bot-detection.md)
|
||||
that [a browser that inspects consistency, not values](how-to-test-bot-detection.md)
|
||||
records as a lie.
|
||||
|
||||
The same probe list produces a different vector in each of these three cases:
|
||||
|
||||
@@ -12,7 +12,7 @@ nav_order: 12
|
||||
No. A VPN changes one thing: the IP address the server sees. The browser
|
||||
fingerprint - canvas, WebGL, installed fonts, the user agent, the timezone, the
|
||||
hardware counters - is exactly what it was before you connected. Worse, a VPN can
|
||||
make a session look more suspicious rather than less, because it introduces a second
|
||||
make a session look more suspicious, not less, because it introduces a second
|
||||
story about where you are and gives a detector two stories to compare.
|
||||
|
||||
This page is what a VPN moves, what it leaves in place, the specific way it can
|
||||
@@ -35,7 +35,7 @@ different problem with a different owner.
|
||||
|
||||
## What a VPN leaves untouched
|
||||
|
||||
Open any fingerprinting report through a VPN and read the fields rather than the
|
||||
Open any fingerprinting report through a VPN and read the fields, not the
|
||||
verdict. The address at the top has changed. Nothing below it has:
|
||||
|
||||
- **[Canvas](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API) and
|
||||
|
||||
@@ -0,0 +1,214 @@
|
||||
---
|
||||
title: "Does Playwright Support Firefox Extensions?"
|
||||
description: "Playwright's documented extension API, launch_persistent_context plus --load-extension, is Chromium-only. Loading an .xpi into Firefox means a persistent profile, not a launch flag."
|
||||
parent: "Scraping with Playwright"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 145
|
||||
---
|
||||
|
||||
|
||||
# Does Playwright Support Firefox Extensions?
|
||||
|
||||
Not the way it supports them on Chromium. Playwright's documented extension-loading
|
||||
API, a persistent context launched with `--disable-extensions-except` and
|
||||
`--load-extension`, is explicitly Chromium-only, and Firefox has no first-class
|
||||
equivalent in the public API. Firefox can still end up running an extension, but the
|
||||
route there is a persistent browser profile with the `.xpi` already installed in it,
|
||||
not a launch-time argument Playwright resolves for you.
|
||||
|
||||
This gets asked because the Chromium path is well documented and looks like it should
|
||||
generalize, and because the honest answer involves a handful of old, still-open
|
||||
GitHub issues instead of a clean feature page. Here is what Playwright actually
|
||||
supports, what does not work, and the one route that does.
|
||||
|
||||
## What Playwright's documented extension support actually is
|
||||
|
||||
Playwright's own extension-loading guide is unambiguous about scope:
|
||||
|
||||
> "Extensions only work in Chromium when launched with a persistent context."
|
||||
|
||||
The mechanism it documents is `chromium.launchPersistentContext()` with two Chromium
|
||||
command-line flags:
|
||||
|
||||
- `--disable-extensions-except=${pathToExtension}`
|
||||
- `--load-extension=${pathToExtension}`
|
||||
|
||||
That page makes no mention of Firefox or WebKit anywhere. This is not an omission in
|
||||
the docs; it reflects what actually exists. Chrome and Chromium extensions are loaded
|
||||
through Chromium's own command-line surface, which Playwright forwards through
|
||||
untouched. There is no Firefox equivalent of `--load-extension` for Playwright to
|
||||
forward to, because Firefox does not expose one to launch-time flags in the first
|
||||
place.
|
||||
|
||||
## What has actually been tried, and where it stalls
|
||||
|
||||
Firefox extension support has been requested since early in Playwright's life, and the
|
||||
GitHub issue history is a reasonably complete map of where it breaks:
|
||||
|
||||
- **[Issue #2644](https://github.com/microsoft/playwright/issues/2644)**, "Support
|
||||
browser extension loading in Firefox," is closed without the feature having shipped
|
||||
as a first-class API.
|
||||
- **[Issue #7297](https://github.com/microsoft/playwright/issues/7297)**, "Support
|
||||
running extensions with Firefox," reports the same shape of failure from a different
|
||||
angle: passing Chromium-style extension flags to a Firefox launch starts the browser,
|
||||
but Playwright cannot then connect to drive it.
|
||||
- **[Issue #15299](https://github.com/microsoft/playwright/issues/15299)** describes
|
||||
launching Firefox with an extension already producing a confirmation popup asking a
|
||||
human to approve the install, which blocks unattended automation outright.
|
||||
- **[Issue #9202](https://github.com/microsoft/playwright/issues/9202)**, closed, is
|
||||
specifically about unsigned extensions: even after setting Firefox's own
|
||||
`xpinstall.signatures.required` preference to `false`, a Firefox instance launched by
|
||||
Playwright still refused to install one.
|
||||
|
||||
None of these landed a documented, supported Firefox extension-loading API. Read
|
||||
together, they describe the practical failure modes rather than a single missing
|
||||
flag: Chromium's launch-flag approach does not translate, a raw XPI install can
|
||||
trigger a manual confirmation dialog, and even the preference meant to relax Firefox's
|
||||
signature enforcement has not reliably worked through Playwright's launch path. Treat
|
||||
any of the four as evidence of the state of things at the time it was filed rather than
|
||||
a guarantee about the exact behavior of every Firefox build going forward.
|
||||
|
||||
## The route that does work: a persistent profile
|
||||
|
||||
Firefox stores installed extensions inside its profile directory, the way it stores
|
||||
cookies, history and every other piece of per-profile state. Nothing about that
|
||||
mechanism runs through Playwright's launch arguments at all, which is exactly why it
|
||||
still works: you are not asking Playwright to load an extension, you are asking
|
||||
Firefox to open a profile that already has one installed.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# first run: launch headed, pointed at a profile you intend to keep,
|
||||
# and install the .xpi through Firefox's own UI - drag it onto the
|
||||
# window, or use about:addons - the normal way a person would
|
||||
with InvisiblePlaywright(seed=42, profile_dir="/path/to/profile", headless=False) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("about:addons")
|
||||
# install manually here, then close the browser
|
||||
|
||||
# every run after that: the same profile directory carries the
|
||||
# extension forward, because it was never Playwright's to load
|
||||
with InvisiblePlaywright(seed=42, profile_dir="/path/to/profile") as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
```
|
||||
|
||||
Without `profile_dir`, this project builds a fresh profile from the seed on every
|
||||
launch, which is exactly why an extension installed in one run disappears in the
|
||||
next - there is no profile left afterward to have kept it. The `profile_dir` /
|
||||
persistent-profile pattern, including its other traps (a stale seed, a stored
|
||||
permission that quietly changes WebRTC behavior), is covered in full in
|
||||
[Playwright persistent profile: what it fixes and breaks](persistent-profiles.md).
|
||||
|
||||
**invisible_playwright does not add extension-loading support on top of this.** There
|
||||
is no extension argument in the wrapper's launch call. What you are using is Firefox's
|
||||
own, ordinary "the profile already has this installed" behavior, the same mechanism a
|
||||
real desktop Firefox uses, reached through the persistent-profile option this project
|
||||
already exposes for other reasons.
|
||||
|
||||
## The signature question, and why to test it rather than assume it
|
||||
|
||||
A release build of Firefox enforces that extensions be signed by Mozilla, and the
|
||||
`xpinstall.signatures.required` preference is the documented way to relax that on
|
||||
builds that honor it (Developer Edition, Nightly, and unbranded/ESR builds
|
||||
traditionally do; a standard release build may not). Whether the specific patched
|
||||
Firefox binary this project ships behaves like one of those relaxed builds for
|
||||
signature purposes is not something this page can state without checking that exact
|
||||
binary, so if an unsigned `.xpi` refuses to install, that preference is the first thing
|
||||
to check, and confirming it against your own pinned build is the only way to know for
|
||||
certain.
|
||||
|
||||
## Should you, though: extensions as a fingerprint surface
|
||||
|
||||
Getting an extension to load is a mechanical question. Whether it is a good idea is a
|
||||
separate one, and this project already has an answer, at length, on
|
||||
[browser extensions as a fingerprint surface](browser-extension-fingerprint.md): an
|
||||
installed extension is detectable through the web-accessible resources it exposes,
|
||||
through what it visibly changes on the page, and through the same override traces any
|
||||
injected script leaves behind. That page also covers the specific trap of stacking a
|
||||
*stealth* extension on top of an engine that already decides the same fingerprint
|
||||
values in C++ - two components disagreeing with each other, which is easier to spot
|
||||
than either value alone. If the extension you want is functional rather than
|
||||
stealth-related, that page's guidance still applies: know what it changes, and check it
|
||||
against a clean profile before trusting it in production.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Chromium extension loading in Playwright is a documented, supported feature reached
|
||||
through a command-line flag on a persistent context. Firefox has no equivalent, and a
|
||||
handful of long-open GitHub issues describe exactly where the naive attempts stall:
|
||||
the flags do not translate, a raw install can demand a manual confirmation click, and
|
||||
signature enforcement has been an independent obstacle on top of both. The route that
|
||||
actually works sidesteps Playwright's launch arguments entirely - install the `.xpi`
|
||||
into a persistent Firefox profile through the browser's own UI once, then keep
|
||||
launching against that same profile directory. It is Firefox's own mechanism, not a
|
||||
Playwright feature, and it is the only one of the options here with a real track
|
||||
record.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can I load a Firefox extension with Playwright the same way I load a Chrome
|
||||
extension?** No. Chromium's `--load-extension` / `--disable-extensions-except` flags on
|
||||
`launchPersistentContext` are Chromium-only per Playwright's own documentation. There
|
||||
is no Firefox equivalent.
|
||||
|
||||
**Is Firefox extension support ever coming to Playwright?** Several feature requests
|
||||
for it are years old and closed without a shipped API. There is no committed feature
|
||||
here to point to, only the workaround below.
|
||||
|
||||
**How do I actually get an extension into a Playwright-driven Firefox?** Install it
|
||||
once into a persistent profile through Firefox's own add-ons UI, headed, then relaunch
|
||||
every session against that same profile directory with `profile_dir`.
|
||||
|
||||
**Why did my extension disappear on the next run?** Because a fresh profile is built
|
||||
from the seed on every launch unless you pass `profile_dir`. Without a persistent
|
||||
profile, there is nothing to carry the install forward.
|
||||
|
||||
**My unsigned extension won't install. Why?** Standard Firefox release builds require
|
||||
Mozilla-signed extensions. The documented relaxation is the
|
||||
`xpinstall.signatures.required` preference, but whether the specific build you are
|
||||
running honors it is worth testing rather than assuming.
|
||||
|
||||
**Does invisible_playwright add its own extension support?** No. It exposes a
|
||||
persistent-profile option for other reasons, and Firefox's own profile-based extension
|
||||
storage rides along on top of that. There is no extension-specific argument in the
|
||||
wrapper.
|
||||
|
||||
**Is adding an extension a good idea for a stealth session?** Only for functionality,
|
||||
not for stealth. An extension is its own detectable fingerprint surface, and a stealth
|
||||
extension stacked on an already-patched engine tends to make sessions easier to spot,
|
||||
not harder.
|
||||
|
||||
## Sources
|
||||
|
||||
- Playwright's own [Chrome extensions documentation](https://playwright.dev/docs/chrome-extensions),
|
||||
retrieved 2026-08-30, for the "Chromium when launched with a persistent context"
|
||||
scope statement and the exact launch flags quoted above.
|
||||
- [microsoft/playwright issue #2644](https://github.com/microsoft/playwright/issues/2644),
|
||||
retrieved 2026-08-30, "Support browser extension loading in Firefox," closed without
|
||||
a shipped equivalent.
|
||||
- [microsoft/playwright issue #7297](https://github.com/microsoft/playwright/issues/7297),
|
||||
retrieved 2026-08-30, on Playwright failing to connect after a Firefox launch with
|
||||
extension flags.
|
||||
- [microsoft/playwright issue #15299](https://github.com/microsoft/playwright/issues/15299),
|
||||
retrieved 2026-08-30, on a manual confirmation popup blocking unattended extension
|
||||
install.
|
||||
- [microsoft/playwright issue #9202](https://github.com/microsoft/playwright/issues/9202),
|
||||
retrieved 2026-08-30, on unsigned extensions still being refused after setting
|
||||
`xpinstall.signatures.required` to `false`.
|
||||
- This project's own `profile_dir` mechanism and its fingerprint-surface notes, linked
|
||||
above.
|
||||
|
||||
**See also:** [Browser extensions are a fingerprint surface](browser-extension-fingerprint.md)
|
||||
for how a loaded extension is detected and why a stealth extension is usually the wrong
|
||||
move, and [Playwright persistent profile: what it fixes and breaks](persistent-profiles.md)
|
||||
for the full mechanics and traps of the `profile_dir` option this page's workaround
|
||||
depends on.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. The honest answer here is a persistent profile and
|
||||
a handful of old GitHub issues, not a launch flag, and pretending otherwise would just
|
||||
cost someone an afternoon finding that out the hard way.*
|
||||
@@ -0,0 +1,186 @@
|
||||
---
|
||||
title: "Does Playwright Trigger hCaptcha More Often?"
|
||||
description: "Why Playwright sessions escalate to hCaptcha's visual challenge more often. How hCaptcha's invisible pass reads fingerprint, IP, and session inputs, and which of those a browser engine can actually move."
|
||||
parent: "Testing and Troubleshooting"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 26
|
||||
---
|
||||
|
||||
|
||||
# Does Playwright Trigger hCaptcha More Often?
|
||||
|
||||
Often, yes. hCaptcha runs an invisible risk pass before it ever shows anything, and a
|
||||
default Playwright session gives that pass more reasons to escalate than a browser a
|
||||
person has actually been using does. That is not a single "this is Playwright" flag
|
||||
either. It is the same shape of problem covered on
|
||||
[the reCAPTCHA version of this page](does-playwright-trigger-recaptcha.md): several
|
||||
inputs, most of them not published, several of them pushed the wrong way at once by a
|
||||
fresh automated context.
|
||||
|
||||
[hCaptcha, Explained](hcaptcha-explained.md) covers the two-stage mechanism in full,
|
||||
the invisible pass and the visual puzzle it falls back to. This page is about what tips
|
||||
that first stage toward showing you the second one, and which parts of that a
|
||||
patched, engine-level browser can actually change.
|
||||
|
||||
## What the invisible pass is deciding
|
||||
|
||||
hCaptcha's own documentation frames the decision at category level only: a challenge
|
||||
appears based on "computed confidence in the visitor's humanity, the site difficulty
|
||||
setting, and other security factors," and hCaptcha's Pro-tier docs describe the
|
||||
underlying evaluation as drawn from "thousands of factors," aimed at keeping visible
|
||||
challenges under roughly 0.1% of real visitors. Neither document names the specific
|
||||
signals or their weights, and this page does not claim to know them either, the same
|
||||
honesty this corpus applies to [Arkose's undisclosed "225+ risk signals"](arkose-labs-funcaptcha-explained.md#what-arkoses-own-materials-say-and-where-they-stop).
|
||||
|
||||
What is confirmed, from hCaptcha's own API surface, is that the server-side
|
||||
`siteverify` call accepts an optional `remoteip` parameter that hCaptcha's own docs say
|
||||
improves the check's accuracy, which is a direct acknowledgment that the requesting
|
||||
address is one of the inputs, alongside whatever the client-side script itself collects.
|
||||
|
||||
## The inputs that plausibly feed the score
|
||||
|
||||
Reasoning from what a browser-based risk pass generally reads, and from hCaptcha's own
|
||||
partial disclosures, the same broad families that drive
|
||||
[reCAPTCHA's score](does-playwright-trigger-recaptcha.md#the-inputs-that-feed-the-score)
|
||||
apply here too:
|
||||
|
||||
- **Fingerprint and engine consistency.** Whether the browser's claimed identity agrees
|
||||
with how it actually behaves, an inconsistency this corpus has documented in general
|
||||
through [`navigator.webdriver`](does-playwright-set-navigator-webdriver.md) and other
|
||||
automation tells that a stock automated launch leaves in place.
|
||||
- **IP reputation.** Confirmed as an input via the `remoteip` parameter above. A
|
||||
datacenter address or one already flagged by other traffic raises suspicion regardless
|
||||
of what the browser reports.
|
||||
- **Session and cookie history.** A brand-new context with nothing behind it looks
|
||||
different from a browser that has actually been used, the same "a fresh profile has no
|
||||
past" argument [made in full on the reCAPTCHA v3 score page](recaptcha-v3-score.md).
|
||||
- **Interaction pattern.** How the page got its click or its keystrokes, before the
|
||||
challenge ever renders, is part of what "other security factors" plausibly covers,
|
||||
though hCaptcha's own docs do not spell this out explicitly.
|
||||
|
||||
One nuance worth being precise about: hCaptcha's own marketing draws a contrast with
|
||||
"traditional fingerprints," describing its passive modes as working "without
|
||||
fingerprinting" and framing device fingerprints as becoming obsolete as a detection
|
||||
tool. Read that as a positioning claim about where hCaptcha says it is putting its
|
||||
effort, not as proof that browser-level consistency checks play no role at all in the
|
||||
undisclosed "thousands of factors." hCaptcha does not publish enough for either reading
|
||||
to be stated as settled fact, and this page does not pretend otherwise.
|
||||
|
||||
## Which input the browser layer actually moves
|
||||
|
||||
Of those families, the browser engine itself can only speak to one: whether the
|
||||
JavaScript-visible surface of the browser is internally consistent and behaves like a
|
||||
genuine instance of the engine it claims to be. Stock Playwright driving stock Firefox
|
||||
or Chromium leaves a scattering of small disagreements here, an automation property
|
||||
like `navigator.webdriver`, a headless context missing a real GPU, a font set or codec
|
||||
list that does not match the claimed platform. Each one is a plausible, if unconfirmed,
|
||||
contributor to whatever "other security factors" hCaptcha's decision actually weighs.
|
||||
|
||||
IP reputation, session history and interaction pattern are not properties of the
|
||||
browser engine at all. No amount of patching below the JavaScript layer manufactures a
|
||||
browsing history, warms a cold IP, or paces a click for you.
|
||||
|
||||
## What invisible_playwright does, and a two-line example
|
||||
|
||||
invisible_playwright is a Firefox patched at the C++ level and driven by stock
|
||||
Playwright. Its contribution to this specific problem is the fingerprint-and-engine
|
||||
input: instead of a scattering of disagreements, it presents one coherent real Firefox,
|
||||
with GPU, audio, fonts, screen and roughly 400 fields derived together from a single
|
||||
seed so they agree with each other and with a genuine desktop build.
|
||||
|
||||
Switching from plain Playwright is two lines, and every Playwright method works
|
||||
unchanged because the returned object is a real Playwright
|
||||
[`Browser`](https://playwright.dev/python/docs/api/class-browser):
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# seed=42 makes the identity reproducible: same GPU, fonts, canvas hash every run
|
||||
with InvisiblePlaywright(seed=42, proxy={
|
||||
"server": "socks5://gate.example.com:1080",
|
||||
"username": "user",
|
||||
"password": "pass",
|
||||
}) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com/signup")
|
||||
page.click("#submit") # pointer arcs to the button on a Bezier curve
|
||||
```
|
||||
|
||||
The reproducible seed matters for debugging this specific problem: if a run escalates
|
||||
to hCaptcha's visual challenge, replay the exact same identity and change one variable,
|
||||
the proxy, the timing, the target page, at a time, rather than guessing whether the
|
||||
site's own thresholds moved or the browser did.
|
||||
|
||||
What this buys you is a smaller fingerprint-and-consistency contribution to whatever the
|
||||
invisible pass weighs. It does not touch the address you connect from, the history that
|
||||
session does or does not carry, or the rhythm of your own clicks, and it does not
|
||||
"solve" hCaptcha's pass/fail decision. There is no such thing, and this project does not
|
||||
claim to have found one.
|
||||
|
||||
## The inputs the browser cannot move
|
||||
|
||||
These stay yours to bring, and no browser-engine patch substitutes for them:
|
||||
|
||||
- **IP reputation.** A perfect fingerprint on a listed or overused address is still on a
|
||||
bad address. Rule out the exit first; see
|
||||
[how ASN and IP reputation feed bot detection](asn-and-ip-reputation-in-bot-detection.md).
|
||||
- **Session age.** A cookieless, day-zero context reads as fresh every single time.
|
||||
Warming a session or reusing storage state moves this, and it is not the browser's job.
|
||||
- **Behavior and timing.** Mechanical pacing scores against you no matter how real the
|
||||
browser looks underneath it.
|
||||
|
||||
If the fingerprint is coherent and the visible puzzle still shows up, the cause is one
|
||||
of these three, not the engine.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does Playwright itself get flagged by hCaptcha?** Not as a single named flag. hCaptcha
|
||||
does not publish its criteria, but a default Playwright session tends to combine an
|
||||
inconsistent browser fingerprint with a fresh, historyless session, both plausible
|
||||
contributors to whatever pushes the invisible pass toward escalating.
|
||||
|
||||
**Will a stealth browser stop hCaptcha's visual challenge from appearing?** It can lower
|
||||
the fingerprint-and-engine-consistency contribution. It does nothing for the IP address,
|
||||
the session's age, or your own timing, so on its own it will not stop every challenge.
|
||||
|
||||
**Can any browser guarantee I never see the puzzle?** No. hCaptcha's decision draws on
|
||||
undisclosed inputs the browser does not fully control, and even if it did, this project
|
||||
does not sell or claim a captcha-solving outcome for the puzzle itself.
|
||||
|
||||
**Is it the IP or the browser?** Test it directly: visit the same page by hand from the
|
||||
same machine and network. If the manual visit also escalates, look at the exit first,
|
||||
using [the detection checklist](playwright-detected-as-bot.md) to work the split in
|
||||
order.
|
||||
|
||||
**Does hCaptcha's "no fingerprinting" claim mean the browser doesn't matter?** Not
|
||||
necessarily. It is hCaptcha's own positioning against traditional device fingerprints,
|
||||
not a disclosure of the full input list behind its "thousands of factors." Treat it as a
|
||||
marketing claim to weigh, not as proof the browser layer is irrelevant.
|
||||
|
||||
## Sources
|
||||
|
||||
- hCaptcha, [Frequently Asked Questions](https://docs.hcaptcha.com/faq), retrieved
|
||||
2026-08-30, for the "computed confidence... site difficulty... other security
|
||||
factors" framing of the challenge decision.
|
||||
- hCaptcha, [Pro Features](https://docs.hcaptcha.com/pro), retrieved 2026-08-30, for the
|
||||
"thousands of factors" and "less than 0.1%" description of the passive evaluation.
|
||||
- hCaptcha, [Developer Guide](https://docs.hcaptcha.com/), retrieved 2026-08-30, for the
|
||||
`remoteip` parameter on the `siteverify` endpoint.
|
||||
- hCaptcha, [homepage](https://www.hcaptcha.com/), retrieved 2026-08-30, for the
|
||||
"without fingerprinting" and traditional-fingerprints-are-obsolete positioning quoted
|
||||
and weighed above.
|
||||
- This project's fingerprint generation, which derives roughly 400 fields from one seed
|
||||
so they agree with each other rather than contradicting.
|
||||
|
||||
**See also:** [hCaptcha, Explained](hcaptcha-explained.md) for the full two-stage
|
||||
mechanism this page assumes; [Does Playwright Trigger reCAPTCHA More Often?](does-playwright-trigger-recaptcha.md)
|
||||
for the structurally identical argument on Google's product; [how a browser trust score
|
||||
is assembled](browser-trust-score-explained.md); and
|
||||
[the checklist for being detected on one site](playwright-detected-as-bot.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. It moves the
|
||||
fingerprint-and-engine input into hCaptcha's invisible pass; the clean exit, the session
|
||||
history and the timing are still yours to bring.*
|
||||
@@ -69,7 +69,7 @@ are consistency gaps: a headless context with no real GPU, a screen size no disp
|
||||
list or font set that does not match the claimed platform. Each is a small addition to the
|
||||
score, and together they are the fingerprint contribution.
|
||||
|
||||
You can see this contribution directly rather than taking it on faith. Open the same
|
||||
You can see this contribution directly instead of taking it on faith. Open the same
|
||||
detector page in your automated browser and in a stock browser on the same machine, and
|
||||
diff the reports field by field. The
|
||||
[method for doing that comparison honestly](how-to-test-bot-detection.md) is worth reading
|
||||
|
||||
@@ -125,7 +125,7 @@ with InvisiblePlaywright(seed=42) as browser:
|
||||
page.goto("https://example.com")
|
||||
|
||||
# what a text / accessibility-tree agent would hand to the model
|
||||
tree = page.accessibility.snapshot()
|
||||
tree = page.aria_snapshot()
|
||||
text = page.inner_text("body")
|
||||
|
||||
# the model returns an action against a selector
|
||||
@@ -148,7 +148,7 @@ with InvisiblePlaywright(seed=42) as browser:
|
||||
page.mouse.click(220, 140)
|
||||
```
|
||||
|
||||
The `browser` is a real Playwright `Browser`, so `accessibility.snapshot()`,
|
||||
The `browser` is a real Playwright `Browser`, so `aria_snapshot()`,
|
||||
`inner_text()`, [`screenshot()`](https://playwright.dev/python/docs/api/class-page#page-screenshot)
|
||||
and [`mouse.click()`](https://playwright.dev/python/docs/api/class-mouse#mouse-click) are
|
||||
all the standard upstream methods.
|
||||
|
||||
@@ -10,7 +10,7 @@ nav_order: 10
|
||||
# Emoji fingerprinting: why emoji look the same on any OS
|
||||
|
||||
Emoji look the same on any OS in Firefox because Firefox draws colour emoji from
|
||||
its own bundled font rather than the platform's, so the render is host-independent.
|
||||
its own bundled font instead of the platform's, so the render is host-independent.
|
||||
That is worth explaining, because emoji are otherwise one of the oldest
|
||||
operating-system tells there is. The same code point is drawn from a different font
|
||||
on each platform, and those fonts do not agree on a single pixel: Windows renders
|
||||
@@ -48,7 +48,7 @@ operating system's emoji font at all. It ships its own colour-emoji font, based
|
||||
Twemoji, inside the browser package, and it rasterises colour emoji from that
|
||||
bundled file on every platform it runs on. A stock Firefox on Windows, a stock
|
||||
Firefox on macOS and a stock Firefox on Linux all draw the same emoji from the
|
||||
same font, because the font travels with the browser rather than coming from the
|
||||
same font, because the font travels with the browser instead of coming from the
|
||||
host.
|
||||
|
||||
That is a structural difference from Chrome, which defers to the platform emoji
|
||||
@@ -63,7 +63,7 @@ assume. The engine has already made the render host-independent.
|
||||
This project builds on that property deliberately. To make text match Windows on
|
||||
any host, the build bundles a set of real Windows font files and exposes only
|
||||
those families, so a Linux server draws Latin, CJK and the rest from genuine
|
||||
Windows glyphs rather than from whatever the host happens to have installed. The
|
||||
Windows glyphs, not from whatever the host happens to have installed. The
|
||||
same idea is covered in detail under [bundled fonts that render the same on every OS](bundled-fonts-cross-platform.md).
|
||||
|
||||
The emoji font is treated differently, and on purpose. The colour-emoji file is
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
---
|
||||
title: "net::ERR_ABORTED in Playwright"
|
||||
description: "net::ERR_ABORTED usually means a navigation was cancelled on purpose, by a redirect, a download, route.abort(), or a second goto(), not that anything actually failed. When it is benign and when it signals a real bug."
|
||||
parent: "Network, Proxy and WebRTC"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 33
|
||||
---
|
||||
|
||||
|
||||
# net::ERR_ABORTED in Playwright
|
||||
|
||||
`net::ERR_ABORTED` means a request was cancelled before it finished, not that it
|
||||
failed. Chromium's own network error list defines it as "an operation was aborted
|
||||
(due to user action)," and the cancelling "action" is very often something your own
|
||||
page, your own script, or Playwright's own navigation handling did on purpose. This
|
||||
is the one error on this page's list of siblings that is frequently not a problem at
|
||||
all, and treating every occurrence as a bug wastes time chasing something that
|
||||
already worked.
|
||||
|
||||
## The causes that are usually fine
|
||||
|
||||
**A download started instead of a page load.** When a navigation resolves to a file
|
||||
download instead of an HTML response, the browser aborts the page-level navigation
|
||||
in favor of handing the response to the download machinery, and Playwright surfaces
|
||||
that abort as `net::ERR_ABORTED` even though the file saves correctly.
|
||||
[microsoft/playwright-java#541](https://github.com/microsoft/playwright-java/issues/541)
|
||||
shows exactly this: navigating to a URL that returns only a JSON payload logs
|
||||
`net::ERR_ABORTED` on the response, reproduced across Chromium, Firefox and WebKit
|
||||
alike, with the download itself completing successfully regardless. The fix is not
|
||||
suppressing the error, it is not using `page.goto()` to wait on a navigation that was
|
||||
never going to become a page: use `page.expect_download()` around the action that
|
||||
triggers it instead.
|
||||
|
||||
**A redirect chain moved the page somewhere else mid-flight.** Authentication flows
|
||||
in particular chain several redirects, and Chromium's request lifecycle can report
|
||||
an intermediate hop as aborted, since it was superseded before completing, without
|
||||
the overall navigation actually failing.
|
||||
|
||||
**Two navigations fired in quick succession.** Calling `page.goto()` a second time
|
||||
before the first has resolved cancels the first, and the cancelled one reports
|
||||
`net::ERR_ABORTED`. This is standard browser behavior, not a Playwright defect, and
|
||||
it is intentional the moment your own code causes it.
|
||||
|
||||
**An SPA replaced the frame during navigation.** "Maybe frame was detached?" appended
|
||||
to the error, seen in reports like
|
||||
[microsoft/playwright#13071](https://github.com/microsoft/playwright/issues/13071)
|
||||
and [#34889](https://github.com/microsoft/playwright/issues/34889), points at a
|
||||
single-page app tearing down and rebuilding its root frame while a navigation was in
|
||||
flight, ordinary behavior for that class of app rather than a network failure.
|
||||
|
||||
## The causes that are a real problem
|
||||
|
||||
**Your own `page.route()` handler called `route.abort()`.** If a route handler is
|
||||
deliberately aborting requests, matched by URL pattern, to speed up a test or block
|
||||
unwanted third-party calls, and the pattern is broader than intended, it can abort a
|
||||
request the test actually needed. [microsoft/playwright#21451](https://github.com/microsoft/playwright/issues/21451)
|
||||
is exactly this shape: a route handler aborting a specific unwanted domain pattern
|
||||
threw `net::ERR_ABORTED` on the next `page.goto()` because the abort landed on
|
||||
in-flight navigation rather than the intended third-party request.
|
||||
|
||||
**`page.close()` was called while a navigation was still in flight.** Closing the
|
||||
page tears down whatever requests it had open; if that happens mid-navigation on
|
||||
purpose or by an unrelated timeout, the abort is real and the navigation that was
|
||||
racing it never gets a result.
|
||||
|
||||
**A route handler that never resolves.** A `page.route()` interceptor that neither
|
||||
calls `route.continue()`, `route.fulfill()`, nor `route.abort()` leaves a request
|
||||
hanging, and it can be aborted during teardown rather than completing, which reads
|
||||
identically to an intentional abort but traces back to a handler bug instead.
|
||||
|
||||
## Telling the two apart
|
||||
|
||||
Read what triggered the abort, not just the string. A download-triggering URL,
|
||||
a redirect chain, or a second `goto()` you called yourself all explain the abort on
|
||||
their own and need no fix. A route handler you wrote, a `page.close()` call your own
|
||||
code or test framework issued, or a hanging interceptor are bugs in the automation
|
||||
code, and the fix is in that code, not in retrying the navigation or raising a
|
||||
timeout.
|
||||
|
||||
```bash
|
||||
DEBUG=pw:api python your_script.py 2> pw.log
|
||||
```
|
||||
|
||||
Reading which call issued immediately before the abort, a second `goto()`, a
|
||||
`route.abort()`, a `page.close()`, separates the benign cases from the real ones
|
||||
faster than guessing from the exception alone.
|
||||
|
||||
## The honest boundary
|
||||
|
||||
`net::ERR_ABORTED` is not a fingerprint or network-identity failure, and no amount
|
||||
of browser realness changes whether it fires. It is a navigation-lifecycle signal
|
||||
that fires identically on a stock Playwright Chromium, a stock Firefox, and this
|
||||
project's patched build, because the cancellation is decided by request-handling
|
||||
logic in the engine, on your own code's instruction, not by anything about how real
|
||||
the browser's identity looks to a remote site.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What does net::ERR_ABORTED mean?** A request or navigation was cancelled before
|
||||
completing, most often on purpose, by a download, a redirect, a second navigation, or
|
||||
a `route.abort()` call, rather than by a network or server failure.
|
||||
|
||||
**Is net::ERR_ABORTED always a bug?** No, and most of the time it is not. A download
|
||||
replacing a page load, a redirect chain, and overlapping navigations you triggered
|
||||
yourself are all expected causes with no fix required.
|
||||
|
||||
**How do I stop it from firing on a download?** Do not wait on `page.goto()` to
|
||||
resolve a URL that becomes a download. Wrap the triggering action in
|
||||
`page.expect_download()` instead.
|
||||
|
||||
**My own route.abort() call seems to be the cause. How do I fix that?** Narrow the
|
||||
URL pattern your handler matches so it only intercepts the requests you actually
|
||||
intend to block, not in-flight navigation traffic that happens to match too broadly.
|
||||
|
||||
**Does invisible_playwright cause or fix this error?** Neither. It is a
|
||||
navigation-lifecycle event decided by request handling and your own automation
|
||||
code, entirely independent of the browser's fingerprint or identity layer.
|
||||
|
||||
## Sources
|
||||
|
||||
- Chromium's [`net/base/net_error_list.h`](https://chromium.googlesource.com/chromium/src/+/main/net/base/net_error_list.h),
|
||||
for `ERR_ABORTED` (-3), retrieved 2026-08-30.
|
||||
- [microsoft/playwright-java#541](https://github.com/microsoft/playwright-java/issues/541),
|
||||
`net::ERR_ABORTED` logged when navigating to a URL that only returns a downloadable
|
||||
payload, reproduced across all three engines.
|
||||
- [microsoft/playwright#21451](https://github.com/microsoft/playwright/issues/21451),
|
||||
a `page.route()` handler's `route.abort()` call surfacing as `net::ERR_ABORTED` on
|
||||
a subsequent navigation.
|
||||
- [microsoft/playwright-python#2131](https://github.com/microsoft/playwright-python/issues/2131),
|
||||
an intermittent `net::ERR_ABORTED` report during ordinary navigation.
|
||||
- [microsoft/playwright#13071](https://github.com/microsoft/playwright/issues/13071)
|
||||
and [#34889](https://github.com/microsoft/playwright/issues/34889), the
|
||||
"maybe frame was detached?" variant tied to SPA frame replacement during
|
||||
navigation.
|
||||
- Playwright's own [`Route` API reference](https://playwright.dev/python/docs/api/class-route),
|
||||
for the `route.abort()` method and its optional error-code argument.
|
||||
|
||||
**See also:** [Playwright TargetClosedError: the causes and the fixes](playwright-targetclosederror-causes.md)
|
||||
for another error whose real cause lives in the lines logged before it rather than
|
||||
in the exception itself, [ERR_CONNECTION_RESET in Playwright](err-connection-reset-playwright.md)
|
||||
for a genuinely network-level failure to contrast against, and
|
||||
[ERR_HTTP2_PROTOCOL_ERROR in Playwright](err-http2-protocol-error-playwright.md) for
|
||||
a case where a server deliberately resetting a stream is easy to mistake for an
|
||||
accident.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. `net::ERR_ABORTED`
|
||||
tracks a navigation-lifecycle decision, most often your own code's, and has nothing
|
||||
to do with how the browser's identity reads to a remote site.*
|
||||
@@ -0,0 +1,168 @@
|
||||
---
|
||||
title: "net::ERR_CERT_AUTHORITY_INVALID in Playwright"
|
||||
description: "net::ERR_CERT_AUTHORITY_INVALID means the certificate chain does not trace to a root the browser trusts, often a proxy intercepting TLS. What ignoreHTTPSErrors actually disables, and the tradeoff of using it."
|
||||
parent: "Network, Proxy and WebRTC"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 35
|
||||
---
|
||||
|
||||
|
||||
# net::ERR_CERT_AUTHORITY_INVALID in Playwright
|
||||
|
||||
`net::ERR_CERT_AUTHORITY_INVALID` means the certificate presented during the TLS
|
||||
handshake does not chain up to a certificate authority the browser trusts.
|
||||
Chromium's own network error list defines it exactly: "the server responded with a
|
||||
certificate that is signed by an authority we don't trust." Playwright drives real
|
||||
browser engines, and those engines enforce this the same way they do for any human
|
||||
using them, because certificate-chain validation is the mechanism that makes TLS mean
|
||||
anything against a man-in-the-middle.
|
||||
|
||||
This is not the same failure as the adjacent
|
||||
`ERR_CERT_COMMON_NAME_INVALID`, which fires when the chain is trusted but the
|
||||
certificate's own name does not match the hostname you asked for. Authority-invalid
|
||||
means the *issuer* is not trusted; common-name-invalid means the *subject* is wrong.
|
||||
Read the exact code before assuming which problem you have.
|
||||
|
||||
## The causes
|
||||
|
||||
**A self-signed certificate on the target.** Common in local development and
|
||||
staging environments: nothing signed it that any browser trusts by default, because
|
||||
nothing was meant to.
|
||||
|
||||
**A proxy intercepting and re-signing TLS.** A proxy that terminates the original TLS
|
||||
connection and re-establishes its own toward the destination has to present *some*
|
||||
certificate to your browser for that connection, and unless its own root CA is
|
||||
installed in the browser's trust store, that certificate is signed by an authority
|
||||
nothing trusts. This is functionally identical, from the browser's point of view, to
|
||||
a hostile machine-in-the-middle attack, because it is the same mechanism: someone
|
||||
between you and the destination is terminating TLS you did not expect them to
|
||||
terminate.
|
||||
|
||||
**An expired or misconfigured intermediate certificate.** A chain that used to
|
||||
validate can stop validating the moment an intermediate CA cert expires or gets
|
||||
revoked, with nothing about the leaf certificate itself having changed.
|
||||
|
||||
**Corporate or antivirus SSL inspection.** The same mechanism as the proxy case
|
||||
above, run locally: security software that intercepts outbound HTTPS to scan it
|
||||
presents its own re-signed certificate, and a browser Playwright drives on that
|
||||
machine sees exactly the same untrusted-authority failure a hostile interception
|
||||
would produce.
|
||||
|
||||
## What `ignoreHTTPSErrors` actually disables, and the tradeoff
|
||||
|
||||
Playwright's `ignoreHTTPSErrors` context or launch option is a real, documented
|
||||
lever, and it does exactly what it says: it disables certificate-chain and hostname
|
||||
validation for that browser context entirely. It is not a feature that trusts one
|
||||
specific proxy's certificate and rejects everything else; it removes the check
|
||||
altogether, for every connection that context makes for the rest of its life.
|
||||
|
||||
That is the tradeoff worth being explicit about, because "just add
|
||||
`ignoreHTTPSErrors: True`" is the answer everywhere and it is rarely presented with
|
||||
its actual cost. The entire reason certificate validation exists is to make TLS mean
|
||||
"you are actually talking to who you think you are talking to." Turning it off to
|
||||
accept your own proxy's interception certificate accepts every other invalid
|
||||
certificate with it, including one from an attacker on a network you did not expect
|
||||
to be adversarial. A context configured this way cannot tell the difference between
|
||||
your trusted proxy's re-signed certificate and a hostile one sitting on public
|
||||
Wi-Fi, because the check that would have told them apart is the check you disabled.
|
||||
|
||||
The narrower, safer alternative when the actual goal is trusting one specific proxy
|
||||
is installing that proxy's own root CA certificate into the browser's trust store,
|
||||
so only that one issuer becomes trusted, not every issuer becoming
|
||||
irrelevant. Where that is not practical, the operationally honest habit is scoping
|
||||
`ignoreHTTPSErrors` to sessions that are genuinely, deliberately behind a proxy you
|
||||
control, never to a context whose traffic might also touch a network you do not
|
||||
control, and treating a *new* certificate error appearing mid-session, on a proxy
|
||||
that was previously validating fine, as a signal worth investigating rather than
|
||||
suppressing further, since that is exactly the shape a captive portal or an
|
||||
unexpected interception point produces.
|
||||
|
||||
## Diagnostic checklist
|
||||
|
||||
1. **Reproduce with `curl` against the same target and proxy.** `curl -v
|
||||
-x <proxy> <url>` prints the actual certificate chain rather than collapsing it
|
||||
into one exception. Read the `issuer` line specifically.
|
||||
2. **Compare the issuer to what you expect.** If the certificate's issuer is your own
|
||||
proxy provider's name rather than a public CA, this confirms the proxy is
|
||||
terminating and re-signing TLS, the expected-but-unvalidated case, not a hostile
|
||||
interception.
|
||||
3. **Test the same target with the proxy removed.** Validates cleanly without the
|
||||
proxy: the proxy is the one re-signing TLS, confirmed. Still fails: the
|
||||
destination's own certificate is broken, unrelated to the proxy at all.
|
||||
4. **Check with `openssl s_client -connect host:443 -showcerts`** for the full chain
|
||||
and its dates, to rule out an expired intermediate specifically rather than an
|
||||
untrusted one.
|
||||
5. **If the error appears suddenly on a proxy that was previously clean, stop and
|
||||
investigate before reaching for `ignoreHTTPSErrors`.** A working proxy's
|
||||
certificate does not change identity on its own; a new, different issuer showing
|
||||
up mid-project is the concrete signal the tradeoff above describes, not routine
|
||||
noise to suppress.
|
||||
|
||||
## The honest boundary
|
||||
|
||||
Certificate validation is a TLS-layer check, enforced by the browser engine the same
|
||||
way for a real person and for Playwright driving it. `invisible_playwright` does not
|
||||
alter certificate handling and does not make an untrusted chain trusted; the
|
||||
`ignoreHTTPSErrors` lever is stock Playwright behavior, available identically on a
|
||||
stock browser, and this project's engine-level realness has no bearing on whether a
|
||||
given certificate validates. Realness answers what a page can observe about the
|
||||
browser; it says nothing about who is actually on the other end of the TLS
|
||||
handshake, which is precisely the question certificate validation exists to answer.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What does net::ERR_CERT_AUTHORITY_INVALID mean?** The certificate presented during
|
||||
the TLS handshake does not chain up to a certificate authority the browser trusts,
|
||||
most often because it is self-signed or was re-signed by an intercepting proxy.
|
||||
|
||||
**Is this the same as ERR_CERT_COMMON_NAME_INVALID?** No. That error means the chain
|
||||
is trusted but the certificate's name does not match the hostname requested. This
|
||||
error means the issuer itself is not trusted, regardless of the name on the
|
||||
certificate.
|
||||
|
||||
**What does ignoreHTTPSErrors actually turn off?** All certificate-chain and
|
||||
hostname validation for that browser context, for every connection it makes, not
|
||||
just the one proxy or certificate you intended to allow.
|
||||
|
||||
**Is there a safer fix than ignoreHTTPSErrors?** Installing the specific proxy's own
|
||||
root CA certificate into the trust store validates only that one issuer, leaving
|
||||
every other certificate's validation intact, unlike disabling the check outright.
|
||||
|
||||
**How do I know if a proxy is intercepting TLS versus the destination just having a
|
||||
broken certificate?** Read the certificate's issuer with `curl -v` or `openssl
|
||||
s_client`. An issuer matching your proxy provider confirms interception; test the
|
||||
same target with the proxy removed to isolate it further.
|
||||
|
||||
**Does invisible_playwright fix or cause certificate validation errors?** Neither.
|
||||
Certificate validation is standard TLS behavior the engine enforces the same way for
|
||||
any browser; this project's stealth patching does not touch it, and `ignoreHTTPSErrors`
|
||||
is stock Playwright, not something this project adds or modifies.
|
||||
|
||||
## Sources
|
||||
|
||||
- Chromium's [`net/base/net_error_list.h`](https://chromium.googlesource.com/chromium/src/+/main/net/base/net_error_list.h),
|
||||
for `ERR_CERT_AUTHORITY_INVALID` (-202) and the adjacent, distinct
|
||||
`ERR_CERT_COMMON_NAME_INVALID` (-200), retrieved 2026-08-30.
|
||||
- [microsoft/playwright-python#346](https://github.com/microsoft/playwright-python/issues/346),
|
||||
a real, verbatim report of `net::ERR_CERT_AUTHORITY_INVALID` against a bare IP
|
||||
address destination.
|
||||
- [microsoft/playwright#2814](https://github.com/microsoft/playwright/issues/2814),
|
||||
a user question on bypassing this exact error, illustrating how often
|
||||
`ignoreHTTPSErrors` is reached for without the tradeoff being discussed.
|
||||
- Playwright's own [API reference](https://playwright.dev/python/docs/api/class-browser#browser-new-context),
|
||||
for the `ignoreHTTPSErrors` context option and its documented scope.
|
||||
|
||||
**See also:** [ERR_TUNNEL_CONNECTION_FAILED in Playwright](err-tunnel-connection-failed-playwright.md)
|
||||
for a different proxy failure mode that happens before TLS is ever negotiated, [JA3
|
||||
and JA4: why a TLS fingerprint cannot be patched](ja3-ja4-tls-fingerprint.md) for the
|
||||
handshake layer just beneath certificate validation, and [does a proxy leak
|
||||
DNS? DoH and DNS leaks explained](does-a-proxy-leak-dns-doh-explained.md) for another
|
||||
case where a proxy's behavior is easy to mistake for the browser's own.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. Certificate validation is stock TLS behavior,
|
||||
untouched by this project's patching; `ignoreHTTPSErrors` removes that check
|
||||
entirely rather than trusting one specific proxy, and that tradeoff is worth reading
|
||||
before reaching for it.*
|
||||
@@ -0,0 +1,178 @@
|
||||
---
|
||||
title: "net::ERR_CONNECTION_REFUSED in Playwright"
|
||||
description: "net::ERR_CONNECTION_REFUSED means something actively rejected the connection attempt, not that nobody answered. The Docker and CI variant, where localhost inside a container is not the host machine, is the most common real cause."
|
||||
parent: "Network, Proxy and WebRTC"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 37
|
||||
---
|
||||
|
||||
|
||||
# net::ERR_CONNECTION_REFUSED in Playwright
|
||||
|
||||
`net::ERR_CONNECTION_REFUSED` means the machine at the other end of the address and port
|
||||
actively refused the connection: it answered with a TCP reset instead of staying silent.
|
||||
Chromium's own network error list defines it in five words, "A connection attempt was
|
||||
refused," code -102. `page.goto()` throws it fast, usually in well under a second, because
|
||||
a refusal is an immediate reply, not a wait for something that never comes.
|
||||
|
||||
That speed is itself informative. A connection that times out is one where nothing
|
||||
answers at all, covered separately on [`ERR_CONNECTION_TIMED_OUT`](err-connection-timed-out-playwright.md).
|
||||
A connection that is refused got an answer, and the answer was no. Something is running
|
||||
at that address that can send a TCP RST, which usually means either nothing is listening
|
||||
on that exact port, or something is actively and deliberately rejecting the attempt.
|
||||
|
||||
## The realistic causes
|
||||
|
||||
**Nothing is listening on that port.** The most literal reading: a dev server not yet
|
||||
started, a service that crashed, or a port number that is simply wrong. Confirm the
|
||||
process is actually running and bound to the port you are navigating to.
|
||||
|
||||
**A firewall or security group actively rejecting, not silently dropping.** Some
|
||||
firewall configurations answer a blocked port with a reset (refused) and others simply
|
||||
drop the packet (timeout). Which one you get depends on the device, not on Playwright.
|
||||
|
||||
**A local dev server that had not finished starting yet.** [A real report](https://github.com/microsoft/playwright/issues/35879)
|
||||
shows this exact error firing in headless mode specifically, immediately, against a
|
||||
server still starting up: headful mode's slightly longer startup window happened to give
|
||||
it enough time, headless did not.
|
||||
|
||||
**A CI runner whose network path or firewall differs from a developer's own machine.**
|
||||
[A GitHub Actions report](https://github.com/microsoft/playwright/issues/21414) and
|
||||
[a CircleCI report](https://github.com/microsoft/playwright/issues/20343) both show
|
||||
`ERR_CONNECTION_REFUSED` against `localhost` reproducing reliably in CI and not locally,
|
||||
which is the signature of an environment-specific networking difference instead of a
|
||||
code regression.
|
||||
|
||||
## The Docker and CI networking variant, in detail
|
||||
|
||||
This is the shape worth understanding on purpose, because "it works on my machine and
|
||||
fails in the container" is the single most common real cause behind this error, and the
|
||||
reason is not intuitive if you have not hit it before.
|
||||
|
||||
Docker containers run in their own network namespace, a Linux kernel feature that gives a
|
||||
process its own IP addresses, its own loopback interface, and its own view of "localhost"
|
||||
entirely separate from the host machine's. As it is put directly: "when a server listens
|
||||
on 127.0.0.1 inside the container network namespace" and something outside that
|
||||
namespace, including the host, tries to reach `127.0.0.1`, "these are different
|
||||
interfaces, so no connection is made." `localhost` inside a container refers to that
|
||||
container, never to the host, and never to a sibling container, no matter how natural it
|
||||
feels to type it out of habit.
|
||||
|
||||
This produces `ERR_CONNECTION_REFUSED` in a specific, recognizable shape: Playwright runs
|
||||
inside a container and navigates to `http://localhost:3000`, expecting to reach a server
|
||||
on the host machine or in a different container. It reaches its own container's loopback
|
||||
instead, where nothing is listening, and gets refused. The same code works perfectly on a
|
||||
developer's own machine, because there `localhost` genuinely is the machine running both
|
||||
the browser and the server, no namespace boundary in between, which is exactly why the
|
||||
bug reads as "nothing changed" when the entire network topology did. Port publishing
|
||||
(`-p 3000:3000`) does not fix this either if the server itself is bound to `127.0.0.1`,
|
||||
not `0.0.0.0`: "the server is listening on 127.0.0.1 inside the container network
|
||||
namespace" while the forwarded traffic arrives on the external interface, an address the
|
||||
server was never told to listen on. [A real report](https://github.com/microsoft/playwright/issues/24582)
|
||||
shows exactly this shape: the port listed as exposed in a Compose file, and the connection
|
||||
still refused.
|
||||
|
||||
The fixes follow directly from the cause: bind the target service to `0.0.0.0` so it
|
||||
accepts connections on every interface, use Docker's own DNS name `host.docker.internal`
|
||||
to reach the host from inside a container, and, for container-to-container traffic under
|
||||
Compose, address the other service by its **service name** on the shared network rather
|
||||
than by `localhost`. On Linux hosts, `host.docker.internal` is not wired up by default the
|
||||
way it is on Docker Desktop, and needs `--add-host=host.docker.internal:host-gateway` or
|
||||
the equivalent Compose `extra_hosts` entry.
|
||||
|
||||
## Diagnostic checklist
|
||||
|
||||
1. **Confirm the target process is running and bound to that port**, from inside the
|
||||
same environment that will run the browser, not from your own machine. `curl
|
||||
http://target:port` inside the container or runner is the fastest check.
|
||||
2. **If this is Docker, ask what `localhost` resolves to from where you are asking.**
|
||||
Playwright's process, the target service, and your own terminal can each be in a
|
||||
different network namespace, each with its own idea of `localhost`.
|
||||
3. **Check what interface the target service binds to**, and address other Compose
|
||||
services by their service name, not `localhost`, which does not cross
|
||||
container boundaries at all.
|
||||
4. **In CI specifically, test from inside the runner**, since a firewall or security
|
||||
group there can behave differently from your own machine even when the code and the
|
||||
port are both correct.
|
||||
5. **If a local dev server is involved, rule out a startup race** before assuming
|
||||
anything about networking: a navigation that fires before the server has finished
|
||||
binding produces this exact error in headless mode.
|
||||
|
||||
## What Firefox calls the same failure
|
||||
|
||||
`invisible_playwright` drives a patched Firefox rather than Chromium, and Firefox's own
|
||||
networking layer does not use `net::ERR_*` naming. The identical event, a connection
|
||||
actively refused, is `NS_ERROR_CONNECTION_REFUSED` in Firefox's own error list, defined
|
||||
as: "The connection attempt failed, for example, because no server was listening at
|
||||
specified host:port." The causes above apply unchanged; only the string in the log
|
||||
differs.
|
||||
|
||||
## The honest boundary
|
||||
|
||||
A refused connection is answered below any layer a browser's identity touches: the
|
||||
operating system's TCP stack sent the reset, whether because nothing is listening or
|
||||
because a firewall chose to reject rather than drop. `invisible_playwright` passes the
|
||||
navigation straight to the patched engine and does not retry a refused port or paper over
|
||||
a network namespace it did not create. A stock Playwright Chromium, a stock Firefox, and
|
||||
this project's build all see the identical refusal from the identical port, because the
|
||||
fingerprint layer this project touches sits far above where a TCP RST gets generated.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What does net::ERR_CONNECTION_REFUSED mean?** Something at that address and port
|
||||
actively rejected the connection attempt with a TCP reset, rather than staying silent.
|
||||
Usually nothing is listening on that exact port, or a firewall chose to reject rather than
|
||||
drop the attempt.
|
||||
|
||||
**Why does this happen constantly in Docker but never on my own machine?** Docker
|
||||
containers each have their own network namespace, so `localhost` inside a container never
|
||||
refers to the host machine or to a sibling container. This is the single most common real
|
||||
cause of this error under automation.
|
||||
|
||||
**What is the fix for the Docker case?** Bind the target service to `0.0.0.0` instead of
|
||||
`127.0.0.1`, use `host.docker.internal` to reach the host from inside a container, and
|
||||
address other Compose services by their service name rather than `localhost`.
|
||||
|
||||
**Is this the same as ERR_CONNECTION_TIMED_OUT?** No. A refusal is an immediate answer
|
||||
that says no. A timeout is silence, with nothing answering at all within the wait period.
|
||||
|
||||
**Can invisible_playwright's stealth patching cause or fix this?** No. The refusal is
|
||||
generated at the TCP layer by whatever is, or is not, listening on the target port,
|
||||
entirely below any fingerprint or identity surface this project touches.
|
||||
|
||||
## Sources
|
||||
|
||||
- Chromium's [`net/base/net_error_list.h`](https://chromium.googlesource.com/chromium/src/+/main/net/base/net_error_list.h),
|
||||
for `ERR_CONNECTION_REFUSED` (-102), retrieved 2026-08-30.
|
||||
- Mozilla's [`xpcom/base/ErrorList.py`](https://searchfox.org/mozilla-central/source/xpcom/base/ErrorList.py)
|
||||
(viewed via the Fossies mirror), for `NS_ERROR_CONNECTION_REFUSED` (13) and its exact
|
||||
definition, retrieved 2026-08-30.
|
||||
- [microsoft/playwright#35879](https://github.com/microsoft/playwright/issues/35879),
|
||||
`ERR_CONNECTION_REFUSED` in headless mode specifically against a dev server that had
|
||||
not finished starting.
|
||||
- [microsoft/playwright#21414](https://github.com/microsoft/playwright/issues/21414) and
|
||||
[microsoft/playwright#20343](https://github.com/microsoft/playwright/issues/20343),
|
||||
reports of this error reproducing reliably in GitHub Actions and CircleCI against
|
||||
`localhost` and not locally.
|
||||
- [microsoft/playwright#24582](https://github.com/microsoft/playwright/issues/24582), a
|
||||
report of the error persisting against a Docker Compose service despite the port being
|
||||
listed as exposed.
|
||||
- pythonspeed.com, ["Connection refused? Docker networking and how it impacts your
|
||||
image"](https://pythonspeed.com/articles/docker-connection-refused/), for the network
|
||||
namespace explanation of why `localhost` inside a container is not the host, retrieved
|
||||
2026-08-30.
|
||||
- Docker's own documentation, [Networking on Docker Desktop](https://docs.docker.com/desktop/features/networking/),
|
||||
for `host.docker.internal` and its platform-specific availability, retrieved 2026-08-30.
|
||||
|
||||
**See also:** [ERR_PROXY_CONNECTION_FAILED in Playwright](err-proxy-connection-failed-playwright.md)
|
||||
for the equivalent failure when it is a configured proxy, not the destination, that is
|
||||
unreachable, [ERR_CONNECTION_TIMED_OUT in Playwright](err-connection-timed-out-playwright.md)
|
||||
for the silent variant with no reset at all, and [Playwright in Docker: what actually
|
||||
changes detection-wise](playwright-docker-detection.md) for the rest of what differs
|
||||
about running this project inside a container.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. A refused connection is the operating system's TCP
|
||||
stack answering; the browser's identity layer never gets a say in it.*
|
||||
@@ -0,0 +1,153 @@
|
||||
---
|
||||
title: "net::ERR_CONNECTION_RESET in Playwright"
|
||||
description: "net::ERR_CONNECTION_RESET means a TCP RST tore the connection down mid-request. Proxy-side causes versus server-side causes, told apart with the proxy removed, plus the Firefox name for the same failure."
|
||||
parent: "Network, Proxy and WebRTC"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 31
|
||||
---
|
||||
|
||||
|
||||
# net::ERR_CONNECTION_RESET in Playwright
|
||||
|
||||
`net::ERR_CONNECTION_RESET` means the TCP connection was torn down with a reset
|
||||
packet, an RST, rather than a clean close. Something on the path decided the
|
||||
connection should stop existing right now, instead of finishing whatever request or
|
||||
response was in flight. Chromium's own network error list defines it plainly: "a
|
||||
connection was reset (corresponding to a TCP RST)." `page.goto()` throws it when the
|
||||
reset lands during navigation; it can also fire mid-session on a page that had
|
||||
already loaded.
|
||||
|
||||
The string tells you a reset happened. It does not tell you which end sent it, which
|
||||
is the actual question worth answering before touching any code.
|
||||
|
||||
## Proxy-side causes
|
||||
|
||||
**The proxy killed the connection on its own terms.** A connection-time limit, a
|
||||
per-request timeout tighter than the origin server's response time, or a plan-level
|
||||
cap on concurrent or total connections can all end with the proxy sending the RST
|
||||
itself rather than passing through whatever the origin was doing. This looks
|
||||
identical, from the browser's side, to the origin resetting the connection.
|
||||
|
||||
**The proxy process itself restarted or was killed mid-request.** Every connection it
|
||||
was holding open ends with a reset at that instant, which reads as a sudden, brief
|
||||
burst of this error across whatever was in flight at the time, then nothing.
|
||||
|
||||
**A middlebox on the proxy's own path reset it.** A proxy is itself a client to the
|
||||
origin, and its own connection can be reset by something between the proxy and the
|
||||
destination, independent of anything wrong with your request.
|
||||
|
||||
## Server-side and network-path causes
|
||||
|
||||
**The origin server reset the connection deliberately.** A server-side rate limit,
|
||||
a WAF rule, or an anti-automation response can close a connection with an RST
|
||||
instead of returning a normal HTTP response, in which case the reset itself is the
|
||||
site's answer, not an accident.
|
||||
|
||||
**A firewall or IPS on the path injected the reset.** This is a documented behavior of
|
||||
network security appliances: sending a spoofed RST to both ends kills a connection
|
||||
without either endpoint needing to cooperate, and it can happen anywhere between the
|
||||
browser and the origin, proxy included.
|
||||
|
||||
**Antivirus or endpoint security software on the machine running Playwright.**
|
||||
Reported directly in Playwright's own issue tracker: connection resets that trace
|
||||
back to local security software inspecting or interfering with outbound TLS
|
||||
connections, not to anything remote.
|
||||
|
||||
## What Firefox calls the same failure
|
||||
|
||||
`net::ERR_CONNECTION_RESET` is Chromium's net-stack naming. `invisible_playwright`
|
||||
drives a patched Firefox with its own, untouched networking stack, and Firefox
|
||||
reports the identical failure, a connection torn down by a TCP RST, as
|
||||
`NS_ERROR_NET_RESET`. This is the same Firefox name already covered on [the
|
||||
ERR_HTTP2_PROTOCOL_ERROR page](err-http2-protocol-error-playwright.md#what-the-string-is-and-which-browser-actually-says-it)
|
||||
for the HTTP/2-specific variant of the same underlying event; searching this exact
|
||||
Chromium string while driving Firefox is the wrong search, look for
|
||||
`NS_ERROR_NET_RESET` in your logs instead.
|
||||
|
||||
## Diagnostic checklist
|
||||
|
||||
1. **Remove the proxy and retry against the same target directly.** Gone without a
|
||||
proxy, the proxy or the path to it is implicated. Still resets, the origin or a
|
||||
network device between you and it is the more likely cause.
|
||||
2. **Reproduce with `curl` outside Playwright entirely.** `curl -v -x <proxy>
|
||||
<url>` isolates whether the browser is even a variable. A real Playwright report
|
||||
traced tests passing locally and failing consistently in a CI runner
|
||||
([microsoft/playwright#16749](https://github.com/microsoft/playwright/issues/16749)),
|
||||
which is exactly the shape a path-dependent reset produces and `curl` from inside
|
||||
that same environment would have shown directly.
|
||||
3. **Check whether it is consistent or intermittent.** A reset on every single
|
||||
attempt against one target points at something structural, a firewall rule, a
|
||||
deliberate server-side block. An intermittent reset under load points more at a
|
||||
proxy connection cap or limit being hit.
|
||||
4. **Check local security software before assuming the network is at fault.**
|
||||
[microsoft/playwright-python#815](https://github.com/microsoft/playwright-python/issues/815)
|
||||
and related reports describe this exact string on headless Linux/CI machines with
|
||||
no proxy involved at all, worth ruling out before chasing a network explanation
|
||||
for a local one.
|
||||
5. **Ask your proxy provider directly about connection or rate limits**, since a
|
||||
limit enforced by closing the connection produces this exact string with nothing
|
||||
in your own logs distinguishing it from a hostile reset.
|
||||
|
||||
## The honest boundary
|
||||
|
||||
A TCP RST happens below the TLS handshake and well below anything a browser's
|
||||
JavaScript-visible identity touches. `invisible_playwright` passes the proxy option
|
||||
straight to the patched engine and does not retry, absorb, or paper over a reset;
|
||||
a stock Playwright browser, a stock Firefox, and this project's build all see the
|
||||
identical reset from the identical proxy or server, because the reset is generated
|
||||
on the wire, not answered by anything the browser claims to be.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What does net::ERR_CONNECTION_RESET mean?** The TCP connection was torn down by a
|
||||
reset packet mid-request, rather than closed cleanly. The string does not say which
|
||||
side sent the reset.
|
||||
|
||||
**Is this always the proxy's fault?** No. It can come from the proxy itself, a
|
||||
deliberate reset from the origin server, a firewall or security appliance on the
|
||||
path, or local antivirus/security software with no remote cause at all.
|
||||
|
||||
**How do I tell a proxy-side reset from a server-side one?** Remove the proxy and
|
||||
retry directly. If the reset disappears, the proxy or the path to it caused it; if it
|
||||
persists, look at the origin or a device between you and it.
|
||||
|
||||
**Why does it only happen in CI, not locally?** A different network path, a
|
||||
different egress IP subject to a different rule, or a runner-specific firewall or
|
||||
proxy configuration are the usual explanations; reproduce with `curl` from inside the
|
||||
CI environment itself rather than guessing from your own machine.
|
||||
|
||||
**What does Firefox call this instead of ERR_CONNECTION_RESET?** `NS_ERROR_NET_RESET`.
|
||||
Same underlying TCP-level event, Chromium and Firefox just name it differently.
|
||||
|
||||
**Can invisible_playwright's stealth patching cause or fix this?** Neither. The
|
||||
reset happens at the TCP layer, entirely below any fingerprint or JavaScript-visible
|
||||
identity surface this project touches.
|
||||
|
||||
## Sources
|
||||
|
||||
- Chromium's [`net/base/net_error_list.h`](https://chromium.googlesource.com/chromium/src/+/main/net/base/net_error_list.h),
|
||||
for `ERR_CONNECTION_RESET` (-101), retrieved 2026-08-30.
|
||||
- [microsoft/playwright-python#815](https://github.com/microsoft/playwright-python/issues/815),
|
||||
a real report of this exact string on headless Ubuntu Chromium with no proxy
|
||||
involved.
|
||||
- [microsoft/playwright#16749](https://github.com/microsoft/playwright/issues/16749),
|
||||
tests passing locally and failing with `net::ERR_CONNECTION_RESET` /
|
||||
`NS_ERROR_NET_RESET` consistently inside an Azure DevOps CI runner.
|
||||
- [microsoft/playwright#8746](https://github.com/microsoft/playwright/issues/8746),
|
||||
the same string reported under headless Chromium on a CentOS runner.
|
||||
- Mozilla's [HTTP logging documentation](https://firefox-source-docs.mozilla.org/networking/http/logging.html),
|
||||
for capturing the `NS_ERROR_NET_RESET` name on the Firefox side.
|
||||
|
||||
**See also:** [ERR_HTTP2_PROTOCOL_ERROR in Playwright](err-http2-protocol-error-playwright.md)
|
||||
for the HTTP/2-specific framing variant of a connection dying mid-stream,
|
||||
[ERR_TUNNEL_CONNECTION_FAILED in Playwright](err-tunnel-connection-failed-playwright.md)
|
||||
for a proxy failure that happens before any connection to the destination exists at
|
||||
all, and [ERR_PROXY_CONNECTION_FAILED in Playwright](err-proxy-connection-failed-playwright.md)
|
||||
for the earlier failure of not reaching the proxy in the first place.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. A TCP reset is generated on the wire, by the
|
||||
proxy, the origin, or something between them; the browser's identity layer has no
|
||||
part in it either way.*
|
||||
@@ -0,0 +1,183 @@
|
||||
---
|
||||
title: "net::ERR_CONNECTION_TIMED_OUT in Playwright"
|
||||
description: "net::ERR_CONNECTION_TIMED_OUT is the browser's own network stack giving up on a connection attempt, a separate mechanism from Playwright's configurable TimeoutError and not fixed by raising it."
|
||||
parent: "Testing and Troubleshooting"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 15
|
||||
---
|
||||
|
||||
|
||||
# net::ERR_CONNECTION_TIMED_OUT in Playwright
|
||||
|
||||
`net::ERR_CONNECTION_TIMED_OUT` means the browser's own network stack attempted a
|
||||
connection and gave up waiting for anything to answer. Chromium's own network error
|
||||
list defines it in five words, code -118, "A connection attempt timed out."
|
||||
`page.goto()` throws it when this happens on navigation, and the detail worth fixing in
|
||||
your head before anything else is that this timeout belongs to the browser's network
|
||||
code, not to Playwright.
|
||||
|
||||
## Not the same thing as Playwright's own TimeoutError
|
||||
|
||||
This is the confusion that sends people to the wrong fix. Playwright's `TimeoutError` is
|
||||
a driver-level concept: the client library made a call, `page.goto()`,
|
||||
`locator.click()`, whatever it is, and gave up waiting for that call to finish within
|
||||
the configured `timeout`, whether that is the default 30 seconds or a value you set
|
||||
yourself. It fires from Playwright's own side, counting from when the call was made,
|
||||
regardless of what the browser's network stack is still doing underneath it. [The page
|
||||
dedicated to that error](playwright-timeout-30000ms-exceeded.md) covers it in full.
|
||||
|
||||
`net::ERR_CONNECTION_TIMED_OUT` is a different mechanism entirely: the browser's own
|
||||
network code concluding that a specific connection attempt is never going to succeed,
|
||||
with its own internal logic, independent of anything Playwright's `timeout` option is set
|
||||
to. A real, concrete report makes this impossible to miss: [a user configured Playwright's
|
||||
navigation timeout to 180 seconds](https://github.com/microsoft/playwright/issues/5062),
|
||||
across every place that setting can be applied, and still received `page.goto:
|
||||
net::ERR_TIMED_OUT` after roughly 30 seconds. The issue was filed as a request to make
|
||||
Chromium's socket connect timeout configurable at all, because it was not: Playwright's
|
||||
`timeout` governs how long Playwright waits for the call, with no lever over how long the
|
||||
browser's own network stack waits for a TCP connection attempt before reporting failure.
|
||||
|
||||
Two different errors can appear for what looks like the same symptom, "the page never
|
||||
loaded," and they mean opposite things about where to look. `TimeoutError` means
|
||||
Playwright stopped waiting; the browser might still be trying. `net::ERR_CONNECTION_TIMED_OUT`
|
||||
means the browser itself concluded the attempt failed; Playwright is just reporting what
|
||||
it was told.
|
||||
|
||||
## The realistic causes
|
||||
|
||||
**Nothing answers the connection attempt at all.** Unlike [`ERR_CONNECTION_REFUSED`](err-connection-refused-playwright.md),
|
||||
where something actively rejects the attempt with a TCP reset, a timeout means silence:
|
||||
no reset, no acceptance, nothing. A firewall configured to drop packets rather than
|
||||
reject them produces exactly this, and so does a genuinely unreachable address with no
|
||||
route to it at all.
|
||||
|
||||
**The destination is too far away or too slow on a path with no active rejection.**
|
||||
Real user reports show this exact error appearing intermittently against sites that are
|
||||
in fact reachable moments later, from the same network. [One report](https://github.com/microsoft/playwright/issues/10851)
|
||||
and [another](https://github.com/microsoft/playwright/issues/30406) both describe this
|
||||
shape: not every attempt times out, the site loads fine in a normal browser session
|
||||
seconds apart, and the failure reads as a transient network-path issue rather than
|
||||
anything structurally broken.
|
||||
|
||||
**A proxy silently swallowing the connection instead of answering.** A misconfigured or
|
||||
overloaded proxy can accept the client's connection and then never actually establish
|
||||
one to the destination, leaving the browser waiting on a socket that will never resolve
|
||||
either way until the browser's own internal ceiling is reached.
|
||||
|
||||
**A VPN, corporate network, or restrictive egress rule that drops rather than rejects.**
|
||||
The same distinction as the firewall case above, seen specifically in environments where
|
||||
outbound traffic is filtered by policy rather than by a route simply not existing.
|
||||
|
||||
## Diagnostic checklist
|
||||
|
||||
1. **Reproduce with `curl -v --connect-timeout 30` against the same target.** `curl`
|
||||
reports connection timeouts explicitly and lets you set the ceiling yourself, isolating
|
||||
whether the delay is on the network path or specific to the browser.
|
||||
2. **Check whether the failure is consistent or intermittent.** Consistent points at a
|
||||
structural block, a dead route, or a firewall dropping packets; intermittent, on a
|
||||
target reachable moments later, points more at a transient path issue or load.
|
||||
3. **Test with any proxy removed.** Clears without it, the proxy is implicated,
|
||||
specifically as something accepting the connection and never completing its own leg
|
||||
to the destination.
|
||||
4. **Do not raise Playwright's timeout as the first move.** The real report cited above
|
||||
shows this directly: raising `timeout` to 180 seconds changed nothing about when
|
||||
`net::ERR_CONNECTION_TIMED_OUT` fired, because that ceiling belongs to the browser's
|
||||
own network stack, not to Playwright's driver-level wait.
|
||||
|
||||
## What Firefox calls the same failure
|
||||
|
||||
`invisible_playwright` drives a patched Firefox, and Firefox's networking layer does not
|
||||
use `net::ERR_*` naming. The identical event, a connection attempt abandoned after
|
||||
waiting with no response, is `NS_ERROR_NET_TIMEOUT` in Firefox's own error list, defined
|
||||
as: "The connection was lost due to a timeout error." [A real Playwright report against
|
||||
Firefox specifically](https://github.com/microsoft/playwright/issues/13027) shows this
|
||||
exact string firing intermittently in a CI environment, on a test suite that passed
|
||||
reliably on a developer's own machine, the same environment-dependent shape the
|
||||
Chromium-side reports above show. The causes are identical; only the name in the log
|
||||
differs.
|
||||
|
||||
It is worth naming the ceiling this timeout races against, because it explains why the
|
||||
browser-level error is rarer to see in practice than Playwright's own `TimeoutError`. The
|
||||
operating system's own TCP connection-attempt ceiling is typically far longer than either
|
||||
browser's internal one: on Linux, the kernel's default SYN retry behavior takes roughly
|
||||
127 seconds before giving up entirely, [documented in the kernel's own `tcp(7)` manual
|
||||
page](https://man7.org/linux/man-pages/man7/tcp.7.html). Since Playwright's default
|
||||
`timeout` is 30 seconds, far shorter than that ceiling, most navigations that would
|
||||
eventually produce this error are cut off by Playwright's own `TimeoutError` first,
|
||||
unless that default has been raised, or the browser's own internal connect timeout, not
|
||||
configurable through Playwright, fires first.
|
||||
|
||||
## The honest boundary
|
||||
|
||||
A connection attempt that never receives a response is a network-path failure, resolved
|
||||
entirely below any browser-identity layer this project touches. `invisible_playwright`
|
||||
passes the navigation straight to the patched engine's own network stack and does not
|
||||
retry a stalled connection, shorten or extend the browser's internal connect timeout, or
|
||||
make an unreachable path reachable. A stock Playwright browser, a stock Firefox, and
|
||||
this project's build all wait out an identical silent connection attempt identically,
|
||||
because nothing about a cleaner fingerprint changes how long a TCP handshake is willing
|
||||
to wait for a SYN-ACK that never arrives.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What does net::ERR_CONNECTION_TIMED_OUT mean?** The browser's own network stack
|
||||
attempted a connection and gave up after receiving no response at all, neither an
|
||||
acceptance nor a rejection.
|
||||
|
||||
**Is this the same as Playwright's TimeoutError?** No. Playwright's `TimeoutError` is
|
||||
the driver giving up on waiting for a call to return, governed by the `timeout` option
|
||||
you configure. `net::ERR_CONNECTION_TIMED_OUT` is the browser's own network code
|
||||
concluding a connection attempt failed, on its own internal ceiling, independent of
|
||||
Playwright's setting.
|
||||
|
||||
**Will raising Playwright's timeout fix it?** No, and a real report confirms this
|
||||
directly: raising the navigation timeout to 180 seconds did not change when
|
||||
`net::ERR_TIMED_OUT` fired, because that ceiling is not the one Playwright's `timeout`
|
||||
option controls.
|
||||
|
||||
**How is this different from ERR_CONNECTION_REFUSED?** A refusal is an active answer:
|
||||
something rejected the attempt with a TCP reset, fast. A timeout is silence: nothing
|
||||
answered at all within the browser's own waiting period.
|
||||
|
||||
**Why does it happen intermittently against a site that is otherwise reachable?** Real
|
||||
reports show exactly this shape, a target that loads fine seconds later from the same
|
||||
network. Treat it as a transient network-path or load issue and check consistency before
|
||||
assuming a structural block.
|
||||
|
||||
**What does Firefox call this instead of ERR_CONNECTION_TIMED_OUT?** `NS_ERROR_NET_TIMEOUT`,
|
||||
defined as a connection lost to a timeout error, with the identical set of causes behind
|
||||
it.
|
||||
|
||||
## Sources
|
||||
|
||||
- Chromium's [`net/base/net_error_list.h`](https://chromium.googlesource.com/chromium/src/+/main/net/base/net_error_list.h),
|
||||
for `ERR_CONNECTION_TIMED_OUT` (-118), retrieved 2026-08-30.
|
||||
- Mozilla's [`xpcom/base/ErrorList.py`](https://searchfox.org/mozilla-central/source/xpcom/base/ErrorList.py)
|
||||
(viewed via the Fossies mirror), for `NS_ERROR_NET_TIMEOUT` (14) and its exact
|
||||
definition, retrieved 2026-08-30.
|
||||
- [microsoft/playwright#5062](https://github.com/microsoft/playwright/issues/5062), a
|
||||
real report of `net::ERR_TIMED_OUT` firing after roughly 30 seconds despite
|
||||
Playwright's own navigation timeout being set to 180 seconds, filed as a request to
|
||||
make the browser's own socket connect timeout configurable.
|
||||
- [microsoft/playwright#10851](https://github.com/microsoft/playwright/issues/10851) and
|
||||
[microsoft/playwright#30406](https://github.com/microsoft/playwright/issues/30406),
|
||||
intermittent `net::ERR_CONNECTION_TIMED_OUT` reports against targets confirmed
|
||||
reachable moments later.
|
||||
- [microsoft/playwright#13027](https://github.com/microsoft/playwright/issues/13027),
|
||||
`NS_ERROR_NET_TIMEOUT` reported against Firefox specifically, intermittent in CI and
|
||||
not reproducing locally.
|
||||
- The Linux manual page for [`tcp(7)`](https://man7.org/linux/man-pages/man7/tcp.7.html),
|
||||
for the kernel's own default TCP SYN retry ceiling, retrieved 2026-08-30.
|
||||
|
||||
**See also:** [TimeoutError: Timeout 30000ms Exceeded](playwright-timeout-30000ms-exceeded.md)
|
||||
for the driver-level timeout this page distinguishes itself from, [ERR_CONNECTION_REFUSED
|
||||
in Playwright](err-connection-refused-playwright.md) for the active-rejection counterpart
|
||||
to this silent one, and [ERR_NETWORK_CHANGED in Playwright](err-network-changed-playwright.md)
|
||||
for a connection that was interrupted mid-flight rather than never answered at all.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. The browser's own connect timeout is not a Playwright
|
||||
setting and this project does not extend or shorten it; a silent connection attempt is
|
||||
the network answering nothing, which no fingerprint work reaches.*
|
||||
@@ -0,0 +1,160 @@
|
||||
---
|
||||
title: "net::ERR_EMPTY_RESPONSE in Playwright"
|
||||
description: "net::ERR_EMPTY_RESPONSE means the server closed the connection without sending a single byte back, not even a status line. A misbehaving proxy, a crashed backend, and a deliberate anti-automation drop all produce it identically."
|
||||
parent: "Network, Proxy and WebRTC"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 36
|
||||
---
|
||||
|
||||
|
||||
# net::ERR_EMPTY_RESPONSE in Playwright
|
||||
|
||||
`net::ERR_EMPTY_RESPONSE` means the connection to the server was made, the request went
|
||||
out, and the server closed the connection without sending anything back at all: no
|
||||
status line, no headers, no body. Chromium's own network error list defines it exactly
|
||||
that way, code -324, "The server closed the connection without sending any data."
|
||||
`page.goto()` throws it after the TCP or TLS layer succeeded, which is the detail worth
|
||||
holding onto before reading anything else on this page: this is not a reachability
|
||||
failure and not a handshake failure. Something answered the socket, then said nothing.
|
||||
|
||||
## The realistic causes
|
||||
|
||||
**A crashed or overloaded backend.** A worker process dying mid-request, an
|
||||
out-of-memory kill, or a request handler that raises before writing a single byte all
|
||||
leave the reverse proxy or load balancer in front of it holding an open connection with
|
||||
nothing to forward. The proxy closes the client connection instead of inventing a
|
||||
response, and the browser reports exactly this.
|
||||
|
||||
**A proxy or load balancer timing out on the backend and giving up without answering.**
|
||||
Distinct from a client-visible timeout: the proxy's own patience with the origin server
|
||||
ran out, and instead of returning a proper `502` or `504` it drops the connection
|
||||
silently. Whether a given proxy does this depends entirely on its configuration; some
|
||||
always synthesize an error page, some do not.
|
||||
|
||||
**A server deliberately closing the connection instead of answering.** This is a
|
||||
documented, ordinary feature of production web servers, not a theory about hostile
|
||||
intent. nginx's own status code `444` exists specifically to close a connection without
|
||||
sending any response, and the `reset_timedout_connection` directive, in nginx's own
|
||||
words, applies to "connections closed with the non-standard code 444," releasing the
|
||||
socket with a TCP reset, not a normal close. A server operator who wants to deny
|
||||
a request with zero information leakage, whether the requester is a scanner, a bot, or
|
||||
simply unwanted traffic, has this as a first-class, standard option: return nothing
|
||||
rather than a status code that says "blocked."
|
||||
|
||||
**A proxy-side rewrite or bypass rule interacting badly with routing.** [A real Playwright
|
||||
report](https://github.com/microsoft/playwright/issues/20703) traces `ERR_EMPTY_RESPONSE`
|
||||
to a `proxy.bypass` configuration combined with a manual host mapping for one domain; the
|
||||
manual mapping worked and the proxy path did not, pointing at the proxy's own routing for
|
||||
that hostname rather than the destination server.
|
||||
|
||||
**A dev-server or component-test harness racing its own startup.** [A component-testing
|
||||
report](https://github.com/microsoft/playwright/issues/16424) shows `ERR_EMPTY_RESPONSE`
|
||||
against `localhost` on a second test run specifically, which is a different shape from a
|
||||
remote target: a local server that has not finished binding, or a build tool serving a
|
||||
half-written response, produces the identical string with nothing remote involved at all.
|
||||
|
||||
## What Firefox calls this, and why the naming does not map one to one
|
||||
|
||||
`invisible_playwright` drives a patched Firefox, and Firefox's networking layer does not
|
||||
use `net::ERR_*` strings. Here the mapping is worth doing carefully rather than by name
|
||||
association, because Firefox's own error list, `ErrorList.py` in the Firefox source tree,
|
||||
splits this differently than the name would suggest.
|
||||
|
||||
`NS_ERROR_NET_RESET`, error 20, is defined as "the connection was established, but no
|
||||
data was ever received." That is the literal match for what Chromium's
|
||||
`ERR_EMPTY_RESPONSE` describes: a connection that opened and then produced zero bytes.
|
||||
|
||||
`NS_ERROR_NET_EMPTY_RESPONSE`, error 36, despite the name, is defined narrower: "the
|
||||
connection was established, but browser received an empty page with 4xx, 5xx error
|
||||
response." That is a response that did carry a status line, an error one, with nothing
|
||||
in the body, which is a different event from silence on the wire.
|
||||
|
||||
So a Firefox log reporting `NS_ERROR_NET_RESET` is the closer analog to what a Chromium
|
||||
user means by `ERR_EMPTY_RESPONSE`, not the similarly-named
|
||||
`NS_ERROR_NET_EMPTY_RESPONSE`. Read the Firefox error name literally rather than by
|
||||
resemblance to the Chromium string you searched for.
|
||||
|
||||
## Diagnostic checklist
|
||||
|
||||
1. **Reproduce with `curl -v` against the same URL through the same proxy, outside
|
||||
Playwright entirely.** `curl` prints exactly what came back, including a connection
|
||||
that closes with zero bytes, and removes the browser as a variable.
|
||||
2. **Remove the proxy and retry direct.** Gone without it, the proxy or the path to it is
|
||||
implicated, matching the shape in the routing-bypass report above. Persists, the origin
|
||||
server or something between you and it is next.
|
||||
3. **Check whether it is one target or many.** Consistent on one specific site with
|
||||
everything else loading normally is the shape of a deliberate drop; intermittent across
|
||||
unrelated targets points at your own proxy or network path.
|
||||
4. **If the target is your own dev server or test harness, check it finished starting.**
|
||||
A `localhost` empty response, especially only on a second or later run, is often a race
|
||||
with the server's own startup or a build step, not a remote failure at all.
|
||||
5. **Ask whether the same request succeeds from a different exit or network.** Success
|
||||
elsewhere with the identical request narrows the cause to something specific about the
|
||||
current IP or proxy, which is consistent with, though not proof of, a deliberate block.
|
||||
|
||||
## The honest boundary
|
||||
|
||||
An empty response is generated by whatever closed the connection: a backend process, a
|
||||
proxy, a load balancer, or a server explicitly built to answer unwanted requests with
|
||||
silence. `invisible_playwright` passes requests through the patched engine's own network
|
||||
stack and does not intercept, retry, or paper over a connection that closes with nothing
|
||||
in it. A stock Playwright Chromium, a stock Firefox, and this project's build all see the
|
||||
identical empty response from the identical proxy or server, because nothing about a
|
||||
browser's JavaScript-visible identity changes what happens at the TCP layer before a
|
||||
single header exists.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What does net::ERR_EMPTY_RESPONSE mean?** The connection to the server succeeded and
|
||||
then the server closed it without sending any data back at all, not even a status line.
|
||||
|
||||
**Is this the same as a timeout?** No. A timeout is a connection attempt or a wait that
|
||||
never resolves. This is a connection that resolved and then produced silence.
|
||||
|
||||
**Could this be a deliberate block rather than a bug?** Yes, and it is a documented,
|
||||
ordinary server capability, not a hypothesis: closing a connection with no response is a
|
||||
standard way to deny a request without revealing anything about why.
|
||||
|
||||
**Why does it only happen on my local dev server, not in production?** A race with the
|
||||
server's own startup or a build step is common on `localhost`, distinct from a remote
|
||||
target's behavior; check that the server has actually finished binding before Playwright
|
||||
navigates to it.
|
||||
|
||||
**What does Firefox call this instead of ERR_EMPTY_RESPONSE?** `NS_ERROR_NET_RESET` is
|
||||
the closer match, defined as a connection established with no data ever received. The
|
||||
similarly-named `NS_ERROR_NET_EMPTY_RESPONSE` is a narrower case, an empty body on a 4xx
|
||||
or 5xx status line, not silence on the wire.
|
||||
|
||||
**Can invisible_playwright prevent or fix an empty response?** No. It is generated by
|
||||
whatever closed the connection, below any layer this project's stealth patching touches.
|
||||
|
||||
## Sources
|
||||
|
||||
- Chromium's [`net/base/net_error_list.h`](https://chromium.googlesource.com/chromium/src/+/main/net/base/net_error_list.h),
|
||||
for `ERR_EMPTY_RESPONSE` (-324), "The server closed the connection without sending any
|
||||
data," retrieved 2026-08-30.
|
||||
- Mozilla's [`xpcom/base/ErrorList.py`](https://searchfox.org/mozilla-central/source/xpcom/base/ErrorList.py)
|
||||
(viewed via the Fossies mirror), for `NS_ERROR_NET_RESET` (20) and
|
||||
`NS_ERROR_NET_EMPTY_RESPONSE` (36) and their exact definitions, retrieved 2026-08-30.
|
||||
- nginx's own documentation for [`reset_timedout_connection`](https://nginx.org/en/docs/http/ngx_http_core_module.html#reset_timedout_connection),
|
||||
confirming the non-standard status `444` closes a connection without sending a
|
||||
response, retrieved 2026-08-30.
|
||||
- [microsoft/playwright#20703](https://github.com/microsoft/playwright/issues/20703), a
|
||||
real `ERR_EMPTY_RESPONSE` report traced to a `proxy.bypass` configuration for one
|
||||
domain.
|
||||
- [microsoft/playwright#16424](https://github.com/microsoft/playwright/issues/16424), a
|
||||
component-test report of `ERR_EMPTY_RESPONSE` against `localhost` specifically on a
|
||||
second run.
|
||||
|
||||
**See also:** [ERR_CONNECTION_RESET in Playwright](err-connection-reset-playwright.md)
|
||||
for the TCP-RST variant of a connection dying mid-request, [ERR_HTTP2_PROTOCOL_ERROR in
|
||||
Playwright](err-http2-protocol-error-playwright.md) for a documented case of a server
|
||||
resetting a stream deliberately as an anti-automation response, and [ERR_TUNNEL_CONNECTION_FAILED
|
||||
in Playwright](err-tunnel-connection-failed-playwright.md) for the earlier failure of the
|
||||
proxy tunnel itself never completing.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. Silence on the wire is generated by whatever closed
|
||||
the connection; the browser's identity layer has no part in it either way.*
|
||||
@@ -0,0 +1,168 @@
|
||||
---
|
||||
title: "ERR_HTTP2_PROTOCOL_ERROR in Playwright: causes and how to diagnose it"
|
||||
description: "ERR_HTTP2_PROTOCOL_ERROR in Playwright is Chromium's catch-all for an HTTP/2 framing violation, often a proxy mangling the tunnel or a TLS/ALPN mismatch. How to tell which, without guessing."
|
||||
parent: "Network, Proxy and WebRTC"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 28
|
||||
---
|
||||
|
||||
|
||||
# ERR_HTTP2_PROTOCOL_ERROR in Playwright: causes and how to diagnose it
|
||||
|
||||
`ERR_HTTP2_PROTOCOL_ERROR` means the client detected a violation of the HTTP/2 framing
|
||||
rules and killed the connection itself, usually with an `RST_STREAM` or `GOAWAY` frame
|
||||
carrying `PROTOCOL_ERROR`. It is not a timeout, not a DNS failure, and not on its own
|
||||
proof a site blocked you. It is the browser's HTTP/2 stack refusing to keep talking
|
||||
because something on the wire broke the rules it enforces.
|
||||
|
||||
The code does not say which rule broke, or on which side. That is by design: Chromium
|
||||
developers have said on the public chromium-dev list that this one code covers roughly
|
||||
eight distinct causes, and the only reliable way to separate them is a network log read
|
||||
for the actual frame that triggered it. This page narrows that to what a Playwright
|
||||
user actually hits: a proxy in the path, and the automation-specific reports in
|
||||
Playwright's own issue tracker.
|
||||
|
||||
## What the string is, and which browser actually says it
|
||||
|
||||
`ERR_HTTP2_PROTOCOL_ERROR`, code -337 in Chromium's `net_error_list.h`, is a Chromium
|
||||
net-stack string, thrown by `page.goto()` when Playwright drives Chromium. It is the
|
||||
exact string almost every search result about this topic is describing.
|
||||
|
||||
Firefox does not surface this literal string. `invisible_playwright` drives a Firefox
|
||||
patched at the C++ level with the networking stack untouched, so the same class of
|
||||
HTTP/2 framing violation shows up under Firefox's own names: commonly
|
||||
`NS_ERROR_NET_RESET` for a connection torn down mid-stream, or, when the server
|
||||
negotiates HTTP/2 over a TLS cipher HTTP/2 blacklists,
|
||||
`NS_ERROR_NET_INADEQUATE_SECURITY`. Same protocol, same class of break, different name,
|
||||
because the two engines carry separate HTTP/2 implementations. Searched this exact
|
||||
string while driving Firefox? Look for those two names in your logs instead.
|
||||
|
||||
## The causes worth checking behind a proxy
|
||||
|
||||
- **The proxy does not tunnel HTTP/2 cleanly.** A `CONNECT` tunnel should be a
|
||||
transparent byte pipe. A proxy that buffers the stream, re-chunks it, or terminates
|
||||
and re-opens TLS itself can corrupt the binary framing, and the client sees frames
|
||||
that do not parse.
|
||||
- **ALPN disagrees with what actually gets spoken.** HTTP/2 is negotiated in the TLS
|
||||
handshake's ALPN extension. A proxy that terminates TLS and re-negotiates outbound can
|
||||
advertise `h2` to your client while speaking something else to the origin, so the
|
||||
session starts as HTTP/2 and cannot stay one.
|
||||
- **A server-side HTTP/2 config problem, unrelated to your proxy.** HTTP/2 enforces
|
||||
header rules HTTP/1.1 never did: no invalid bytes in a header value, a fixed
|
||||
pseudo-header order, framing from RFC 9113 a lenient HTTP/1.1 stack never checked. A
|
||||
working HTTP/1.1 endpoint can trip this the moment a header carries a character
|
||||
HTTP/1.1 tolerated. Diagnosable, but it belongs to the target, not your setup.
|
||||
- **The "error" is not an error.** More than one report traces this exact code to a
|
||||
server sending `RST_STREAM` deliberately, as an anti-automation response rather than a
|
||||
protocol accident. The browser reports both cases identically: a stream closed with
|
||||
`PROTOCOL_ERROR` before delivering anything.
|
||||
|
||||
A smaller set of reports describe the error only in headless mode, disappearing
|
||||
headful, proxy or no proxy. That is in Playwright's own tracker with no confirmed root
|
||||
cause; treat it as something to test for, not an explanation to assume.
|
||||
|
||||
## How to actually find out which one it is
|
||||
|
||||
1. **Drop the proxy and retry.** Gone on a direct connection, the proxy is implicated.
|
||||
Survives, the fault is server-side or in ALPN, and no proxy change fixes it.
|
||||
2. **Hit the same target and proxy with curl.** `curl -v --http2 -x <proxy> <url>`
|
||||
isolates the browser entirely; if curl reproduces the failure, Playwright is not the
|
||||
variable.
|
||||
3. **Force HTTP/1.1 as a diagnostic, not a fix.** `curl --http1.1` through the same
|
||||
proxy, or a launch flag disabling HTTP/2, shows whether the target works once the
|
||||
stricter framing is out of the picture. Success there points at HTTP/2-specific
|
||||
strictness, not the network path itself.
|
||||
4. **Read the actual frame, not just the code.** Chromium: `chrome://net-export`,
|
||||
reproduce, load the capture in the netlog viewer, look for
|
||||
`HTTP2_SESSION_RECV_INVALID_HEADER` or the equivalent event. Firefox: set
|
||||
`MOZ_LOG=nsHttp:5,nsSocketTransport:5` before launch and read the log for the frame
|
||||
that preceded the failure.
|
||||
5. **Swap the exit and repeat.** A different proxy exit clearing the error on the same
|
||||
target points at the previous exit's HTTP/2 handling, not the target.
|
||||
6. **Note first request versus concurrency.** A proxy mishandling multiplexed streams on
|
||||
one tunnel can pass a single quiet request and fail only once several run in
|
||||
parallel.
|
||||
|
||||
## What invisible_playwright does and does not touch here
|
||||
|
||||
Its TLS and HTTP/2 stacks are the engine's own, left unmodified so the handshake and
|
||||
the frames read as genuine Firefox rather than an approximation. The product is not the
|
||||
source of this error on its own build, and it cannot fix it either: a proxy that
|
||||
mangles an HTTP/2 tunnel mangles it the same way whether the browser behind it has a
|
||||
carefully built fingerprint or a stock Playwright default. A cleaner identity changes
|
||||
what a page reports about itself, not how a middlebox handles binary framing three
|
||||
layers below the page.
|
||||
|
||||
## Conclusion
|
||||
|
||||
`ERR_HTTP2_PROTOCOL_ERROR` is a catch-all for "the HTTP/2 rules were broken," with no
|
||||
hint in the string about who broke them. Reproduce without the proxy to place the fault
|
||||
on one side of it, confirm with curl outside the browser entirely, and read the actual
|
||||
frame log before assuming a cause. Most of the fixes that matter here live in the proxy
|
||||
or the server configuration, not in the browser driving the request.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What does ERR_HTTP2_PROTOCOL_ERROR mean?** The client's HTTP/2 stack detected a
|
||||
framing or stream-level rule violation and closed the connection itself. It does not
|
||||
say which rule, or which side, broke it.
|
||||
|
||||
**Is this always the proxy's fault?** No. It shows up from a proxy mangling an HTTP/2
|
||||
tunnel, a TLS/ALPN mismatch, a server-side HTTP/2 config problem, and a server
|
||||
deliberately resetting the stream as a block. Testing with the proxy removed tells you
|
||||
which fastest.
|
||||
|
||||
**Will forcing HTTP/1.1 fix it?** It is a diagnostic, not a fix. Success on HTTP/1.1
|
||||
means the break is specific to HTTP/2's stricter framing or header rules, which tells
|
||||
you where to keep looking rather than closing the case.
|
||||
|
||||
**Does invisible_playwright's stealth patching cause or fix this?** Neither. Its TLS
|
||||
and HTTP/2 stacks are the engine's own and are untouched, so this is a network or
|
||||
server-configuration problem independent of the browser identity layer.
|
||||
|
||||
**Why does Firefox not show this exact error string?** `ERR_HTTP2_PROTOCOL_ERROR` is
|
||||
Chromium's net-stack naming. Firefox reports the same family under its own names,
|
||||
commonly `NS_ERROR_NET_RESET`, or `NS_ERROR_NET_INADEQUATE_SECURITY` for the
|
||||
TLS-cipher variant.
|
||||
|
||||
**Could this be bot detection rather than a real protocol bug?** In documented cases,
|
||||
yes: a server sends RST_STREAM deliberately, and the client reports it identically to
|
||||
an accidental one. Succeeds from a different exit with no other change? Suspect a
|
||||
deliberate reset over a genuine framing bug.
|
||||
|
||||
## Sources
|
||||
|
||||
- Chromium's [`net_error_list.h`](https://chromium.googlesource.com/chromium/src/+/main/net/base/net_error_list.h),
|
||||
defining `ERR_HTTP2_PROTOCOL_ERROR` as code -337, "There is an HTTP/2 protocol
|
||||
error," alongside related codes in the same family
|
||||
(`ERR_HTTP2_SERVER_REFUSED_STREAM`, `ERR_HTTP2_STREAM_CLOSED`,
|
||||
`ERR_HTTP2_COMPRESSION_ERROR`).
|
||||
- The [chromium-dev discussion on ERR_HTTP2_PROTOCOL_ERROR](https://groups.google.com/a/chromium.org/g/chromium-dev/c/VSzBnCgvQgc),
|
||||
where a Chromium developer diagnoses a concrete case, an invalid character in a
|
||||
response header name, and recommends a NetLog capture over guessing from the code.
|
||||
- [The case of HTTP2 protocol error and chromium net-log](https://blog.nuvotex.de/http2-protoerr-net-log/),
|
||||
a netlog-based diagnosis of a malformed `strict-transport-security` header value that
|
||||
HTTP/1.1 tolerated and HTTP/2's stricter parsing rejected.
|
||||
- Microsoft Playwright issues [#27600](https://github.com/microsoft/playwright/issues/27600)
|
||||
and [#31240](https://github.com/microsoft/playwright/issues/31240), user reports of
|
||||
`ERR_HTTP2_PROTOCOL_ERROR` under Playwright, one labeled by maintainers as an upstream
|
||||
Chromium issue after disabling HTTP/2 did not resolve it.
|
||||
- A [changedetection.io discussion](https://github.com/dgtlmoon/changedetection.io/discussions/2051)
|
||||
tracing repeated `ERR_HTTP2_PROTOCOL_ERROR` reports to sites actively resetting the
|
||||
connection as an anti-automation response rather than a genuine protocol fault.
|
||||
- Mozilla's [HTTP logging documentation](https://firefox-source-docs.mozilla.org/networking/http/logging.html),
|
||||
for the `MOZ_LOG=nsHttp:5,nsSocketTransport:5` capture used on Firefox.
|
||||
|
||||
**See also:** [HTTP/2 fingerprint: the layer above the TLS handshake](http2-fingerprint-detection.md)
|
||||
for what this same protocol layer reveals about the client, [SOCKS5 vs HTTP proxy: what
|
||||
each does in the browser](socks5-vs-http-proxy-browser.md) for which layer authenticates
|
||||
and where, and [why a plain requests scraper is blocked before it sends a
|
||||
header](web-scraping-tls-fingerprint-requests-blocked.md) for the TLS layer just beneath
|
||||
this one.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The HTTP/2 stack is one
|
||||
of the parts left deliberately untouched, so an error at this layer is a proxy or
|
||||
server problem to solve, not a spoof to add.*
|
||||
@@ -0,0 +1,185 @@
|
||||
---
|
||||
title: "net::ERR_INVALID_AUTH_CREDENTIALS in Playwright"
|
||||
description: "net::ERR_INVALID_AUTH_CREDENTIALS means an HTTP authentication exchange was attempted and failed to establish credentials, a distinct failure from a proxy tunnel refusing a 407 or a SOCKS5 credential being silently dropped."
|
||||
parent: "Network, Proxy and WebRTC"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 38
|
||||
---
|
||||
|
||||
|
||||
# net::ERR_INVALID_AUTH_CREDENTIALS in Playwright
|
||||
|
||||
`net::ERR_INVALID_AUTH_CREDENTIALS` means Chromium's network stack attempted an HTTP
|
||||
authentication exchange and the credentials could not be established. Chromium's own
|
||||
network error list defines it in exactly those words, code -338: "Credentials could not
|
||||
be established during HTTP Authentication." `page.goto()` throws it when this happens on
|
||||
navigation, and it is worth being precise about what that sentence does and does not
|
||||
cover, because two other, very different proxy failures get confused with it constantly.
|
||||
|
||||
## What this error is not
|
||||
|
||||
It is not [`ERR_TUNNEL_CONNECTION_FAILED`](err-tunnel-connection-failed-playwright.md),
|
||||
which fires when an HTTP proxy's `CONNECT` tunnel is refused outright, commonly on a
|
||||
`407` the client never successfully answers. That failure happens before any
|
||||
authentication scheme has actually been negotiated; the tunnel itself never opens.
|
||||
|
||||
It is also not the silent SOCKS5 credential drop covered on [the SOCKS5 authentication
|
||||
page](playwright-socks5-proxy-authentication.md). That failure produces no exception at
|
||||
all: the page loads, from the wrong address or not the way you expected, because
|
||||
Playwright's documented `proxy` credentials are specified for HTTP proxies only and a
|
||||
SOCKS5 username and password are quietly dropped on the way to the connection.
|
||||
|
||||
`ERR_INVALID_AUTH_CREDENTIALS` sits after both of those, in the exchange itself. A
|
||||
challenge was issued, a client attempted to answer it with a scheme such as Basic,
|
||||
Digest, NTLM, or Negotiate, and the exchange failed to produce credentials the server or
|
||||
proxy would accept. It is loud, not silent, and it is thrown after negotiation started,
|
||||
not before a tunnel opened.
|
||||
|
||||
## The adjacent codes worth knowing, because they narrow the diagnosis
|
||||
|
||||
Chromium's error list places several related, more specific failures right next to this
|
||||
one, and which one you actually see narrows the cause: `ERR_MISSING_AUTH_CREDENTIALS`
|
||||
(-341), "No Kerberos credentials were available during HTTP Authentication," the
|
||||
GSSAPI-specific case of having nothing to offer for a Negotiate challenge instead of
|
||||
offering something that gets rejected; `ERR_UNSUPPORTED_AUTH_SCHEME` (-339), "An HTTP
|
||||
Authentication scheme was tried which is not supported on this machine," a platform gap
|
||||
rather than wrong credentials; and `ERR_MALFORMED_IDENTITY` (-329), "The identity used
|
||||
for authentication is invalid," a client-side formatting problem before the server ever
|
||||
gets to accept or reject anything. If your log shows one of these instead, the fix is
|
||||
different: a missing local credential store for the first, a scheme the machine simply
|
||||
cannot perform for the second.
|
||||
|
||||
## Where this actually shows up
|
||||
|
||||
**A proxy or an internal server negotiating NTLM or Negotiate/Kerberos rather than plain
|
||||
Basic.** [A real report](https://github.com/microsoft/playwright/issues/12890) shows
|
||||
`ERR_INVALID_AUTH_CREDENTIALS` against a VPN-gated internal hostname, a shape consistent
|
||||
with integrated Windows authentication attempting a scheme exchange that never completes
|
||||
outside the environment it expects. Chromium's own documentation on [HTTP authentication](https://www.chromium.org/developers/design-documents/http-authentication/)
|
||||
lists Negotiate as able to fall back to either Kerberos or NTLM, and that negotiation has
|
||||
its own failure modes independent of whether the password itself is correct.
|
||||
|
||||
**Playwright's documented `proxy` credentials reaching an infrastructure layer that does
|
||||
not forward them the way a direct launch does.** [A real report](https://github.com/microsoft/playwright/issues/35679)
|
||||
shows the identical `server`/`username`/`password` configuration working on a direct
|
||||
Playwright launch and failing with this error once routed through a Selenium Grid node.
|
||||
|
||||
**Proxy credentials configured but never transmitted at all, which reads as this error
|
||||
family even though nothing was rejected.** [A separate report](https://github.com/microsoft/playwright/issues/32567)
|
||||
shows a proxy's own access log recording no `Proxy-Authorization` header at all despite
|
||||
credentials being set on the `proxy` object, a "never sent" failure rather than "sent and
|
||||
rejected," worth ruling out before assuming the password itself is wrong.
|
||||
|
||||
**Basic auth combined with a proxy in the same session.** [A related report](https://github.com/microsoft/playwright/issues/21703)
|
||||
shows `http_credentials` for an origin server's Basic-auth challenge failing specifically
|
||||
when a proxy is also configured; embedding the credentials directly in the URL was the
|
||||
workaround that worked where the documented [`http_credentials` context option](http-basic-auth-playwright-http-credentials.md)
|
||||
did not.
|
||||
|
||||
## Diagnostic checklist
|
||||
|
||||
1. **Identify which layer is challenging you: the proxy, or the destination site.** A
|
||||
proxy issuing the challenge means this is proxy authentication; the destination server
|
||||
issuing it means `http_credentials` on the context is the right tool, not the `proxy`
|
||||
option's credentials.
|
||||
2. **Confirm the credentials are actually being sent**, not merely configured. Capture
|
||||
traffic or check the target's own access log for a `Proxy-Authorization` or
|
||||
`Authorization` header on the failing request, the way the report above distinguishes
|
||||
"never sent" from "sent and rejected."
|
||||
3. **Test the same credentials with `curl` against the same endpoint outside Playwright.**
|
||||
`curl -v --proxy-user user:pass -x http://proxy:port https://example.com` isolates
|
||||
whether the credentials themselves are valid before touching browser configuration at
|
||||
all.
|
||||
4. **Check what authentication scheme is actually being negotiated.** NTLM and
|
||||
Negotiate/Kerberos have their own environment-dependent failure modes, distinct from a
|
||||
simple wrong password on Basic or Digest; a scheme requiring domain-joined credentials
|
||||
will not succeed from a machine outside that domain no matter how correct they look.
|
||||
5. **If a proxy and `http_credentials` are both configured, test with one removed at a
|
||||
time**, since a documented interaction exists between the two.
|
||||
|
||||
## What Firefox reports instead
|
||||
|
||||
`invisible_playwright` drives a patched Firefox, and Firefox's networking layer has no
|
||||
single equivalent to Chromium's generic `ERR_INVALID_AUTH_CREDENTIALS`. What exists
|
||||
instead, in Firefox's own error list, is narrower and split by context:
|
||||
`NS_ERROR_PROXY_AUTHENTICATION_FAILED`, defined as covering the case where a `407` from a
|
||||
proxy cannot be easily propagated back to the caller, and `NS_ERROR_PROXY_UNAUTHORIZED`
|
||||
for the proxy's `401`-equivalent status internally. There is no distinct Firefox
|
||||
constant for a failed credential exchange against the destination server the way
|
||||
Chromium's code covers it; a rejected Basic or Digest exchange there generally surfaces
|
||||
as a repeated challenge rather than a single named failure. If you are chasing this
|
||||
failure against Firefox specifically, look for the proxy-side names above rather than
|
||||
searching for a literal Chromium string that Firefox does not produce.
|
||||
|
||||
## The honest boundary
|
||||
|
||||
Credential negotiation happens inside the HTTP and proxy-authentication layers,
|
||||
independent of anything a browser reports about itself to a page. `invisible_playwright`
|
||||
passes the `proxy` and `http_credentials` options straight through to the patched engine;
|
||||
it does not retry a failed exchange, guess at a working scheme, or make a rejected
|
||||
credential accepted. A stock Playwright browser and this project's build fail an
|
||||
authentication exchange identically given the identical credentials and the identical
|
||||
challenge, because nothing about the fingerprint layer this project touches is involved
|
||||
in whether a password is correct.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What does net::ERR_INVALID_AUTH_CREDENTIALS mean?** An HTTP authentication exchange,
|
||||
Basic, Digest, NTLM, or Negotiate, was attempted and failed to establish credentials the
|
||||
challenger would accept. It fires after negotiation starts, not before.
|
||||
|
||||
**How is this different from ERR_TUNNEL_CONNECTION_FAILED?** That error means an HTTP
|
||||
proxy's CONNECT tunnel was refused, often on an unanswered 407, before any authentication
|
||||
scheme actually ran. This error means a scheme was attempted and its exchange failed.
|
||||
|
||||
**Why does my SOCKS5 proxy fail silently instead of throwing this?** Playwright's proxy
|
||||
credential fields are documented for HTTP proxies only. A SOCKS5 username and password
|
||||
are dropped with no exception at all, a different and quieter failure covered on the
|
||||
SOCKS5 authentication page.
|
||||
|
||||
**Could my credentials be correct and this still happens?** Yes. A scheme mismatch, an
|
||||
NTLM or Kerberos negotiation that cannot complete outside its expected environment, or an
|
||||
infrastructure layer that never actually transmits the credentials you configured can all
|
||||
produce this error with a genuinely correct password.
|
||||
|
||||
**Is proxy authentication the same option as http_credentials?** No. `proxy.username`
|
||||
and `proxy.password` authenticate to the proxy itself; `http_credentials` on the context
|
||||
answers a `401` challenge from the destination site. Confusing the two is a documented
|
||||
source of this failure.
|
||||
|
||||
## Sources
|
||||
|
||||
- Chromium's [`net/base/net_error_list.h`](https://chromium.googlesource.com/chromium/src/+/main/net/base/net_error_list.h),
|
||||
for `ERR_INVALID_AUTH_CREDENTIALS` (-338) and the adjacent `ERR_MISSING_AUTH_CREDENTIALS`
|
||||
(-341), `ERR_UNSUPPORTED_AUTH_SCHEME` (-339), and `ERR_MALFORMED_IDENTITY` (-329),
|
||||
retrieved 2026-08-30.
|
||||
- Mozilla's [`xpcom/base/ErrorList.py`](https://searchfox.org/mozilla-central/source/xpcom/base/ErrorList.py)
|
||||
(viewed via the Fossies mirror), for `NS_ERROR_PROXY_AUTHENTICATION_FAILED` and
|
||||
`NS_ERROR_PROXY_UNAUTHORIZED`, retrieved 2026-08-30.
|
||||
- Chromium's own [HTTP authentication design document](https://www.chromium.org/developers/design-documents/http-authentication/),
|
||||
for the supported schemes (Basic, Digest, NTLM, Negotiate) and how Negotiate falls back
|
||||
to Kerberos or NTLM, retrieved 2026-08-30.
|
||||
- [microsoft/playwright#12890](https://github.com/microsoft/playwright/issues/12890),
|
||||
`ERR_INVALID_AUTH_CREDENTIALS` against a VPN-gated internal hostname.
|
||||
- [microsoft/playwright#35679](https://github.com/microsoft/playwright/issues/35679),
|
||||
identical proxy credentials working on a direct launch and failing through a Selenium
|
||||
Grid node.
|
||||
- [microsoft/playwright#32567](https://github.com/microsoft/playwright/issues/32567), a
|
||||
proxy's own access log showing no authentication header received despite credentials
|
||||
being configured.
|
||||
- [microsoft/playwright#21703](https://github.com/microsoft/playwright/issues/21703),
|
||||
`http_credentials` failing specifically when a proxy is also configured on the same
|
||||
context.
|
||||
|
||||
**See also:** [ERR_TUNNEL_CONNECTION_FAILED in Playwright](err-tunnel-connection-failed-playwright.md)
|
||||
for the earlier tunnel-refusal failure this one is most often confused with, [SOCKS5
|
||||
proxy authentication in Playwright](playwright-socks5-proxy-authentication.md) for the
|
||||
silent, unrelated failure on the SOCKS5 path, and [handling HTTP basic auth in
|
||||
Playwright](http-basic-auth-playwright-http-credentials.md) for the `http_credentials`
|
||||
option this page distinguishes from proxy credentials.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. Both credential options pass straight to the engine;
|
||||
a rejected exchange is the challenger's answer, not a spoof this project could add.*
|
||||
@@ -0,0 +1,161 @@
|
||||
---
|
||||
title: "net::ERR_NAME_NOT_RESOLVED in Playwright"
|
||||
description: "net::ERR_NAME_NOT_RESOLVED means DNS failed before the proxy ever got a chance, or a SOCKS5 proxy is resolving hostnames on the wrong side. The Firefox preference that decides which, and how to confirm it."
|
||||
parent: "Network, Proxy and WebRTC"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 34
|
||||
---
|
||||
|
||||
|
||||
# net::ERR_NAME_NOT_RESOLVED in Playwright
|
||||
|
||||
`net::ERR_NAME_NOT_RESOLVED` means DNS resolution of a hostname failed outright.
|
||||
Chromium's own network error list defines it in five words: "the host name could not
|
||||
be resolved." `page.goto()` throws it before any connection to a destination or a
|
||||
proxy is attempted for that name, because without an address there is nothing to
|
||||
connect to yet.
|
||||
|
||||
The two questions that actually matter are which hostname failed to resolve, the
|
||||
destination site's or the proxy's own, and, if a SOCKS5 proxy is involved, which side
|
||||
was supposed to be doing the resolving in the first place.
|
||||
|
||||
## The causes
|
||||
|
||||
**A genuine DNS failure with no proxy involved.** A typo'd domain, a domain that has
|
||||
actually stopped resolving, or a local resolver that is down or misconfigured. The
|
||||
most literal reading of the error, and worth ruling out first with a plain DNS
|
||||
lookup outside the browser entirely.
|
||||
|
||||
**A container or CI runner with no working resolver.** [microsoft/playwright#6771](https://github.com/microsoft/playwright/issues/6771)
|
||||
reports exactly this shape: intermittent `net::ERR_NAME_NOT_RESOLVED` against an
|
||||
internal domain, more frequent on an older Playwright version, in an automated CI
|
||||
environment. Environments with restricted or misconfigured DNS egress produce this
|
||||
failure with no code change involved at all.
|
||||
|
||||
**A SOCKS5 proxy resolving on the wrong side.** SOCKS5, unlike SOCKS4, supports
|
||||
sending a raw hostname to the proxy and letting the proxy resolve it at the exit,
|
||||
which is the entire reason a SOCKS5 proxy exists for someone who wants their DNS to
|
||||
come from the exit's network rather than their own. If the client resolves the
|
||||
destination hostname locally before ever contacting the proxy, and that local
|
||||
resolver cannot see the hostname, in an isolated or restricted network the proxy
|
||||
itself would have had no trouble with, the lookup fails before the proxy is ever
|
||||
consulted, and the browser reports exactly this error. Mozilla's own bug tracker
|
||||
carries a two-decade record of this exact class of problem under SOCKS5, [Bugzilla
|
||||
134105](https://bugzilla.mozilla.org/show_bug.cgi?id=134105), "SOCKS5: DNS lookups
|
||||
(host resolving) should occur on proxy, not client side," still marked resolved
|
||||
incomplete after competing patches over many years never fully landed.
|
||||
|
||||
**The proxy's own hostname, not the destination's, is what fails.** If the proxy
|
||||
itself is configured by hostname and that name will not resolve, the failure can
|
||||
present at this same layer before a destination lookup is ever reached. See
|
||||
[`net::ERR_PROXY_CONNECTION_FAILED` in Playwright](err-proxy-connection-failed-playwright.md)
|
||||
for the closely related failure this shades into once the proxy's own name is the
|
||||
one that will not resolve.
|
||||
|
||||
## The Firefox preference that decides the SOCKS5 case
|
||||
|
||||
Firefox's own proxy handling exposes exactly one preference deciding where SOCKS5
|
||||
DNS resolution happens: `network.proxy.socks_remote_dns`. With it off, which is
|
||||
Firefox's own stock default, every hostname resolves locally before the SOCKS5
|
||||
connection is even opened. With it on, resolution happens at the proxy's end, the
|
||||
behavior anyone reaching for SOCKS5 specifically usually wants. `curl`'s equivalent
|
||||
distinction is the `socks5` versus `socks5h` scheme, the `h` meaning exactly this:
|
||||
resolve at the proxy, not locally.
|
||||
|
||||
`invisible_playwright`'s own proxy wiring sets this preference to `true`
|
||||
automatically whenever a `socks5://` server is passed through the documented `proxy=`
|
||||
argument, [covered in full on the SOCKS5 authentication page](playwright-socks5-proxy-authentication.md#the-dns-half-which-almost-nobody-mentions).
|
||||
That path is not where this error tends to originate. It shows up when a SOCKS5
|
||||
proxy is configured by hand through raw `firefox_user_prefs`, bypassing that wiring,
|
||||
with `network.proxy.socks_remote_dns` left at its stock, off default: the hostname
|
||||
resolves against your own local or restricted network instead of the proxy's, and
|
||||
that lookup fails in exactly the isolated-network shape the Mozilla bug above
|
||||
describes.
|
||||
|
||||
## Diagnostic checklist
|
||||
|
||||
1. **Resolve the failing hostname directly, outside the browser.** `nslookup
|
||||
<hostname>` or `dig <hostname>` from the same machine, with no proxy involved.
|
||||
Fails there too: this is a genuine DNS problem, not a proxy-routing one.
|
||||
2. **If a SOCKS5 proxy is involved, compare local versus remote resolution with
|
||||
`curl`.** `curl -v --socks5 user:pass@host:port <url>` resolves locally; `curl -v
|
||||
--socks5-hostname user:pass@host:port <url>` resolves at the proxy. One working and
|
||||
the other failing localizes the problem precisely to which side is expected to
|
||||
resolve the name.
|
||||
3. **Confirm `network.proxy.socks_remote_dns` if you configured SOCKS5 by hand.** If
|
||||
you are not going through this project's documented `proxy=` argument, check the
|
||||
preference was actually set; its stock default is off.
|
||||
4. **In a container or CI runner, test DNS from inside that exact environment.**
|
||||
[microsoft/playwright#6771](https://github.com/microsoft/playwright/issues/6771)
|
||||
shows this class of failure being environment-specific and intermittent rather
|
||||
than reproducible from a developer's own machine.
|
||||
5. **Rule out a typo or a genuinely dead domain last**, since it is the least
|
||||
interesting cause and the easiest to confirm with a single lookup.
|
||||
|
||||
## The honest boundary
|
||||
|
||||
DNS resolution is a network-layer question, answered identically regardless of how
|
||||
real the browser's fingerprint looks to a remote site. `invisible_playwright` passes
|
||||
proxy configuration to the patched engine and, for SOCKS5 specifically, forces
|
||||
remote resolution through the documented path; it does not retry a failed lookup,
|
||||
guess at an address, or make an unreachable resolver reachable. A stock Playwright
|
||||
browser and this project's build fail an unresolvable hostname identically, because
|
||||
neither one is answering the failure at the identity layer.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What does net::ERR_NAME_NOT_RESOLVED mean?** DNS resolution of a hostname failed
|
||||
outright, before any connection to that name, proxy or destination, could even be
|
||||
attempted.
|
||||
|
||||
**Why would this happen with a working proxy?** A SOCKS5 proxy resolving the
|
||||
destination hostname locally instead of at the exit is the classic case: the local
|
||||
resolver cannot see a hostname the proxy's own network could have resolved fine.
|
||||
|
||||
**What controls whether Firefox resolves locally or at the proxy?**
|
||||
`network.proxy.socks_remote_dns`. Off by default in stock Firefox; this project sets
|
||||
it to `true` automatically when a `socks5://` server goes through its documented
|
||||
`proxy=` argument.
|
||||
|
||||
**How do I confirm which side is failing to resolve?** Compare `curl --socks5`
|
||||
(local resolution) against `curl --socks5-hostname` (remote resolution) through the
|
||||
same proxy and target. A difference between the two localizes the cause precisely.
|
||||
|
||||
**Does this ever mean the proxy itself is unreachable, not the destination?** Yes, if
|
||||
the proxy is configured by hostname and that name fails to resolve. See
|
||||
[ERR_PROXY_CONNECTION_FAILED](err-proxy-connection-failed-playwright.md) for that
|
||||
adjacent case.
|
||||
|
||||
**Can invisible_playwright fix a DNS resolution failure?** No. It forces correct
|
||||
remote resolution for SOCKS5 proxies configured through its own documented path, but
|
||||
a genuinely dead domain, a broken local resolver, or a restricted CI network's DNS
|
||||
egress are outside anything a browser's identity layer touches.
|
||||
|
||||
## Sources
|
||||
|
||||
- Chromium's [`net/base/net_error_list.h`](https://chromium.googlesource.com/chromium/src/+/main/net/base/net_error_list.h),
|
||||
for `ERR_NAME_NOT_RESOLVED` (-105), retrieved 2026-08-30.
|
||||
- [microsoft/playwright#6771](https://github.com/microsoft/playwright/issues/6771),
|
||||
an intermittent report of this exact error against an internal domain from CI.
|
||||
- Mozilla Bugzilla [134105](https://bugzilla.mozilla.org/show_bug.cgi?id=134105),
|
||||
"SOCKS5: DNS lookups (host resolving) should occur on proxy, not client side,"
|
||||
for the two-decade history of this exact failure class under SOCKS5.
|
||||
- Mozilla's [Firefox enterprise policy reference for `Proxy`](https://firefox-admin-docs.mozilla.org/reference/policies/proxy/),
|
||||
documenting `network.proxy.socks_remote_dns` as "use proxy DNS when using SOCKS
|
||||
v5."
|
||||
- The `requests` library's [documentation on SOCKS proxies](https://requests.readthedocs.io/en/latest/user/advanced/#socks),
|
||||
for the `socks5` versus `socks5h` scheme distinction referenced above.
|
||||
|
||||
**See also:** [Playwright SOCKS5 proxy with authentication](playwright-socks5-proxy-authentication.md)
|
||||
for the full DNS-resolution mechanics this page draws on, [does a proxy leak DNS?
|
||||
DoH and DNS leaks explained](does-a-proxy-leak-dns-doh-explained.md) for the quieter
|
||||
version of the same misconfiguration that leaks instead of failing outright, and
|
||||
[ERR_PROXY_CONNECTION_FAILED in Playwright](err-proxy-connection-failed-playwright.md)
|
||||
for when it is the proxy's own name, not the destination's, that will not resolve.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. DNS resolution happens below any fingerprint
|
||||
this project touches; when a SOCKS5 proxy is involved, `network.proxy.socks_remote_dns`
|
||||
decides which network's resolver actually gets asked.*
|
||||
@@ -0,0 +1,173 @@
|
||||
---
|
||||
title: "net::ERR_NETWORK_CHANGED in Playwright"
|
||||
description: "net::ERR_NETWORK_CHANGED fires when the OS reports a network interface change mid-request, aborting the connection outright. Why this is common in CI and cloud environments, and why it is usually transient."
|
||||
parent: "Testing and Troubleshooting"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 16
|
||||
---
|
||||
|
||||
|
||||
# net::ERR_NETWORK_CHANGED in Playwright
|
||||
|
||||
`net::ERR_NETWORK_CHANGED` means the operating system reported a change to the network
|
||||
while a connection was in progress, and the browser aborted that connection rather than
|
||||
trying to continue it. Chromium's own network error list defines it in four words, code
|
||||
-21, "The network changed." `page.goto()` throws it when this happens during navigation,
|
||||
and the failure is almost never about the destination site at all: it is about the
|
||||
network interface underneath the browser moving while a request was in flight.
|
||||
|
||||
## The mechanism behind it
|
||||
|
||||
Chromium watches for network changes through its own `NetworkChangeNotifier`, which
|
||||
listens for OS-level signals distinct from any single event: an IP address changing, a
|
||||
broader connectivity change, a general network change, and a DNS configuration change.
|
||||
A public Chromium bug discussion of this exact error is direct about when it actually
|
||||
bites: it is "flagged if the IP address changes during header reads or DNS lookups,"
|
||||
meaning the abort is not limited to the moment a connection first opens; a change
|
||||
arriving mid-response, while headers are still being read, kills an otherwise
|
||||
successful request just as readily.
|
||||
|
||||
Developers investigating repeated instances of this error in Chromium's own tracker found
|
||||
something specific and useful: the notifications can fire far more often than an actual
|
||||
network change would justify. One developer's capture, described directly in that
|
||||
discussion, showed `NETWORK_IP_ADDRESSES_CHANGED` firing "about once per second" on a
|
||||
machine under heavy concurrent network activity, "killing a spdy session" each time. The
|
||||
signal exists to protect a connection from surviving a genuine network change unnoticed;
|
||||
under load it can fire far more often than that, and every firing aborts whatever
|
||||
connection was mid-flight.
|
||||
|
||||
## Why this shows up so often in CI and cloud environments specifically
|
||||
|
||||
**Container and pod networking churn.** A real report shows `net::ERR_NETWORK_CHANGED`
|
||||
firing intermittently, roughly half the time, [from inside a Kubernetes cluster on
|
||||
AWS](https://github.com/microsoft/playwright/issues/13062), while the identical test
|
||||
suite ran cleanly on the reporter's own local machine. Container network namespaces are
|
||||
attached, reconfigured, and torn down far more actively than a developer's own laptop's
|
||||
network interface, and each of those events is exactly the class of signal
|
||||
`NetworkChangeNotifier` reacts to.
|
||||
|
||||
**VPN or proxy connections toggling mid-run.** Connecting or disconnecting a VPN while a
|
||||
page is loading changes the effective network path and the IP address the OS reports,
|
||||
precisely the shape this error is designed to catch, whether the toggle was deliberate or
|
||||
an artifact of a flaky VPN client reconnecting on its own.
|
||||
|
||||
**A Docker network being recreated or a container restarting its own networking.** The
|
||||
same namespace mechanics [covered in detail on the ERR_CONNECTION_REFUSED
|
||||
page](err-connection-refused-playwright.md#the-docker-and-ci-networking-variant-in-detail)
|
||||
mean a container's network can be torn down and rebuilt independently of what the browser
|
||||
process itself is doing, mid-request, with no warning visible to Playwright.
|
||||
|
||||
**Genuine interface switching**, a machine moving from Wi-Fi to Ethernet, from one Wi-Fi
|
||||
network to another, or waking from sleep with its network stack re-initializing. Less
|
||||
common on a CI runner than the container cases above, but the same underlying signal.
|
||||
|
||||
**Heavy concurrent I/O on the same host.** The Chromium discussion above found spurious,
|
||||
repeated `NETWORK_IP_ADDRESSES_CHANGED` notifications firing under load with no actual
|
||||
network event behind them, meaning a loaded CI runner, several jobs sharing one machine's
|
||||
network stack, can trigger this error with nothing genuinely changed.
|
||||
|
||||
## Diagnostic checklist
|
||||
|
||||
1. **Check whether the failure is one-off or systematic.** A single intermittent
|
||||
occurrence is consistent with the mechanism above; a failure on every run points at
|
||||
something actively toggling the network on that machine or pipeline stage.
|
||||
2. **Correlate the failure's timing against any network-affecting process on the same
|
||||
host or pod.** A VPN client, a container orchestrator reattaching a pod's network, or
|
||||
a deployment step restarting networking are the concrete triggers worth checking for.
|
||||
3. **In Kubernetes or another orchestrated environment, check for pod network events
|
||||
around the failure time.** The real report cited above traced this shape directly to
|
||||
a cluster; the orchestrator's own event log is where to look for a reattachment
|
||||
coinciding with the failure.
|
||||
4. **If the environment is otherwise stable, test whether concurrent load correlates
|
||||
with the failures.** The spurious-notification behavior documented in Chromium's own
|
||||
bug tracker means a busy machine can produce this error with no real network change
|
||||
behind it at all.
|
||||
5. **Treat a genuinely one-off occurrence as retryable**, since the failure describes an
|
||||
interruption, not a structural block.
|
||||
|
||||
## What Firefox reports, and where the mapping stops being clean
|
||||
|
||||
`invisible_playwright` drives a patched Firefox, and here the honest answer is that
|
||||
Firefox has no single, dedicated error constant playing the same role as Chromium's
|
||||
`ERR_NETWORK_CHANGED`. Its own low-level watcher for this class of event is
|
||||
`nsINetworkLinkService`, which tracks whether the machine's network link is up or down;
|
||||
[a real Mozilla bug](https://bugzilla.mozilla.org/show_bug.cgi?id=1593693) against that
|
||||
exact service shows it capable of reporting link status incorrectly, confirming the
|
||||
watcher exists and has its own edge cases, but Firefox does not fold a mid-request
|
||||
interface change into one dedicated, generically-named result code the way Chromium's
|
||||
error list does. In practice, a network change interrupting a Firefox connection
|
||||
mid-flight tends to surface through the general-purpose `NS_ERROR_NET_RESET`, if the
|
||||
interruption reads as the connection dying, or `NS_ERROR_NET_TIMEOUT`, if it reads as
|
||||
the replacement path never responding. Do not search for a literal Firefox equivalent
|
||||
of the Chromium string; look instead at whether one of those two codes appeared at the
|
||||
same moment as a real network event on the host.
|
||||
|
||||
## The honest boundary
|
||||
|
||||
A network interface changing while a connection is open is an operating-system-level
|
||||
event, reported to the browser's network stack below any layer a browser's identity
|
||||
touches. `invisible_playwright` passes the connection straight to the patched engine and
|
||||
does not suppress, filter, or retry around a network-change notification the OS
|
||||
delivers. A stock Playwright browser, a stock Firefox, and this project's build all
|
||||
abort an in-flight connection identically when the machine underneath them reports a
|
||||
network change, because nothing about a cleaner fingerprint changes what the operating
|
||||
system tells the browser about its own network interfaces.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What does net::ERR_NETWORK_CHANGED mean?** The operating system reported a change to
|
||||
the network, an IP address change, a connectivity change, or a DNS configuration change,
|
||||
while a connection was in progress, and the browser aborted it rather than continuing.
|
||||
|
||||
**Why does this happen so often in CI or cloud environments specifically?** Container
|
||||
and pod networking is reattached and reconfigured far more actively than a developer's
|
||||
own machine's network interface, and each of those events is exactly what this
|
||||
mechanism watches for. A real report shows this failing roughly half the time inside a
|
||||
Kubernetes cluster while never reproducing locally.
|
||||
|
||||
**Is this always a real network change?** Not necessarily. Chromium's own bug tracker
|
||||
documents the underlying notification firing spuriously under heavy load, once per
|
||||
second in one captured case, with no genuine network event behind it.
|
||||
|
||||
**Should I retry after seeing this error?** Usually, yes, if the occurrence looks
|
||||
one-off. The error describes an interruption of an otherwise viable connection, not a
|
||||
structural failure, and a retry after a transient interface event commonly succeeds.
|
||||
|
||||
**Does Playwright or invisible_playwright cause spurious network-change reports?**
|
||||
No. The notification comes from the operating system's own network-change signals,
|
||||
below any layer either Playwright or this project's stealth patching touches.
|
||||
|
||||
**What does Firefox call this instead of ERR_NETWORK_CHANGED?** There is no single
|
||||
direct equivalent. Firefox's own network-link watcher is `nsINetworkLinkService`, but a
|
||||
mid-request interruption from a real network change typically surfaces through the more
|
||||
general `NS_ERROR_NET_RESET` or `NS_ERROR_NET_TIMEOUT` rather than one dedicated code.
|
||||
|
||||
## Sources
|
||||
|
||||
- Chromium's [`net/base/net_error_list.h`](https://chromium.googlesource.com/chromium/src/+/main/net/base/net_error_list.h),
|
||||
for `ERR_NETWORK_CHANGED` (-21), retrieved 2026-08-30.
|
||||
- The Chromium bug discussion ["Frequently net::ERR_NETWORK_CHANGED error
|
||||
pages"](https://groups.google.com/a/chromium.org/g/chromium-bugs/c/79IS7AQCGcA), for
|
||||
the developer-confirmed mechanism (aborting on `NETWORK_IP_ADDRESSES_CHANGED` during
|
||||
header reads or DNS lookups) and the documented case of spurious, repeated
|
||||
notifications firing under heavy load, retrieved 2026-08-30.
|
||||
- [microsoft/playwright#13062](https://github.com/microsoft/playwright/issues/13062), a
|
||||
real report of `net::ERR_NETWORK_CHANGED` firing intermittently inside a Kubernetes
|
||||
cluster on AWS, not reproducing on the reporter's local machine.
|
||||
- Mozilla Bugzilla [1593693](https://bugzilla.mozilla.org/show_bug.cgi?id=1593693), for
|
||||
`nsINetworkLinkService`, Firefox's own network-link status watcher, and a documented
|
||||
case of it reporting link status incorrectly.
|
||||
|
||||
**See also:** [ERR_CONNECTION_TIMED_OUT in Playwright](err-connection-timed-out-playwright.md)
|
||||
for a connection that never got a response at all rather than one interrupted mid-flight,
|
||||
[ERR_CONNECTION_REFUSED in Playwright](err-connection-refused-playwright.md) for the
|
||||
Docker and container networking detail this page's CI causes build on, and [ERR_CONNECTION_RESET
|
||||
in Playwright](err-connection-reset-playwright.md) for the closely related shape of a
|
||||
connection dying mid-request for a different reason.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. A network-change abort comes from the operating
|
||||
system's own signals to the network stack; no fingerprint work sits anywhere near that
|
||||
layer.*
|
||||
@@ -0,0 +1,174 @@
|
||||
---
|
||||
title: "net::ERR_PROXY_CONNECTION_FAILED in Playwright"
|
||||
description: "net::ERR_PROXY_CONNECTION_FAILED means the browser could not even open a socket to the proxy server, before any CONNECT tunnel is attempted. How it differs from ERR_TUNNEL_CONNECTION_FAILED, and the causes worth checking first."
|
||||
parent: "Network, Proxy and WebRTC"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 32
|
||||
---
|
||||
|
||||
|
||||
# net::ERR_PROXY_CONNECTION_FAILED in Playwright
|
||||
|
||||
`net::ERR_PROXY_CONNECTION_FAILED` means the browser could not open a connection to
|
||||
the proxy server itself. Chromium's own network error list defines it precisely:
|
||||
"Could not create a connection to the proxy server. An error occurred either in
|
||||
resolving its name, or in connecting a socket to it." Nothing about the destination
|
||||
site is involved yet, because the browser never got past the proxy.
|
||||
|
||||
## Not the same failure as ERR_TUNNEL_CONNECTION_FAILED
|
||||
|
||||
This is the distinction worth making explicit, because the two names look similar
|
||||
and get confused constantly. [`ERR_TUNNEL_CONNECTION_FAILED`](err-tunnel-connection-failed-playwright.md)
|
||||
fires when the browser *did* reach the proxy, sent an HTTP `CONNECT` request for a
|
||||
specific HTTPS destination, and the proxy refused or failed that specific tunnel,
|
||||
commonly over bad credentials or a destination it will not forward to.
|
||||
`ERR_PROXY_CONNECTION_FAILED` fires earlier and more broadly: the browser never
|
||||
managed to open a TCP socket to the proxy at all, whether the destination is HTTP or
|
||||
HTTPS, whether authentication was ever going to be needed, before any `CONNECT`
|
||||
exchange is possible. Chromium keeps them as two distinct codes for exactly
|
||||
that reason: `-130` for `ERR_PROXY_CONNECTION_FAILED`, `-111` for
|
||||
`ERR_TUNNEL_CONNECTION_FAILED` - one failure before any `CONNECT`, one during
|
||||
it.
|
||||
|
||||
If you see `ERR_TUNNEL_CONNECTION_FAILED`, the proxy is reachable and rejected one
|
||||
specific request. If you see `ERR_PROXY_CONNECTION_FAILED`, the proxy was never
|
||||
reachable in the first place, or its own hostname never resolved. Treat them as two
|
||||
different bugs; fixing credentials does nothing for the second one.
|
||||
|
||||
## The realistic causes
|
||||
|
||||
**The proxy address or port is wrong, or the proxy is down.** The most literal
|
||||
reading of the error: nothing is listening where the client tried to connect.
|
||||
Confirm host, port and that the proxy process is actually running and reachable from
|
||||
the network the browser is on.
|
||||
|
||||
**The proxy's own hostname will not resolve.** Chromium's own definition names DNS
|
||||
resolution of the proxy's name as one of the two failure paths this code covers. If
|
||||
the proxy is configured by hostname rather than a bare IP, a broken or unreachable
|
||||
resolver on the machine fails before a socket to the proxy is even attempted. See
|
||||
[`net::ERR_NAME_NOT_RESOLVED` in Playwright](err-name-not-resolved-playwright.md) for
|
||||
the sibling error when it is the *destination's* name that fails instead of the
|
||||
proxy's own.
|
||||
|
||||
**A firewall blocks the specific port the proxy listens on.** Outbound rules that
|
||||
allow normal web traffic on 443 but nothing else will drop a connection attempt to
|
||||
an arbitrary proxy port silently, from the client's perspective indistinguishable
|
||||
from the proxy being offline.
|
||||
|
||||
**Playwright's own `server: "per-context"` proxy mode misconfigured.** A concrete,
|
||||
real bug: [microsoft/playwright#9437](https://github.com/microsoft/playwright/issues/9437)
|
||||
reports launching the browser with `proxy={"server": "per-context"}` and then
|
||||
creating a `browser.new_context()` with no proxy object supplied, expecting the
|
||||
context to simply have no proxy. Instead, navigation throws
|
||||
`net::ERR_PROXY_CONNECTION_FAILED`, because the browser was told a proxy would be
|
||||
supplied per context and none was, leaving it trying to route through a proxy
|
||||
configuration that does not resolve to anything real.
|
||||
|
||||
**A VPN or system-level proxy setting introduced an incompatible PAC file or
|
||||
endpoint.** Documented in the wild as a side effect of VPN client updates that
|
||||
rewrite system proxy configuration: Chromium picks up a PAC-resolved proxy endpoint
|
||||
the VPN update introduced, and that endpoint is not actually reachable.
|
||||
|
||||
## What Firefox calls the same failure
|
||||
|
||||
`invisible_playwright` drives a patched Firefox rather than Chromium, and Firefox's
|
||||
own networking layer does not use the `net::ERR_*` naming at all. The same class of
|
||||
failure, an inability to reach the configured proxy, surfaces in Firefox as
|
||||
`NS_ERROR_PROXY_CONNECTION_REFUSED`, tracked directly in Mozilla's own bug tracker
|
||||
(for example, [Bugzilla 549299](https://bugzilla.mozilla.org/show_bug.cgi?id=549299),
|
||||
titled "'Proxy server refusing connections' error when SOCKS proxy merely can't
|
||||
connect," and [Bugzilla 493699](https://bugzilla.mozilla.org/show_bug.cgi?id=493699)
|
||||
for the equivalent HTTPS case). If you are chasing this failure against Firefox
|
||||
rather than a Chromium browser, search your logs for that name instead of the
|
||||
Chromium string.
|
||||
|
||||
## Diagnostic checklist
|
||||
|
||||
Test reachability to the proxy itself before Playwright is anywhere in the picture.
|
||||
|
||||
```bash
|
||||
# Confirms only that a socket can be opened to the proxy, nothing about the tunnel.
|
||||
nc -vz proxy-host proxy-port
|
||||
|
||||
# Isolates DNS resolution of the proxy's own hostname specifically.
|
||||
nslookup proxy-host
|
||||
```
|
||||
|
||||
- `nc` hangs or refuses: the proxy is unreachable from this machine, full stop.
|
||||
Confirm the host and port are current, since a rotated proxy endpoint produces
|
||||
exactly this.
|
||||
- `nslookup` fails on the proxy's own hostname: the failure is DNS, not a dead
|
||||
proxy process, and no amount of retrying the connection fixes a name that will not
|
||||
resolve.
|
||||
- Both succeed, but Playwright still throws this error: recheck the proxy
|
||||
configuration Playwright actually received, particularly a `server:
|
||||
"per-context"` launch paired with a context created without its own proxy object,
|
||||
the shape of the real bug cited above.
|
||||
- Runs fine from your own machine and fails only in a container or CI runner: test
|
||||
from inside that exact environment. A different egress path or a different, more
|
||||
restrictive firewall ruleset than your own machine's is common.
|
||||
|
||||
## The honest boundary
|
||||
|
||||
This is a network-reachability failure, resolved or not before any TLS handshake or
|
||||
JavaScript-visible browser identity is involved. `invisible_playwright` hands the
|
||||
proxy configuration straight to the patched engine; it does not open the connection
|
||||
to the proxy on your behalf, retry a dead endpoint, or make an unreachable proxy
|
||||
reachable. A stock Playwright Chromium, a stock Firefox, and this project's build
|
||||
all fail identically against a proxy that cannot be reached, because the failure
|
||||
happens before any browser-specific behavior begins.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What does net::ERR_PROXY_CONNECTION_FAILED mean?** The browser could not open a
|
||||
connection to the configured proxy server at all, either because its name would not
|
||||
resolve or because a socket to it could not be opened. No destination site is
|
||||
involved yet.
|
||||
|
||||
**How is this different from ERR_TUNNEL_CONNECTION_FAILED?** Tunnel failure means
|
||||
the proxy was reached and refused one specific HTTPS `CONNECT` request, often over
|
||||
credentials. This error means the proxy itself was never reachable in the first
|
||||
place, before any such request could be sent.
|
||||
|
||||
**Could a Playwright configuration mistake cause this rather than a real network
|
||||
problem?** Yes. A real, confirmed bug exists where a `server: "per-context"` proxy
|
||||
launch paired with a context created without its own proxy object throws exactly
|
||||
this error.
|
||||
|
||||
**What does Firefox call this instead of ERR_PROXY_CONNECTION_FAILED?**
|
||||
`NS_ERROR_PROXY_CONNECTION_REFUSED`, tracked under that name in Mozilla's own
|
||||
Bugzilla.
|
||||
|
||||
**Does invisible_playwright's stealth patching affect this error?** No. It is a
|
||||
reachability failure to the proxy itself, resolved entirely below any
|
||||
fingerprint or engine-identity layer this project touches.
|
||||
|
||||
## Sources
|
||||
|
||||
- Chromium's [`net/base/net_error_list.h`](https://chromium.googlesource.com/chromium/src/+/main/net/base/net_error_list.h),
|
||||
for the exact definitions of `ERR_PROXY_CONNECTION_FAILED` (-130) and the
|
||||
distinct `ERR_TUNNEL_CONNECTION_FAILED` (-111), retrieved 2026-08-30.
|
||||
- [microsoft/playwright#9437](https://github.com/microsoft/playwright/issues/9437),
|
||||
a real report of this exact error from a `server: "per-context"` proxy launch
|
||||
paired with a context created with no proxy object.
|
||||
- Mozilla Bugzilla [549299](https://bugzilla.mozilla.org/show_bug.cgi?id=549299) and
|
||||
[493699](https://bugzilla.mozilla.org/show_bug.cgi?id=493699), for
|
||||
`NS_ERROR_PROXY_CONNECTION_REFUSED`, the Firefox-side name for the same class of
|
||||
failure.
|
||||
- Chromium developer discussion groups on
|
||||
[ERR_PROXY_CONNECTION_FAILED](https://groups.google.com/a/chromium.org/g/chromium-discuss/c/NDmGCxeGSSk),
|
||||
for real-world reports of the error's causes outside of Playwright specifically.
|
||||
|
||||
**See also:** [ERR_TUNNEL_CONNECTION_FAILED in Playwright](err-tunnel-connection-failed-playwright.md)
|
||||
for the later, tunnel-specific failure this page is most often confused with,
|
||||
[ERR_SOCKS_CONNECTION_FAILED in Playwright](err-socks-connection-failed-playwright.md)
|
||||
for the equivalent failure on a SOCKS5 proxy instead of an HTTP one, and
|
||||
[ERR_NAME_NOT_RESOLVED in Playwright](err-name-not-resolved-playwright.md) for when
|
||||
it is the destination's name, not the proxy's, that fails to resolve.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. The proxy address is handed straight to the
|
||||
engine; failing to reach it is the network answering before the browser's identity
|
||||
layer is ever involved.*
|
||||
@@ -0,0 +1,179 @@
|
||||
---
|
||||
title: "ERR_SOCKS_CONNECTION_FAILED in Playwright: what it means and how to fix it"
|
||||
description: "net::ERR_SOCKS_CONNECTION_FAILED is the browser's SOCKS5 handshake to your proxy failing, not the same failure as an HTTP CONNECT tunnel. The real causes and a checklist to isolate which one you have."
|
||||
parent: "Network, Proxy and WebRTC"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 30
|
||||
---
|
||||
|
||||
|
||||
# ERR_SOCKS_CONNECTION_FAILED in Playwright: what it means and how to fix it
|
||||
|
||||
`net::ERR_SOCKS_CONNECTION_FAILED` means the browser tried to speak the SOCKS5
|
||||
handshake to your configured proxy and it did not complete. `page.goto()` throws it
|
||||
before any request to the destination site exists, because the failure happens one
|
||||
layer below HTTP, in the connection to the proxy itself. This page covers the specific
|
||||
causes, in the order worth checking them, and how it differs from the adjacent tunnel
|
||||
error.
|
||||
|
||||
## What the string actually says
|
||||
|
||||
The string comes from Chromium's network stack. Its own source defines error `-120`,
|
||||
`ERR_SOCKS_CONNECTION_FAILED`, as "failed establishing a connection to the SOCKS proxy
|
||||
server for a target host." The adjacent code, `-121`,
|
||||
`ERR_SOCKS_CONNECTION_HOST_UNREACHABLE`, is a distinct, later failure: the SOCKS
|
||||
handshake succeeded and the proxy reported the destination, not itself, unreachable.
|
||||
`ERR_SOCKS_CONNECTION_FAILED` covers everything that goes wrong before or during the
|
||||
handshake: a refused connection request, rejected authentication, or an unrecognized
|
||||
version.
|
||||
|
||||
It is also not the same problem as
|
||||
[ERR_TUNNEL_CONNECTION_FAILED](err-tunnel-connection-failed-playwright.md), which is an
|
||||
HTTP CONNECT exchange with an `http://` proxy going wrong. This is a SOCKS5 handshake
|
||||
with a `socks5://` proxy going wrong, a different protocol with a different set of
|
||||
causes.
|
||||
|
||||
## Where this shows up against Playwright
|
||||
|
||||
The pattern repeats across real reports: a SOCKS5 proxy passed to `page.goto()` throws
|
||||
this string instead of loading anything.
|
||||
[microsoft/playwright#19661](https://github.com/microsoft/playwright/issues/19661)
|
||||
reports it from `browserServer` plus `page.goto` against a SOCKS5 endpoint, and
|
||||
[puppeteer/puppeteer#10788](https://github.com/puppeteer/puppeteer/issues/10788) shows
|
||||
the same string from a different Chromium-driving tool, with authentication attempted
|
||||
through `page.authenticate()`, the call for HTTP Basic auth, not a SOCKS5 credential
|
||||
path.
|
||||
[Playwright has the identical gap](playwright-socks5-proxy-authentication.md) on its
|
||||
own `proxy` option, but the two failures look nothing alike: a dropped SOCKS5
|
||||
credential there is silent, and the page loads from the wrong address with no
|
||||
exception. Here the proxy rejects the connection outright, before any page exists. Not
|
||||
every report even has a real proxy behind it: a misrouted local debugger setting can
|
||||
throw the same string with no SOCKS5 server involved.
|
||||
|
||||
## The realistic causes
|
||||
|
||||
**The SOCKS server is unreachable.** Wrong host, wrong port, the exit rotated, or a
|
||||
firewall between the machine and that port. This shows up as working one day and gone
|
||||
the next, with nothing in the code changed.
|
||||
|
||||
**Authentication negotiation failed.** SOCKS5's handshake starts with the client
|
||||
offering authentication methods and the server picking one;
|
||||
[RFC 1928](https://datatracker.ietf.org/doc/html/rfc1928) defines `X'FF'` as the
|
||||
server's answer when none are acceptable, closing the connection right there. A
|
||||
username and password are a separate sub-negotiation in
|
||||
[RFC 1929](https://datatracker.ietf.org/doc/html/rfc1929), and wrong credentials fail
|
||||
it just as hard. Neither produces a 401 or 407; there is no HTTP yet for either code to
|
||||
exist.
|
||||
|
||||
**The wrong SOCKS version.** SOCKS4 and SOCKS5 are different protocols on the wire, not
|
||||
a version flag inside one. A proxy provisioned for SOCKS4 or SOCKS4a does not
|
||||
understand a SOCKS5 greeting, and the reverse fails too. The
|
||||
[Firefox SOCKS5 auth page](playwright-socks5-proxy-authentication.md) covers the
|
||||
`network.proxy.socks_version` preference this project sets to `5`.
|
||||
|
||||
**An HTTP-only proxy handed a `socks5://` URL.** A server that only speaks HTTP CONNECT
|
||||
does not parse SOCKS5's binary greeting as anything meaningful, and hangs, resets, or
|
||||
answers with bytes that are not a valid SOCKS5 reply. See
|
||||
[SOCKS5 vs HTTP proxy: what each does in the browser](socks5-vs-http-proxy-browser.md)
|
||||
for why the two schemes take entirely different code paths.
|
||||
|
||||
**A DNS resolution mismatch at the handshake step.** A SOCKS5 connection request names
|
||||
its destination as one of three address types in RFC 1928: IPv4, a domain name, or
|
||||
IPv6. Resolve locally and send a raw IP where the exit expects a domain name, and the
|
||||
proxy can answer with reply code `0x08`, "address type not supported", landing in this
|
||||
error rather than as a quieter DNS leak.
|
||||
|
||||
## What this looks like on this project's engine
|
||||
|
||||
This project drives a patched Firefox, which does not print Chromium's `net::ERR_*`
|
||||
strings. Its own SOCKS5 layer, `nsSOCKSIOLayer.cpp` in Mozilla's source tree, maps the
|
||||
same RFC 1928 reply codes onto NSPR errors instead: general failure, ruleset rejection,
|
||||
connection refused, and an unsupported command all become `PR_CONNECT_REFUSED_ERROR`;
|
||||
network unreachable becomes `PR_NETWORK_UNREACHABLE_ERROR`; host unreachable and an
|
||||
unsupported address type both become `PR_BAD_ADDRESS_ERROR`; and the `X'FF'`
|
||||
no-acceptable-method case also becomes `PR_CONNECT_REFUSED_ERROR`. Same protocol, same
|
||||
failure conditions, different name on the way out. If you are running this project's
|
||||
Firefox rather than a Chromium browser, the causes above still apply; only the label on
|
||||
the failure differs.
|
||||
|
||||
## Diagnostic checklist
|
||||
|
||||
Isolate the proxy with `curl` before Playwright is anywhere in the picture, since it
|
||||
prints the handshake outcome instead of collapsing it into one exception name.
|
||||
|
||||
```bash
|
||||
curl -v --socks5 user:pass@proxy-host:proxy-port https://example.com
|
||||
curl -v --socks5-hostname user:pass@proxy-host:proxy-port https://example.com
|
||||
```
|
||||
|
||||
- Connection refused or a timeout: the proxy is unreachable from this machine. Confirm
|
||||
host, port, and that nothing rotated recently.
|
||||
- An authentication failure or a stall after the greeting: credentials or the offered
|
||||
method are wrong, not reachability.
|
||||
- `--socks5` fails but `--socks5-hostname` succeeds, or the reverse: the address-type
|
||||
mismatch above, and Playwright's proxy handling needs the matching DNS mode.
|
||||
- `curl -x http://proxy-host:proxy-port https://example.com` succeeds where every
|
||||
SOCKS5 attempt fails: the endpoint is an HTTP proxy, whatever the provider called it.
|
||||
|
||||
## The honest boundary
|
||||
|
||||
This is a proxy and network-layer failure. It happens before the browser's fingerprint
|
||||
surface is involved, so no amount of identity work reaches it. A correctly
|
||||
authenticated SOCKS5 handshake looks identical whether the browser behind it is stock
|
||||
Playwright, stock Firefox, or this project's build; the proxy is the party answering,
|
||||
not the browser asking.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What does ERR_SOCKS_CONNECTION_FAILED mean?** The browser's SOCKS5 handshake to your
|
||||
configured proxy did not complete, thrown before any request to the destination site
|
||||
exists.
|
||||
|
||||
**Is this the same as ERR_TUNNEL_CONNECTION_FAILED?** No. That one is an HTTP CONNECT
|
||||
tunnel through an `http://` proxy failing; this is a SOCKS5 handshake through a
|
||||
`socks5://` proxy failing.
|
||||
|
||||
**Why does my SOCKS5 proxy work in curl but fail in Playwright?** Compare `--socks5`
|
||||
against `--socks5-hostname`. A difference means a DNS-mode or address-type mismatch,
|
||||
and Playwright's configuration needs to match what the exit expects.
|
||||
|
||||
**Does this happen with Firefox, or only Chromium browsers?** The exact string is
|
||||
Chromium's. A patched Firefox reports the same handshake failure as an NSPR error such
|
||||
as `PR_CONNECT_REFUSED_ERROR`. The causes are identical; only the label differs.
|
||||
|
||||
**Can bad SOCKS5 credentials cause this?** Yes, loudly, if the server rejects the
|
||||
method or the credentials during the handshake. A silently dropped credential is a
|
||||
different, quieter problem covered on the
|
||||
[SOCKS5 authentication page](playwright-socks5-proxy-authentication.md).
|
||||
|
||||
## Sources
|
||||
|
||||
- Chromium's [`net/base/net_error_list.h`](https://github.com/chromium/chromium/blob/main/net/base/net_error_list.h),
|
||||
for `ERR_SOCKS_CONNECTION_FAILED` (-120) and `ERR_SOCKS_CONNECTION_HOST_UNREACHABLE`
|
||||
(-121), retrieved 2026-08-30.
|
||||
- [RFC 1928, SOCKS Protocol Version 5](https://datatracker.ietf.org/doc/html/rfc1928),
|
||||
for the `X'FF'` response, reply codes `0x01`-`0x08`, and the three address types.
|
||||
- [RFC 1929, Username/Password Authentication for SOCKS V5](https://datatracker.ietf.org/doc/html/rfc1929),
|
||||
for the credential sub-negotiation.
|
||||
- [microsoft/playwright#19661](https://github.com/microsoft/playwright/issues/19661)
|
||||
and [microsoft/playwright#21762](https://github.com/microsoft/playwright/issues/21762),
|
||||
two real reports of this string, one against a real SOCKS5 endpoint, one from a
|
||||
misrouted local debugger proxy.
|
||||
- [puppeteer/puppeteer#10788](https://github.com/puppeteer/puppeteer/issues/10788), the
|
||||
same string with authentication attempted through `page.authenticate()`.
|
||||
- [FlareSolverr/FlareSolverr#1394](https://github.com/FlareSolverr/FlareSolverr/issues/1394),
|
||||
a SOCKS5 proxy that worked and then stopped after a restart.
|
||||
- Mozilla's [`nsSOCKSIOLayer.cpp`](https://hg.mozilla.org/mozilla-central/file/tip/netwerk/socket/nsSOCKSIOLayer.cpp),
|
||||
for the SOCKS5-to-NSPR error mapping this project's engine performs, retrieved
|
||||
2026-08-30.
|
||||
|
||||
**See also:** [ERR_TUNNEL_CONNECTION_FAILED in Playwright](err-tunnel-connection-failed-playwright.md),
|
||||
[SOCKS5 proxy authentication in Playwright](playwright-socks5-proxy-authentication.md),
|
||||
and [SOCKS5 vs HTTP proxy: what each does in the browser](socks5-vs-http-proxy-browser.md).
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. The proxy is handed straight to the engine's own
|
||||
SOCKS5 handling; a refused handshake is the proxy answering, not the browser failing to
|
||||
look real.*
|
||||
@@ -0,0 +1,171 @@
|
||||
---
|
||||
title: "net::ERR_SSL_PROTOCOL_ERROR in Playwright"
|
||||
description: "net::ERR_SSL_PROTOCOL_ERROR means the TLS handshake itself broke, before any certificate was evaluated. Why ignoreHTTPSErrors does not fix it, and the HSTS and MITM-proxy causes that actually do."
|
||||
parent: "Testing and Troubleshooting"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 14
|
||||
---
|
||||
|
||||
|
||||
# net::ERR_SSL_PROTOCOL_ERROR in Playwright
|
||||
|
||||
`net::ERR_SSL_PROTOCOL_ERROR` means the TLS handshake itself failed at the protocol
|
||||
level, before the browser ever got to the step of evaluating whether a certificate is
|
||||
trustworthy. Chromium's own network error list defines it in five words, code -107, "An
|
||||
SSL protocol error occurred." `page.goto()` throws it when the handshake cannot complete
|
||||
at all: a cipher suite neither side will agree on, a TLS version mismatch, or bytes on
|
||||
the wire that do not parse as a valid handshake message in the first place.
|
||||
|
||||
That distinction, handshake-level versus certificate-level, is the one thing worth
|
||||
getting right before doing anything else, because the two failures look similar and the
|
||||
usual fix for one does nothing for the other.
|
||||
|
||||
## Not the same failure as a certificate trust problem
|
||||
|
||||
[`ERR_CERT_AUTHORITY_INVALID`](err-cert-authority-invalid-playwright.md) means the
|
||||
handshake completed, a certificate arrived, and the browser decided not to trust who
|
||||
signed it. `ERR_SSL_PROTOCOL_ERROR` means the handshake never got that far: there is no
|
||||
certificate to evaluate trust on yet, because the negotiation that would deliver one
|
||||
broke first.
|
||||
|
||||
This matters concretely because of what does and does not fix each one.
|
||||
`ignoreHTTPSErrors`, Playwright's documented lever for accepting an untrusted
|
||||
certificate, [operates entirely on certificate-chain and hostname validation](err-cert-authority-invalid-playwright.md#what-ignorehttpserrors-actually-disables-and-the-tradeoff).
|
||||
It has nothing to disable when the handshake itself is what is broken. [A real
|
||||
report](https://github.com/microsoft/playwright/issues/23771) shows exactly this: `net::ERR_SSL_PROTOCOL_ERROR`
|
||||
against a local HTTPS server, with `ignoreHTTPSErrors: true` already set and changing
|
||||
nothing. That is not a bug in the option; it is the option correctly having no bearing
|
||||
on a failure that happens a step earlier than anything it controls.
|
||||
|
||||
## The realistic causes
|
||||
|
||||
**A cipher suite or TLS version neither side supports.** The client offers a set of
|
||||
ciphers and protocol versions in its ClientHello; if the server's own configuration has
|
||||
no overlap with what was offered, at whatever versions each side is willing to speak,
|
||||
the handshake fails outright instead of falling back gracefully. This is common on
|
||||
older or misconfigured servers, and on modern servers being reached by an outdated or
|
||||
deliberately restricted client.
|
||||
|
||||
**A middlebox performing TLS interception badly.** Corporate SSL-inspection appliances,
|
||||
some antivirus products, and some proxies terminate the original TLS connection and open
|
||||
a new one to the destination, presenting their own certificate to the client. Done
|
||||
correctly the result is a certificate trust question, `ERR_CERT_AUTHORITY_INVALID`'s
|
||||
territory. Done badly, commonly a middlebox that does not support a TLS version or
|
||||
extension the real destination uses, the re-negotiated handshake can break outright
|
||||
instead. Cloudflare's own troubleshooting documentation for this exact error names
|
||||
"ISP/network interference (DPI, SSL interception proxies, content filters, CGNAT)"
|
||||
directly among its causes, alongside "TLS 1.3 support issues with middleboxes."
|
||||
|
||||
**A stale HSTS entry pinning the browser to HTTPS after the server's TLS configuration
|
||||
changed underneath it.** HTTP Strict Transport Security tells a browser to remember that a
|
||||
domain must never be reached over plain HTTP again. That memory has no opinion on whether
|
||||
the HTTPS side is currently healthy; it only removes the fallback option. A certificate
|
||||
rotation or server migration that leaves HTTPS broken for that host reports the protocol
|
||||
failure directly, with no fallback the way a browser without that memory could still
|
||||
reach.
|
||||
|
||||
**A port or scheme mismatch.** Requesting `https://` against a port actually serving
|
||||
plain HTTP, or the reverse, produces bytes that do not parse as the protocol either side
|
||||
expected, which surfaces as a protocol-level failure, not a clean rejection.
|
||||
|
||||
**HTTP/3 or QUIC negotiation failing where HTTP/2 or HTTP/1.1 would have worked.**
|
||||
Cloudflare's own documentation names HTTP/3 incompatibility as a distinct cause
|
||||
alongside the cipher and TLS-version cases above, worth testing for independently by
|
||||
forcing an older protocol.
|
||||
|
||||
## Diagnostic checklist
|
||||
|
||||
1. **Reproduce with `openssl s_client -connect host:443`.** This performs the raw
|
||||
handshake outside any browser entirely; a failure here confirms the problem is the
|
||||
server or the network path, not Playwright or the engine driving it.
|
||||
2. **Test with any middlebox removed from the path.** Corporate network, VPN, or
|
||||
antivirus SSL inspection removed and the handshake completes: the interception layer
|
||||
is implicated. Persists with all of those removed: the server's own TLS configuration
|
||||
is the more likely cause.
|
||||
3. **Force specific TLS versions with curl as a diagnostic.** `curl -v --tlsv1.2
|
||||
--tlsv1.3` against the same host isolates a version-specific incompatibility.
|
||||
4. **Check for a stale HSTS entry if the domain used to work over HTTPS and no longer
|
||||
does.** Chromium exposes `chrome://net-internals/#hsts` to inspect and delete a
|
||||
domain's stored HSTS state directly.
|
||||
5. **Do not reach for `ignoreHTTPSErrors` first.** It has no effect on a handshake that
|
||||
never produced a certificate to evaluate; testing it and seeing no change, the way
|
||||
the real report above did, is itself useful confirmation the failure is
|
||||
protocol-level, not trust-level.
|
||||
|
||||
## What Firefox reports instead
|
||||
|
||||
`invisible_playwright` drives a patched Firefox, and Firefox does not collapse
|
||||
handshake failures into one Chromium-style code. Its TLS stack is NSS, and NSS reports
|
||||
handshake problems through its own family of named errors, `SSL_ERROR_*` for
|
||||
protocol-level failures such as an unsupported version or no overlapping cipher, and
|
||||
`SEC_ERROR_*` for the certificate-trust side that `ERR_CERT_AUTHORITY_INVALID` covers on
|
||||
Chromium. A middlebox terminating and mis-re-negotiating TLS in front of Firefox commonly
|
||||
surfaces as `PR_CONNECT_RESET_ERROR` at the NSPR layer, the connection torn down mid
|
||||
handshake, rather than a named SSL error at all. A related, narrower Firefox-specific
|
||||
case is already documented on [the ERR_HTTP2_PROTOCOL_ERROR page](err-http2-protocol-error-playwright.md#what-the-string-is-and-which-browser-actually-says-it):
|
||||
`NS_ERROR_NET_INADEQUATE_SECURITY`, thrown specifically when a server negotiates HTTP/2
|
||||
over a cipher suite HTTP/2 itself blacklists, which is a protocol-level TLS failure with
|
||||
its own distinct name rather than a generic one. If you are chasing this failure against
|
||||
Firefox rather than Chromium, search logs for the `SSL_ERROR_` and `SEC_ERROR_` families
|
||||
and for `PR_CONNECT_RESET_ERROR`, not for the Chromium string itself.
|
||||
|
||||
## The honest boundary
|
||||
|
||||
A broken TLS handshake is negotiated between the client's TLS library and the server,
|
||||
below any layer a browser's JavaScript-visible identity touches. `invisible_playwright`
|
||||
leaves the TLS stack untouched specifically so the handshake reads as a genuine Firefox
|
||||
handshake rather than an approximation, which is the entire subject of [why a TLS
|
||||
fingerprint cannot be patched](ja3-ja4-tls-fingerprint.md). It does not retry a broken
|
||||
negotiation, work around a middlebox's bad re-encryption, or clear a stale HSTS entry on
|
||||
your behalf. A stock Playwright browser, a stock Firefox, and this project's build all
|
||||
fail an incompatible handshake identically, because nothing about a cleaner fingerprint
|
||||
changes what a TLS library can negotiate with a server it fundamentally cannot agree
|
||||
with.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What does net::ERR_SSL_PROTOCOL_ERROR mean?** The TLS handshake itself failed, a
|
||||
cipher or version mismatch or malformed handshake data, before any certificate was ever
|
||||
evaluated for trust.
|
||||
|
||||
**Does ignoreHTTPSErrors fix this?** No, and a real report confirms it: the option
|
||||
disables certificate-chain validation, which never runs if the handshake producing a
|
||||
certificate never completed in the first place.
|
||||
|
||||
**How is this different from ERR_CERT_AUTHORITY_INVALID?** That error means a
|
||||
certificate arrived and was not trusted. This error means the handshake broke before any
|
||||
certificate arrived at all. They have different causes and different fixes.
|
||||
|
||||
**Can a stale HSTS entry really cause this?** Yes. HSTS removes the option to fall back
|
||||
to plain HTTP for a domain; if that domain's HTTPS configuration later breaks, the
|
||||
browser has no fallback left and reports the protocol failure directly.
|
||||
|
||||
**What does Firefox call this instead of ERR_SSL_PROTOCOL_ERROR?** Firefox's NSS stack
|
||||
reports handshake failures through its own `SSL_ERROR_*` family rather than one generic
|
||||
code, and a middlebox tearing down the connection mid-handshake commonly surfaces as
|
||||
`PR_CONNECT_RESET_ERROR` instead of a named SSL error at all.
|
||||
|
||||
## Sources
|
||||
|
||||
- Chromium's [`net/base/net_error_list.h`](https://chromium.googlesource.com/chromium/src/+/main/net/base/net_error_list.h),
|
||||
for `ERR_SSL_PROTOCOL_ERROR` (-107), retrieved 2026-08-30.
|
||||
- Cloudflare's own [Troubleshoot ERR_SSL_PROTOCOL_ERROR](https://developers.cloudflare.com/ssl/troubleshooting/err-ssl-protocol-error/)
|
||||
documentation, for the named causes including SSL-interception proxies, TLS 1.3
|
||||
middlebox incompatibility, and HTTP/3 negotiation failures, retrieved 2026-08-30.
|
||||
- [microsoft/playwright#23771](https://github.com/microsoft/playwright/issues/23771),
|
||||
a real report of `net::ERR_SSL_PROTOCOL_ERROR` against a local HTTPS server with
|
||||
`ignoreHTTPSErrors: true` already set and having no effect.
|
||||
|
||||
**See also:** [ERR_CERT_AUTHORITY_INVALID in Playwright](err-cert-authority-invalid-playwright.md)
|
||||
for the certificate-trust failure this page is most often confused with, [JA3 and JA4:
|
||||
why a TLS fingerprint cannot be patched](ja3-ja4-tls-fingerprint.md) for the handshake
|
||||
layer this error occurs inside of, and [ERR_HTTP2_PROTOCOL_ERROR in Playwright](err-http2-protocol-error-playwright.md)
|
||||
for the related, narrower Firefox-specific TLS-cipher failure this page's Firefox section
|
||||
draws on.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. The TLS stack is untouched on purpose; a broken
|
||||
handshake is the network or the server, not something a fingerprint patch could reach
|
||||
either way.*
|
||||
@@ -0,0 +1,177 @@
|
||||
---
|
||||
title: "ERR_TUNNEL_CONNECTION_FAILED in Playwright: what it means and how to fix it"
|
||||
description: "net::ERR_TUNNEL_CONNECTION_FAILED is the browser failing to open an HTTP CONNECT tunnel through your proxy. The real causes, ruled out one by one, and the curl test that isolates them before Playwright is even involved."
|
||||
parent: "Network, Proxy and WebRTC"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 29
|
||||
---
|
||||
|
||||
|
||||
# ERR_TUNNEL_CONNECTION_FAILED in Playwright: what it means and how to fix it
|
||||
|
||||
`net::ERR_TUNNEL_CONNECTION_FAILED` means the browser tried to open an HTTP CONNECT
|
||||
tunnel through your proxy for an HTTPS destination, and the proxy would not complete
|
||||
it. `page.goto()` throws it, the navigation never gets a response, and the error tells
|
||||
you almost nothing about which of the several things that can go wrong actually did.
|
||||
This page is that list, and how to tell them apart before you touch Playwright at all.
|
||||
|
||||
## What "tunnel" actually refers to
|
||||
|
||||
For plain HTTP, a proxy can just forward the request. For HTTPS, the browser needs an
|
||||
end-to-end encrypted connection to the destination, so it asks the proxy to open a raw
|
||||
TCP tunnel first: an `HTTP CONNECT host:443` request, answered with `200 Connection
|
||||
established` if the proxy agrees. Only then does the actual TLS handshake happen,
|
||||
inside that tunnel. `ERR_TUNNEL_CONNECTION_FAILED` fires when the CONNECT exchange
|
||||
itself fails, before any TLS or HTTP traffic to the destination exists.
|
||||
|
||||
Chromium's own error list defines it plainly: "a tunnel connection through the
|
||||
proxy could not be established." (The name is Chromium's; Firefox's network
|
||||
stack spells the same family of failures as `NS_ERROR_*` codes, and this page
|
||||
uses the Chromium name because it is the one people search for.) The adjacent code, `ERR_PROXY_CONNECTION_FAILED`, is earlier and
|
||||
different: it means the browser could not even open a TCP connection to the proxy
|
||||
itself. `ERR_TUNNEL_CONNECTION_FAILED` means the browser did reach the proxy, and the
|
||||
CONNECT for this specific destination is what failed. That distinction rules out "the
|
||||
proxy is completely dead" as the cause before you look any further.
|
||||
|
||||
## The realistic causes, in the order to check them
|
||||
|
||||
**Wrong or expired proxy credentials.** An HTTP proxy that requires authentication
|
||||
answers the CONNECT with `407 Proxy Authentication Required`, not `401`, which is the
|
||||
origin server's code, not the proxy's. If the client retries with bad credentials or
|
||||
does not retry at all, the tunnel never completes and the browser surfaces
|
||||
`ERR_TUNNEL_CONNECTION_FAILED` instead of forwarding the 407 to your code. A
|
||||
[changedetection.io issue](https://github.com/dgtlmoon/changedetection.io/issues/2173)
|
||||
shows exactly this pair in the same log: a 407, then the tunnel error immediately
|
||||
after.
|
||||
|
||||
**The proxy is refusing connections from this specific machine.** Not dead in general,
|
||||
refusing this caller: an IP allowlist that does not cover the machine's current egress
|
||||
address is a common version of this, and it explains a proxy that works from a laptop
|
||||
and fails from a container or a CI runner with a different outbound IP. A
|
||||
[Playwright issue](https://github.com/microsoft/playwright/issues/34252) reports
|
||||
exactly that shape: identical proxy config, working on Windows locally, failing with
|
||||
this error from inside a Kubernetes pod.
|
||||
|
||||
**The proxy does not tunnel the target port.** Many proxy servers only allow CONNECT on
|
||||
a small set of ports, 443 chief among them, and reject anything outside that list
|
||||
outright. Worth ruling out first if the destination is on a non-standard port.
|
||||
|
||||
**A scheme or transport mismatch in how the proxy is configured.** An
|
||||
[Apify Crawlee issue](https://github.com/apify/crawlee/issues/3369) traced a tunnel
|
||||
failure to how a browser pool built the proxy URL for an HTTPS proxy versus how
|
||||
Playwright's own direct launch built it: same credentials, same host, different wiring,
|
||||
one worked and one did not. The exact string the proxy option receives matters more
|
||||
than it looks like it should.
|
||||
|
||||
**A firewall between the machine and the proxy's port.** Outbound rules that allow 443
|
||||
to the open internet but block an arbitrary proxy port are easy to miss, especially
|
||||
after a rotated port.
|
||||
|
||||
## How this meets Playwright's proxy option
|
||||
|
||||
Playwright's `proxy` argument (`server`, `username`, `password`) is handed to the
|
||||
browser at launch, and for an `http://` or `https://` proxy server, the browser owns
|
||||
the whole CONNECT exchange, credentials included. That is a real, documented
|
||||
authentication path, unlike SOCKS5: see
|
||||
[Playwright's proxy credentials failing silently instead of loudly](playwright-socks5-proxy-authentication.md)
|
||||
for that different, quieter failure. A SOCKS5 proxy with a username and password drops
|
||||
the credentials with no error at all, and the page loads from the wrong address or not
|
||||
at all. An HTTP or HTTPS proxy with bad credentials throws this exact exception,
|
||||
loudly, at `page.goto()`. Seeing `ERR_TUNNEL_CONNECTION_FAILED` already tells you the
|
||||
credentials were sent and read; the question is why the far end rejected the exchange,
|
||||
not whether it received one.
|
||||
|
||||
## The diagnostic checklist
|
||||
|
||||
Test the proxy before Playwright is anywhere in the picture. `curl` speaks the same
|
||||
CONNECT method the browser does, and prints the exchange instead of hiding it behind
|
||||
one exception name.
|
||||
|
||||
```bash
|
||||
# Same host, port and credentials you pass to Playwright's proxy option.
|
||||
curl -v -x http://username:password@proxy-host:proxy-port https://example.com
|
||||
```
|
||||
|
||||
Read the `-v` output for the `CONNECT` line and the status that follows it:
|
||||
|
||||
- `407` on the CONNECT: credentials are wrong or expired. Confirm the exact strings
|
||||
going into Playwright's `proxy` dict match what the provider issued, and that
|
||||
nothing else in your code is also setting a proxy and overriding it.
|
||||
- Connection refused or a hang with no response: the proxy is unreachable from this
|
||||
machine, or a firewall is dropping the port. Run the same `curl` from inside the
|
||||
actual environment that will run the browser, since a container or a CI runner can
|
||||
have a different egress path than the machine you are typing the command on.
|
||||
- Curl succeeds and the page loads: the proxy and credentials are fine, and the
|
||||
failure is specific to Playwright's launch configuration. Recheck the `server`
|
||||
string for a scheme mismatch, `http://` versus `https://`, or credentials embedded
|
||||
in the URL alongside separate `username`/`password` fields, the exact shape the
|
||||
Crawlee issue above traced its failure to.
|
||||
- Curl works on 443 but the real target sits on a different port: test that port
|
||||
specifically, since some proxies tunnel 443 only.
|
||||
|
||||
## The honest boundary
|
||||
|
||||
This is a proxy and network-layer failure, not a fingerprint problem, and no amount of
|
||||
browser-identity work touches it. `invisible_playwright` passes the proxy option
|
||||
straight through to the patched Firefox engine; it does not open the CONNECT tunnel
|
||||
itself, retry it, or paper over a rejection. A stock Playwright browser, a stock
|
||||
Firefox, and this project's binary all fail the same CONNECT the same way, because the
|
||||
proxy is what says no, not the browser driving it. If curl outside Playwright also
|
||||
fails against the same proxy, that confirms it.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What does ERR_TUNNEL_CONNECTION_FAILED mean in Playwright?** The browser sent an HTTP
|
||||
CONNECT to your proxy for an HTTPS destination and the proxy did not complete it. The
|
||||
cause is almost always credentials, reachability, or a port the proxy will not tunnel,
|
||||
not a Playwright defect.
|
||||
|
||||
**Is this a bug in Playwright or in this project's Firefox build?** No. It is a
|
||||
network-layer response from the proxy, reproducible with plain `curl` and no browser
|
||||
involved at all.
|
||||
|
||||
**Why does it work on my laptop and fail in Docker or CI?** The egress IP is usually
|
||||
different, and some proxies allowlist by IP. Run the `curl -x` test from inside the
|
||||
container or runner, not from your own machine, before assuming the code changed.
|
||||
|
||||
**How do I tell a credentials problem from a dead proxy?** Read the CONNECT status in
|
||||
`curl -v`. A `407` is credentials; a refused connection or a timeout with no response
|
||||
is reachability, not authentication.
|
||||
|
||||
**Does this ever relate to SOCKS5 instead of HTTP proxies?** The failure mode there is
|
||||
different: SOCKS5 credentials that Playwright cannot carry are dropped silently with no
|
||||
exception. See
|
||||
[Playwright SOCKS5 proxy with authentication](playwright-socks5-proxy-authentication.md)
|
||||
for that separate, quieter failure.
|
||||
|
||||
**Can a stealth or antidetect browser fix ERR_TUNNEL_CONNECTION_FAILED?** No, and treat
|
||||
a claim that it can as a sign the claim is not honest. The tunnel is negotiated between
|
||||
the browser's network stack and the proxy, before any fingerprint surface is involved.
|
||||
|
||||
## Sources
|
||||
|
||||
- Chromium's own network error list,
|
||||
[`net/base/net_error_list.h`](https://github.com/chromium/chromium/blob/main/net/base/net_error_list.h),
|
||||
for the exact definitions of `ERR_TUNNEL_CONNECTION_FAILED` and the adjacent, earlier
|
||||
`ERR_PROXY_CONNECTION_FAILED`, retrieved 2026-08-30.
|
||||
- [microsoft/playwright#34252](https://github.com/microsoft/playwright/issues/34252),
|
||||
the same proxy configuration working from a local machine and failing from inside a
|
||||
container, with a `407` visible in the log.
|
||||
- [apify/crawlee#3369](https://github.com/apify/crawlee/issues/3369), an HTTPS proxy
|
||||
tunnel failing through a browser pool while the identical credentials worked through
|
||||
a direct Playwright launch, traced to how the proxy URL was built.
|
||||
- [dgtlmoon/changedetection.io#2173](https://github.com/dgtlmoon/changedetection.io/issues/2173),
|
||||
a `407 Proxy Authentication Required` followed immediately by
|
||||
`net::ERR_TUNNEL_CONNECTION_FAILED` in the same Playwright session.
|
||||
|
||||
**See also:** [Playwright SOCKS5 proxy with authentication](playwright-socks5-proxy-authentication.md)
|
||||
for the separate, silent failure mode on the SOCKS5 path, [SOCKS5 vs HTTP proxy: what
|
||||
each does in the browser](socks5-vs-http-proxy-browser.md) for why the two transports
|
||||
fail so differently, and [web scraping keeps getting blocked with good proxies](web-scraping-getting-blocked-proxies.md)
|
||||
for what a working proxy still does not fix.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. The proxy is passed straight through; a failed
|
||||
CONNECT tunnel is the network answering, not the browser.*
|
||||
@@ -0,0 +1,74 @@
|
||||
---
|
||||
title: "F5 Distributed Cloud Bot Defense (Shape), Explained"
|
||||
description: "The Shape Security engine F5 bought in 2020 for about a billion dollars, read from F5's own documentation: JavaScript and mobile-SDK telemetry, transaction headers, and mitigation that only kicks in once evaluation finishes server-side."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 29
|
||||
---
|
||||
|
||||
|
||||
# F5 Distributed Cloud Bot Defense (Shape), Explained
|
||||
|
||||
F5 Distributed Cloud Bot Defense is not a product F5 built. It is Shape Security, a company F5 acquired in January 2020 for roughly a billion dollars, its single largest acquisition at the time, folded into F5's platform and renamed twice since (Shape Enterprise Defense, then Shape Integrated Bot Defense, now F5 Distributed Cloud Bot Defense). The mechanism underneath is the one Shape built for years of retail, banking and airline traffic before the acquisition.
|
||||
|
||||
This page is built from F5's own product and technical documentation, retrieved 2026-08-30. F5's public docs describe the pipeline in operational terms without publishing the internal scoring model, and this page says so wherever that ceiling applies.
|
||||
|
||||
## What it collects, and how it gets to the request
|
||||
|
||||
F5's documentation is direct about the two collection paths: "JavaScript to collect telemetry from client browsers and a native Mobile SDK to collect telemetry from mobile devices." For a web session, that telemetry is not sent as a separate call the way a fingerprinting library's `getInstance()` behaves: it is "attached in the form of HTTP headers or included in the POST body to the protected requests" themselves. For a mobile app, the embedded SDK "collects telemetry data and information about the endpoints" and is invoked by the app itself to generate headers, which are then attached to the outbound request the app was already making.
|
||||
|
||||
The collection code is not a plain script a browser's devtools can read line by line. F5's documentation states the client-side collector uses "sophisticated code obfuscation to prevent adversaries from reverse engineering and tampering with signal collection," the same posture [Kasada's bytecode VM](kasada-explained.md) and [Akamai's encrypted sensor bundle](akamai-bot-manager-explained.md) take: the obfuscation is not incidental minification, it is a stated part of the defense.
|
||||
|
||||
## Evaluation happens before your request reaches the origin
|
||||
|
||||
F5's own phrasing: "Bot Defense examines the telemetry collected from requests before they are permitted to reach your application." A bot detection rule, in F5's own terms, "contains criteria that Bot Defense uses to determine whether a transaction is from a human or automated source," and that determination is made before the origin server does anything with the request at all.
|
||||
|
||||
Two outcomes follow. For traffic Bot Defense calls human or an explicitly allowed automated source, "Bot Defense adds a custom HTTP request header to the request and allows the traffic to continue to the origin," which gives the origin application a signal it can check without having to run its own detection. For traffic it calls automated, the configured mitigation, monitor, block, or redirect, applies instead; F5's docs describe this as configurable per endpoint policy instead of a single global switch.
|
||||
|
||||
## The 2020 shift, and what F5's newer material adds
|
||||
|
||||
The acquisition put Shape's retail-and-finance-tuned detection behind F5's broader application delivery footprint rather than as a standalone appliance customers ran themselves. F5's current product page frames the same underlying approach in language aimed at 2026 traffic: "real-time behavioral analysis, client-side intelligence, and platform-wide telemetry to detect and control bots and AI agents at the application interaction layer." The newer framing adds an explicit category the original Shape Security product predates: "Agent-aware classification," described as separating "humans, trusted agents, and harmful automation" by evaluating "behavior and intent, not static signatures or identity claims." That is F5 extending the same telemetry-then-classify pipeline to LLM-driven browser agents rather than a different mechanism.
|
||||
|
||||
## What an engine answers honestly, and what sits behind F5's own wall
|
||||
|
||||
The JavaScript-collected telemetry, whatever specific fields it reads, is read by whatever engine is running the page. A genuinely real Firefox, patched at the engine level rather than overridden from a content script, answers that telemetry the same way any other real instance of the browser would, because there is no simulated value standing in for the real one. That is the same argument made at length for [DataDome's device layer](datadome-explained.md) and [Kasada's VM checks](kasada-explained.md), and it applies here without anything Shape-specific changing it.
|
||||
|
||||
What it does not touch: the server-side evaluation itself, which happens on F5's infrastructure and is not observable from the client at all; the mitigation policy an operator configures per endpoint, which this project has no way to see or influence; and the mobile-SDK path, which is a native library embedded in someone else's app, entirely outside what a browser engine's realness can speak to. F5's own docs do not publish the bot detection rule criteria beyond the category description above, so this page cannot say more specifically what the telemetry evaluation checks for, and does not guess.
|
||||
|
||||
`invisible_playwright` does not include, and does not sell, a service that defeats F5 Distributed Cloud Bot Defense's mitigation decisions. It is engine-level work: a real Firefox that answers whatever client-side telemetry it is asked for honestly, because the answers are not overridden.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Is F5 Distributed Cloud Bot Defense the same thing as Shape Security?** Yes, functionally. F5 completed its acquisition of Shape Security in January 2020 for approximately one billion dollars, and the product has been renamed twice since (Shape Enterprise Defense, then Shape Integrated Bot Defense, now F5 Distributed Cloud Bot Defense) while the underlying detection engine is the one Shape built.
|
||||
|
||||
**Where is the telemetry sent?** For web traffic, it rides along with the request itself, in F5's own words "attached in the form of HTTP headers or included in the POST body." It is not a separate reporting call.
|
||||
|
||||
**Does F5 publish what its bot detection rules actually check?** Not beyond category-level language (behavioral analysis, client-side intelligence, platform-wide telemetry). The specific fields and scoring weights are not in F5's public documentation as retrieved for this page.
|
||||
|
||||
**What happens to traffic F5 classifies as human?** F5's docs state it "adds a custom HTTP request header to the request and allows the traffic to continue to the origin," giving the origin application a signal without the application running its own check.
|
||||
|
||||
**Does a real browser engine bypass F5 Bot Defense?** It answers the client-side telemetry collection honestly, the same argument that applies to any vendor's JavaScript-collected fingerprint. It has no bearing on the server-side evaluation, the mitigation policy, or the mobile-SDK path, none of which a browser engine can see or influence.
|
||||
|
||||
**What is "Agent-aware classification"?** F5's own newer language for extending the same telemetry pipeline to LLM-driven browser agents: classifying by "behavior and intent" rather than treating every non-human client the same way.
|
||||
|
||||
**Does invisible_playwright defeat F5 Distributed Cloud Bot Defense?** No. This project does not make that claim about F5 or any comparable vendor. It ships engine-level realness, not a bypass service.
|
||||
|
||||
**See also:** [How Kasada's bot detection actually works](kasada-explained.md) for the same obfuscated-telemetry-plus-server-side-scoring shape at a vendor whose client script has been reverse-engineered in more public detail; [How Akamai Bot Manager actually works](akamai-bot-manager-explained.md) for a documented case where a matching network fingerprint still was not enough; and [How DataDome's bot detection actually works](datadome-explained.md) for the three-layer network/device/session-memory structure this whole category shares.
|
||||
|
||||
## Sources
|
||||
|
||||
- F5, [Bot Defense Overview](https://docs.cloud.f5.com/docs-v2/bot-defense/concepts/about-bot-defense),
|
||||
retrieved 2026-08-30, for the telemetry collection paths (JavaScript, mobile SDK), the header/POST-body attachment mechanism, the "sophisticated code obfuscation" language, and the human-vs-automated mitigation outcomes.
|
||||
- F5, [F5 Distributed Cloud Bot Defense product page](https://www.f5.com/products/distributed-cloud-services/bot-defense),
|
||||
retrieved 2026-08-30, for the "real-time behavioral analysis, client-side intelligence, and platform-wide telemetry" framing and the "Agent-aware classification" / AI-agent language.
|
||||
- F5, [Get Started with Bot Defense](https://docs.cloud.f5.com/docs-v2/bot-defense/plan-bot-advanced/overview),
|
||||
retrieved 2026-08-30, for the bot detection rule and telemetry-examination description.
|
||||
- Press coverage of the acquisition: [F5 Completes Acquisition of Shape Security](https://www.f5.com/company/news/press-releases/f5-completes-acquisition-of-shape-security),
|
||||
F5's own press release, retrieved 2026-08-30, for the January 2020 completion date and deal framing.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright), a Firefox
|
||||
patched at the C++ level. F5's own documentation stops at category-level language for what its
|
||||
telemetry evaluation checks; this page stops there too rather than filling the gap with
|
||||
reverse-engineered specifics nobody has published for this particular vendor as of this writing.*
|
||||
@@ -0,0 +1,94 @@
|
||||
---
|
||||
title: "Fastly Bot Management, Explained"
|
||||
description: "Fastly scores bot traffic at the CDN edge, before caching and again before your origin, combining server-side header analysis with an opt-in JavaScript probe aimed specifically at headless browsers. Read from Fastly's own documentation."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 30
|
||||
---
|
||||
|
||||
|
||||
# Fastly Bot Management, Explained
|
||||
|
||||
Fastly is a content delivery network, and its bot detection runs where the rest of its business runs: at the edge, before a request reaches whatever origin server it is actually addressed to. That positioning matters more than it sounds. It means Fastly can act on a request before your own application does anything, and it means the detection Fastly publishes is split cleanly into what happens automatically, on every request, and a specific opt-in JavaScript check aimed at one thing: headless browsers.
|
||||
|
||||
Read from Fastly's own developer documentation on 2026-08-30.
|
||||
|
||||
## Two inspection points, and what runs at each
|
||||
|
||||
Fastly's documentation describes Bot Management working at two points in the request lifecycle:
|
||||
|
||||
**Pre-cache**, inspecting traffic "before they reach your cache layer, allowing you to control bot access to both cached and uncached resources." This is where Fastly's baseline, server-side detection runs on every request regardless of whether the client executes any JavaScript at all: analyzing "HTTP header anomalies and `User-Agent` spoofing," protocol-level signals a request carries whether or not a browser is behind it.
|
||||
|
||||
**Post-cache**, working "alongside the Next-Gen WAF to analyze cache-miss requests, protecting your origin from bot attacks." This is where the client-side signals described below feed into rules, and where a request that already passed the pre-cache check gets a second look before it reaches your actual application.
|
||||
|
||||
Fastly is explicit that its detection is not meant to lean on attributes that are trivial to fake: its own materials state the approach "does not depend on easily spoofed attributes such as IP addresses or user-agent strings," instead correlating "behavioral and client signals over time" so that IP rotation or a copied user-agent string alone does not clear a session.
|
||||
|
||||
## The opt-in layer: advanced client-side detections
|
||||
|
||||
The baseline server-side analysis runs without any change to your pages. Catching headless browsers specifically requires opting in to what Fastly calls **advanced client-side detections**, enabled by adding one line to a page's `<head>`:
|
||||
|
||||
```html
|
||||
<script src="/_fs-ch-1T1wmsGaOgGaSxcX/assets/script.js"></script>
|
||||
```
|
||||
|
||||
Fastly's own documentation recommends placing this "above all other scripts in your HTML," and the script's filename is configurable as long as it ends in `.js`, presumably so the endpoint does not read as an obvious bot-detection asset to a client deciding whether to load it. Fastly states this specific feature exists to "detect bots that leverage headless browsers such as headless Chrome."
|
||||
|
||||
Once loaded, the script's execution feeds three system signals a site owner can build rules against:
|
||||
|
||||
| Signal | What it indicates |
|
||||
|---|---|
|
||||
| `SUSPECTED-BOT.HEADLESS` | Probable headless browser activity |
|
||||
| `SUSPECTED-BAD-BOT.HEADLESS` | Headless activity Fastly's model treats as malicious, not merely automated |
|
||||
| `CLIENTSIDE-COOKIE-VALID` | The client-side script ran and produced a cookie, i.e. it is a real, executing browser environment |
|
||||
|
||||
The cookie itself is named `_fs_cd_cp_` in Fastly's own docs, and its presence is how a site owner or a Fastly rule confirms the script actually executed rather than being blocked or skipped.
|
||||
|
||||
Handling then splits by inspection point: pre-cache rules can act on a `fastly.bot.category.is_headless` parameter directly in VCL (Fastly's edge configuration language), while post-cache handling goes through Next-Gen WAF rules matching the system signals above.
|
||||
|
||||
## Signals beyond headless detection
|
||||
|
||||
Fastly's broader materials name additional categories without publishing the same level of implementation detail as the headless script: **client fingerprinting**, to "identify client types and detect bots designed for malicious activities," and **AI bot detection**, aimed specifically at "AI crawlers and fetchers" as their own traffic class. A 2024 addition, the `BOT-ANALYSIS` system signal, is documented only at the level of "a request that was analyzed for bots," without the finer distinctions Fastly gives the headless-specific signals; this page reports that limitation instead of guessing at what `BOT-ANALYSIS` adds beyond the headless triad.
|
||||
|
||||
## What an engine answers honestly, and what stays server-side
|
||||
|
||||
The headless-detection script's whole premise is that a headless or automation-driven environment behaves detectably differently from a real, rendering browser: missing APIs, timing that does not match real hardware, environment properties a genuine browser always has. A Firefox that is genuinely the engine it claims to be, patched below the JavaScript layer rather than scripted from a content script, answers that probe honestly because there is no simulated environment for the script to catch, the same argument this corpus makes for [CreepJS](creepjs-explained.md) and [BotD](botd-explained.md). The `CLIENTSIDE-COOKIE-VALID` signal in particular is close to a tautology for a real browser: a real engine that runs the script produces the cookie because it actually ran the script, not because anything faked having run it.
|
||||
|
||||
What sits outside that: the server-side, pre-cache header and protocol analysis Fastly runs on every request regardless of JavaScript, which reads the connection and headers rather than anything a browser engine renders; the behavioral correlation "over time" Fastly's own materials describe, which is a property of the session and its history rather than the engine underneath any single request; and whatever Fastly's `BOT-ANALYSIS` signal and its underlying model actually weigh, which Fastly has not published in enough detail for this page to describe with confidence.
|
||||
|
||||
`invisible_playwright` does not claim to defeat Fastly's bot scoring as a whole. It is a real Firefox that answers the client-side headless-detection layer the way any genuine instance of the engine does, which is one signal among the several Fastly's own documentation says it correlates.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does Fastly Bot Management run without any script on the page?** Yes, for its baseline server-side detection, which analyzes HTTP headers, user-agent strings and protocol-level signals on every request. The headless-browser-specific detection is a separate, opt-in JavaScript probe.
|
||||
|
||||
**What does the `_fs-ch-*` script actually do?** Per Fastly's own docs, it detects headless browsers such as headless Chrome and produces a `_fs_cd_cp_` cookie confirming it executed, alongside the `SUSPECTED-BOT.HEADLESS` and `SUSPECTED-BAD-BOT.HEADLESS` system signals.
|
||||
|
||||
**What is the difference between pre-cache and post-cache detection?** Pre-cache runs before Fastly's cache layer and can control access to cached and uncached resources directly in VCL; post-cache integrates with the Next-Gen WAF to inspect cache-miss requests bound for your origin.
|
||||
|
||||
**Is IP address or user-agent spoofing enough to pass Fastly?** By Fastly's own framing, no: the detection is built specifically to not depend on "easily spoofed attributes such as IP addresses or user-agent strings," correlating behavioral and client signals over time instead.
|
||||
|
||||
**What does `BOT-ANALYSIS` mean?** Fastly's own documentation describes it only as marking "a request that was analyzed for bots," without further detail on what triggers it or how it differs from the headless-specific signals.
|
||||
|
||||
**Does a real browser engine defeat Fastly's headless detection?** It answers that specific probe honestly, because a genuinely real, engine-level Firefox is not simulating a browser environment, it is one. That says nothing about the server-side header analysis or the behavioral correlation Fastly runs independently of any single page's JavaScript.
|
||||
|
||||
**Does invisible_playwright bypass Fastly Bot Management?** No. This project does not sell or claim a bypass service for Fastly or any comparable vendor.
|
||||
|
||||
**See also:** [How do websites detect bots?](how-do-websites-detect-bots.md) for where a CDN-level, pre-cache check sits relative to the other layers; [is Playwright headless detectable](is-playwright-headless-detectable.md) for the general headless-tell problem Fastly's script is built to catch; and [How DataDome's bot detection actually works](datadome-explained.md) for a comparable network-plus-JavaScript-plus-cookie structure at another edge-deployed vendor.
|
||||
|
||||
## Sources
|
||||
|
||||
- Fastly, [About Bot Management](https://www.fastly.com/documentation/guides/security/bot-management/about-bot-management/),
|
||||
retrieved 2026-08-30, for the pre-cache/post-cache architecture, the server-side header/user-agent analysis, and the "does not depend on easily spoofed attributes" framing.
|
||||
- Fastly, [Using advanced client-side detections](https://www.fastly.com/documentation/guides/security/bot-management/using-advanced-client-side-detections/),
|
||||
retrieved 2026-08-30, for the exact script tag, the `_fs_cd_cp_` cookie, the `SUSPECTED-BOT.HEADLESS` / `SUSPECTED-BAD-BOT.HEADLESS` / `CLIENTSIDE-COOKIE-VALID` signals, and the pre-cache/post-cache handling split.
|
||||
- Fastly, [Added BOT-ANALYSIS signal](https://www.fastly.com/documentation/reference/changes/2024/09/added-bot-analysis-signal/),
|
||||
retrieved 2026-08-30, for the limited public description of that signal.
|
||||
- Fastly, [Bot Management and Protection product page](https://www.fastly.com/products/bot-management),
|
||||
retrieved 2026-08-30, for the client-fingerprinting and AI-bot-detection category language.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright).
|
||||
Fastly documents its headless-detection script in enough detail to quote the signal names and
|
||||
cookie directly; its broader behavioral-correlation model and the newer `BOT-ANALYSIS` signal are
|
||||
not published at the same depth, and this page says so rather than filling the gap with a guess.*
|
||||
@@ -41,7 +41,7 @@ your index is empty, but no amount of waiting for JavaScript fixes it, because t
|
||||
JavaScript was never allowed to run.
|
||||
|
||||
A real browser addresses both at once: it executes the page's JavaScript, and it makes a
|
||||
request that reads as a genuine Firefox rather than a script. That is the whole reason to
|
||||
request that reads as a genuine Firefox instead of a script. That is the whole reason to
|
||||
put a browser in front of the index instead of an HTTP loader.
|
||||
|
||||
## The fetch stage: render with a real browser fingerprint
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
---
|
||||
title: "First Firefox launch fails on Windows, then works"
|
||||
description: "A freshly extracted Firefox can fail its very first launch on Windows and then succeed every time after. What we measured, why, and how to handle it."
|
||||
parent: "Testing and Troubleshooting"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 29
|
||||
---
|
||||
|
||||
|
||||
# First Firefox launch fails on Windows, then works
|
||||
|
||||
A freshly extracted Firefox directory can fail to launch on Windows on its very first attempt and then succeed every single time after, with no code change and no reinstall. We measured this directly: the failure tracks the executable's file path, not the directory's contents, and a Windows registry key tied to that path is the strongest lead we found.
|
||||
|
||||
## The symptom
|
||||
|
||||
Extract a Firefox build to a brand new path on Windows and launch it. Sometimes the launch fails immediately, with no window, no error dialog, and nothing useful beyond a bare launch timeout. Try again at the exact same path with the exact same binary, no changes at all, and it works. Not just once: every later launch at that same path succeeded, every time, in every test we ran.
|
||||
|
||||
The rate is not "every first launch fails." Most first launches at a new path succeed cleanly. When one does fail, though, it fails fast, in under a second, and the very next attempt at the identical path always worked in our testing.
|
||||
|
||||
## What we ruled out
|
||||
|
||||
Our first instinct was that the extracted directory itself was incomplete on that one run. It wasn't: we took a directory that had already launched successfully many times, copied it whole to a new path we'd never used, and its first launch there failed the same way, with byte-for-byte identical contents to a working copy elsewhere. We also ruled out the per-launch profile Playwright creates, clearing every cache we could find, and re-downloading the build from scratch. None of it made any measurable difference. Whatever was failing lived outside both the directory and the profile.
|
||||
|
||||
## What the registry key points to
|
||||
|
||||
Firefox's startup on Windows goes through a launcher stage before the browser process starts, keeping state outside the installation directory. We found a registry key, `HKCU\Software\Mozilla\Firefox\Launcher`, holding timestamped entries keyed by the executable's own file path. A path never launched before had no entry; the same path, launched again, did.
|
||||
|
||||
That correlation matches what we observed: new path, no entry, occasional immediate failure; same path again, entry present, no failure. Two halves of this are worth keeping apart. The launcher stage itself is documented by Mozilla: Firefox on Windows bootstraps through a launcher process that, unlike every other process in the browser, "is not launched by the parent process, but rather launches it", and it exists so that protections like DLL blocklisting are in place before the browser's main thread runs. Mozilla treats launcher failures as a real enough category to ship a telemetry ping for them. The registry key and its per-executable timestamps, on the other hand, are our own observation: we found them, we can read them, and we have not found Mozilla documentation that describes them, so treat that half as a measured correlation rather than an architectural claim.
|
||||
|
||||
## The process that dies is the launcher, not the browser
|
||||
|
||||
The detail worth carrying into your own debugging: the process that exits is the launcher, not the browser you're trying to drive. It exits within a fraction of a second and writes no log anywhere we looked. "The browser printed nothing" is the wrong way to describe it, because the browser was never created. From Playwright's side, a dead launcher looks exactly like a plain launch timeout, with none of the specifics that would point at what actually went wrong.
|
||||
|
||||
## How to recognise this specific failure
|
||||
|
||||
- It only happens on the first launch at a path you have never used before, never on a path you have already launched successfully.
|
||||
- It fails fast, typically well under a second, not after waiting out a timeout.
|
||||
- There is no log file and no window, even briefly.
|
||||
- Retrying the exact same launch, same path, same everything, succeeded the second time in every case we saw.
|
||||
|
||||
If your failure doesn't match this shape, slow rather than instant, or the same path failing on every attempt, you're looking at something else. [Slow browser launch: a per-request timeout is not a budget](slow-browser-launch-timeout-budget.md) and [Playwright "Executable Doesn't Exist" After Install](playwright-executable-doesnt-exist.md) cover failure modes that look similar but have different causes.
|
||||
|
||||
## Checking the registry key yourself
|
||||
|
||||
```
|
||||
reg query "HKCU\Software\Mozilla\Firefox\Launcher"
|
||||
```
|
||||
|
||||
Run it before and after a launch at a new path. A new entry appearing is the signal to look for; it won't tell you why the launcher failed the first time, only that the path is now on record.
|
||||
|
||||
## Practical handling: a warm-up launch and one retry
|
||||
|
||||
Two things worked for us. Right after extracting a build to a new path, launch it once and close it immediately, before any real automation depends on it, so the launcher can record the path while nothing is watching the clock.
|
||||
|
||||
```python
|
||||
from playwright.sync_api import sync_playwright
|
||||
|
||||
def launch_with_warmup(playwright, executable_path, **launch_kwargs):
|
||||
# First launch at a brand new path: throwaway, just to let the
|
||||
# launcher record state for this executable. Close it immediately.
|
||||
warmup = playwright.firefox.launch(executable_path=executable_path, **launch_kwargs)
|
||||
warmup.close()
|
||||
return playwright.firefox.launch(executable_path=executable_path, **launch_kwargs)
|
||||
```
|
||||
|
||||
Second, treat the very first real launch of any new install path as worth exactly one retry, no more. The second attempt succeeded every time we tested it, so a loop with backoff solves a problem you don't have and only hides a genuinely broken install behind repeated waiting.
|
||||
|
||||
```python
|
||||
def launch_retry_once(playwright, executable_path, **launch_kwargs):
|
||||
try:
|
||||
return playwright.firefox.launch(executable_path=executable_path, **launch_kwargs)
|
||||
except Exception:
|
||||
return playwright.firefox.launch(executable_path=executable_path, **launch_kwargs)
|
||||
```
|
||||
|
||||
## What remains unexplained
|
||||
|
||||
We have a correlation, not a proven mechanism. We don't know why an absent registry entry makes the launcher exit instead of simply creating the entry itself, the way a first-run step normally would. We also haven't ruled out a competing, more mundane explanation: antivirus or SmartScreen scanning a freshly written executable can delay its first execution at a new path, independent of anything Firefox's own code does.
|
||||
|
||||
Treat the warm-up launch and single retry as a practical workaround, not a fix for a confirmed cause. If what you're chasing turns out to be a preferences problem instead, [Firefox preferences that silently do nothing](firefox-prefs-not-applying.md) covers a different failure that can look similar from the outside.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Why does Firefox fail to launch the first time but work the second time?**
|
||||
In our testing, first launches at a brand new path occasionally fail within a fraction of a second, while the second launch at the same path always succeeded. The failure correlates with a Windows registry key that has no entry yet for a path never launched before.
|
||||
|
||||
**Is this a Firefox bug?**
|
||||
We haven't proven that. What we have is a measured correlation between a missing registry entry and an occasional fast failure on first launch, not a confirmed root cause.
|
||||
|
||||
**Does this happen only on Windows?**
|
||||
Yes, as far as we tested. The registry key we found, under `HKCU\Software\Mozilla\Firefox\Launcher`, is Windows-specific, and we have no equivalent finding for Linux.
|
||||
|
||||
**How do I avoid hitting this in automation?**
|
||||
Launch once and close immediately after extracting a build to a new path, before any real task depends on it, and give the first real launch of any new path exactly one retry.
|
||||
|
||||
**Does clearing the cache or profile fix it?**
|
||||
No. Neither made any difference in our testing; the failure tracked the executable's path, not the profile or any cache we cleared.
|
||||
|
||||
**See also:** [Slow browser launch: a per-request timeout is not a budget](slow-browser-launch-timeout-budget.md), [Playwright "Executable Doesn't Exist" After Install](playwright-executable-doesnt-exist.md), and [Firefox preferences that silently do nothing](firefox-prefs-not-applying.md).
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's own testing, September 2026: repeated extraction of a shipped Firefox build to new Windows paths, timing the process exit, and inspecting `HKCU\Software\Mozilla\Firefox\Launcher` before and after each launch.
|
||||
- Mozilla, Gecko Processes, https://firefox-source-docs.mozilla.org/ipc/processes.html - the launcher process on Windows, the quoted line about it launching the parent rather than being launched by it, and its role in DLL blocklisting. Read 5 September 2026.
|
||||
- Mozilla, Launcher Process Failure ping, https://firefox-source-docs.mozilla.org/toolkit/components/telemetry/data/launcher-process-failure-ping.html - the telemetry Firefox sends when the launcher cannot start the browser. Read 5 September 2026; it documents the ping's fields and says nothing about registry state, which is why the registry half above stays labelled as our own observation.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright), on a failure that only ever showed up once per path and never explained itself in its own words.*
|
||||
@@ -0,0 +1,164 @@
|
||||
---
|
||||
title: "GeeTest v4 (Slide/Click Captcha), Explained"
|
||||
description: "GeeTest v4 is a puzzle captcha: drag a piece into place, tap icons in order, or clear a match-three board, encrypted client-side and verified against GeeTest's own server. Read from GeeTest's own docs and independent reverse engineering."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 39
|
||||
---
|
||||
|
||||
|
||||
# GeeTest v4 (Slide/Click Captcha), Explained
|
||||
|
||||
GeeTest is a commercial captcha vendor, widely deployed on sites outside the United
|
||||
States, especially across e-commerce, gaming and finance in Asia. Version 4 of its
|
||||
Behavior Verification product is the one most people mean when they say "GeeTest":
|
||||
a slide puzzle, an icon-selection challenge, a match-three board, or a one-tap pass,
|
||||
picked per session by GeeTest's own risk engine rather than fixed per site.
|
||||
|
||||
Be clear about what this page is before reading further. GeeTest v4 is, functionally,
|
||||
a captcha: a visible, interactive puzzle a visitor is asked to solve. This page
|
||||
explains the mechanism, read from GeeTest's own documentation and from independent,
|
||||
public reverse engineering. It is not instructions for solving the puzzle
|
||||
automatically, and `invisible_playwright` does not include a puzzle-solving or
|
||||
captcha-solving capability of any kind. That distinction matters more here than on
|
||||
most pages in this corpus, so it is stated once, plainly, before anything else.
|
||||
|
||||
## The challenge types, and how one gets picked
|
||||
|
||||
Per GeeTest's own overview documentation, v4's "Intelligent Verification Mode"
|
||||
selects a challenge type automatically per session, from a set that includes Slide
|
||||
Puzzle, Icon Selection, Match-Three (a Gobang-style board), and OneTap Pass, plus a
|
||||
voice-based path for accessibility. GeeTest's own docs describe the selection logic
|
||||
in outline rather than in full: "the system automatically selects the most suitable
|
||||
challenge based on risk signals," so a session GeeTest's engine scores as higher-risk
|
||||
is more likely to land a harder challenge type, and a lower-risk session may get
|
||||
OneTap Pass, which asks for nothing more than a single tap. GeeTest does not publish
|
||||
the scoring model behind that choice, and no page in this corpus claims to know it.
|
||||
|
||||
## What the client side actually does
|
||||
|
||||
For the Slide Puzzle path specifically, independent, open-source reverse engineering
|
||||
of the widget (a public GitHub project documenting the slide challenge) describes the
|
||||
mechanism concretely: the server returns a background image and a separate puzzle
|
||||
piece, along with the vertical (`y`) position where the piece belongs, and the
|
||||
visitor's job is to drag the piece left or right until it seats into the matching
|
||||
gap in the background. The same project's notes on the challenge's data collection
|
||||
are worth quoting directly because they cut against an assumption a lot of writing
|
||||
about captchas makes: GeeTest, per this independent analysis, "collects near to no
|
||||
browser information. Just a few IDs and the solution to the image challenge." The
|
||||
heavy client-side work in this project's own documentation is not a sprawling
|
||||
fingerprint payload, it is AES and RSA encryption wrapped around the request
|
||||
specifically, in the reverse-engineer's own words, "to make reverse engineering
|
||||
harder," a cost imposed on automated analysis rather than a fingerprint collected
|
||||
from a real device.
|
||||
|
||||
GeeTest's own docs separately describe an "Environment Detection" layer running
|
||||
alongside the puzzle itself, stated to identify "automated tools, malicious plugins,
|
||||
and incognito mode usage," and an image pool GeeTest refreshes, per its own
|
||||
documentation, on an hourly basis specifically to keep a cached or memorized set of
|
||||
puzzle images from staying valid for long.
|
||||
|
||||
## The server side: what actually proves the puzzle was solved
|
||||
|
||||
GeeTest's own server-integration documentation lays out the verification exchange
|
||||
plainly, and it is worth walking through because it is the part that actually decides
|
||||
pass or fail, not the puzzle interaction itself. After a visitor completes a
|
||||
challenge, the client returns four values to the site's own backend: `lot_number`,
|
||||
a serial number for that specific verification attempt; `captcha_output`, an
|
||||
opaque, encrypted blob representing the outcome; `pass_token`, a token standing in
|
||||
for the completed session; and `gen_time`, a timestamp. The site's backend then
|
||||
computes an HMAC-SHA256 signature over the `lot_number` using its own private
|
||||
`captcha_key`, and POSTs all four values plus that signature to GeeTest's own
|
||||
validation endpoint, `gcaptcha4.geetest.com/validate`. GeeTest's response is JSON
|
||||
carrying a `status` field (whether the validation request itself succeeded) and a
|
||||
`result` field (`"success"` or `"fail"` for the visitor's actual attempt), with a
|
||||
`reason` field on failure describing things like an expired token.
|
||||
|
||||
The puzzle a person sees is only the front half of this. The actual security
|
||||
boundary is server-to-server, exactly the same shape as [the token exchange
|
||||
Cloudflare Turnstile runs through its Siteverify endpoint](cloudflare-turnstile-explained.md#the-token-and-why-passing-the-widget-is-not-the-finish-line):
|
||||
a client-side interaction produces a token, and the token is only worth anything
|
||||
once a server the visitor cannot reach has checked it against the issuer directly.
|
||||
|
||||
## What invisible_playwright does and does not do here
|
||||
|
||||
This is the section to read most carefully on this page. `invisible_playwright` is
|
||||
a patched Firefox that answers the JavaScript-visible parts of a browser fingerprint
|
||||
honestly, the same category of thing covered throughout this corpus: canvas and
|
||||
WebGL output, font enumeration, timing consistency, whether the engine claiming to
|
||||
be a real browser actually behaves like one. GeeTest's own "Environment Detection"
|
||||
layer sits in that category, and a genuinely real engine answers it the way any other
|
||||
real instance of that engine does, for the same reason argued
|
||||
[on the Turnstile page](cloudflare-turnstile-explained.md#where-an-engine-level-browser-actually-helps-and-where-it-does-not)
|
||||
and [the DataDome page](datadome-explained.md#what-an-engine-answers-honestly-and-what-sits-outside-its-reach).
|
||||
|
||||
That is where the honest boundary sits, and it sits well short of the puzzle itself.
|
||||
Dragging a slider into the correct gap, tapping icons in the order a prompt asks for,
|
||||
or clearing a match-three board is a human-interaction problem, not a fingerprint
|
||||
problem, and no amount of engine-level realness answers it for you. `invisible_playwright`
|
||||
does not solve, automate, or sell a solution to GeeTest's puzzle step, and any tool
|
||||
that claims to "bypass GeeTest" as a captcha-solving promise is describing a
|
||||
different, separate product category, commercial puzzle-solving services exist for
|
||||
exactly this reason, not something this project does or intends to do.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What is GeeTest v4?** A commercial captcha product offering several interactive
|
||||
challenge types, slide puzzle, icon selection, match-three and a one-tap pass,
|
||||
selected per session by GeeTest's own risk engine.
|
||||
|
||||
**Is GeeTest the same kind of thing as Cloudflare Turnstile?** No. Turnstile mostly
|
||||
runs invisible, non-interactive checks and shows a checkbox only when its own signals
|
||||
are uncertain. GeeTest's most common deployment mode, the slide puzzle, is visible
|
||||
and interactive by design in the common case, not a fallback for an uncertain
|
||||
signal.
|
||||
|
||||
**What does GeeTest actually collect from the browser?** According to independent
|
||||
reverse engineering of the slide-puzzle client, very little beyond a few session
|
||||
identifiers and the puzzle solution itself, with the request wrapped in AES/RSA
|
||||
encryption to raise the cost of automated analysis rather than to hide a large
|
||||
fingerprint payload.
|
||||
|
||||
**How does GeeTest verify a completed challenge?** Server-to-server. The client
|
||||
returns a `lot_number`, `captcha_output`, `pass_token` and `gen_time`; the site's own
|
||||
backend signs the `lot_number` with its private key and posts everything to GeeTest's
|
||||
`validate` endpoint, which returns success or failure.
|
||||
|
||||
**Does invisible_playwright solve GeeTest's puzzle for me?** No. That is a
|
||||
human-interaction challenge, not a browser-fingerprint check, and this project does
|
||||
not include a puzzle-solving or captcha-solving capability of any kind.
|
||||
|
||||
**Does a real, engine-level browser help against GeeTest at all?** Only against the
|
||||
environment-detection layer running alongside the puzzle, the part checking whether
|
||||
the browser claiming to be real actually behaves like one. It has no effect on the
|
||||
puzzle interaction itself.
|
||||
|
||||
## Sources
|
||||
|
||||
- GeeTest, [Behavior Verification overview](https://docs.geetest.com/BehaviorVerification/overview/overview/),
|
||||
retrieved 2026-08-30, for the challenge-type list, the Intelligent Verification
|
||||
Mode description, the Environment Detection claim, and the hourly image-refresh
|
||||
claim.
|
||||
- GeeTest, [server-side deployment and validation documentation](https://docs.geetest.com/BehaviorVerification/deploy/server),
|
||||
retrieved 2026-08-30, for the `lot_number`/`captcha_output`/`pass_token`/`gen_time`
|
||||
parameters, the HMAC-SHA256 signing step, the `validate` endpoint, and the
|
||||
success/failure response shape.
|
||||
- [`gravilk/geetest-v4-slide-documented`](https://github.com/gravilk/geetest-v4-slide-documented)
|
||||
on GitHub, retrieved 2026-08-30, independent, public reverse engineering of the
|
||||
slide-puzzle client, for the `y`-position mechanism, the AES/RSA encryption
|
||||
purpose, and the "collects near to no browser information" finding.
|
||||
|
||||
**See also:** [How Cloudflare Turnstile actually works](cloudflare-turnstile-explained.md)
|
||||
for the non-interactive counterpart to a visible puzzle, [how DataDome's bot
|
||||
detection actually works](datadome-explained.md) for another vendor's split between
|
||||
an engine-honest layer and a human-interaction layer, and [browser trust scores
|
||||
explained](browser-trust-score-explained.md) for what a risk-based challenge
|
||||
selection like GeeTest's is actually scoring.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. This page explains a
|
||||
puzzle captcha's mechanism, not a way around it: the product does not solve captchas,
|
||||
and a claim that any tool defeats GeeTest's puzzle step is a different promise than
|
||||
anything documented here.*
|
||||
@@ -17,6 +17,12 @@ verified against the framework's actual source before anything is claimed about
|
||||
several candidates that looked like a fit by star count turned out not to use
|
||||
Playwright, or not to touch Firefox, at all.
|
||||
|
||||
These pages are for developers wiring an agent to this engine. The
|
||||
agent-experience side - what to run, which agent products compare how, what to
|
||||
check when an agent gets blocked - lives on the
|
||||
[AIHawk wiki](https://github.com/feder-cr/AIHawk/wiki), the agent built on this
|
||||
same engine.
|
||||
|
||||
## Framework integrations
|
||||
|
||||
- [Give a LangChain agent an invisible_playwright browser](langchain-agent-invisible-playwright-browser.md) - hand PlayWrightBrowserToolkit a launched browser so its tools inherit a real fingerprint.
|
||||
@@ -28,15 +34,16 @@ Playwright, or not to touch Firefox, at all.
|
||||
## Computer-use and screenshot agents
|
||||
|
||||
- [Back a computer-use agent with a real browser engine](back-computer-use-agent-real-browser.md) - implement the screenshot-and-click Computer interface over an invisible_playwright page, and its honest limits.
|
||||
- [Computer-use agents and browser fingerprint detection](computer-use-agents-browser-detection.md) - clicking by pixel makes driver flags moot; the engine fingerprint and action rhythm stay checkable.
|
||||
- [Computer-use agents and browser fingerprint detection](computer-use-agents-browser-detection.md) - clicking by pixel makes driver flags moot; the engine fingerprint and action rhythm stay checkable. (Moved to the AIHawk wiki; the page here points across.)
|
||||
- [DOM-reading vs screenshot agents: which stealth helps](dom-reading-vs-screenshot-agents.md) - which stealth signal helps depends on whether the agent reads DOM or clicks pixels.
|
||||
|
||||
## How AI agents get detected
|
||||
|
||||
- [AI browser agents and stealth: what fits and what does not](ai-browser-agents-stealth.md) - most agents drive Chromium over CDP, so a stealth Firefox does not drop in.
|
||||
- [browser-use gets detected: what you can and cannot change](browser-use-detection.md) - browser-use drives Chrome over CDP: what BrowserProfile changes, what stays out of reach.
|
||||
- [Why AI browser agents have their own timing signal](ai-agent-timing-signal.md) - a think-act loop emits machine-regular gaps and instant pointer jumps no fingerprint fixes.
|
||||
- [AI agent retry loops trip rate limits, not fingerprints](agent-retry-loops-rate-limits.md) - retry and re-plan loops multiply requests into a volume signal; throttle in the agent loop.
|
||||
- [browser-use gets detected: what you can and cannot change](browser-use-detection.md) - browser-use drives Chrome over CDP: what BrowserProfile changes, what stays out of reach. (Moved to the AIHawk wiki; the page here points across.)
|
||||
- [Why AI browser agents have their own timing signal](ai-agent-timing-signal.md) - a think-act loop emits machine-regular gaps and instant pointer jumps no fingerprint fixes. (Moved to the AIHawk wiki; the page here points across.)
|
||||
- [AI agent retry loops trip rate limits, not fingerprints](agent-retry-loops-rate-limits.md) - retry and re-plan loops multiply requests into a volume signal; throttle in the agent loop. (Moved to the AIHawk wiki; the page here points across.)
|
||||
- [Playwright 1.62 Ships MCP In the Box](playwright-162-built-in-mcp.md) - the MCP server and a new playwright-cli are now bundled into core, runnable via `npx playwright mcp` with no separate install.
|
||||
|
||||
## Running agents at scale and on servers
|
||||
|
||||
|
||||
@@ -40,6 +40,8 @@ override from the page, because the page is not where the tell originates.
|
||||
- [Execution context was destroyed, and when it means detection](execution-context-destroyed.md) - Usually a race condition, but sometimes a redirect to a challenge; how to tell the two apart.
|
||||
- [Why content_frame() returns None for a cross-origin iframe](cross-origin-iframe-unreachable.md) - One shared cause behind None, throws and timeouts: process isolation, not a permissions bug.
|
||||
|
||||
- [Running Playwright Firefox on ARM64 Linux](playwright-firefox-arm64-linux.md) - What ships per architecture on ARM64 Linux, the emulation trap, and the memory ceiling.
|
||||
|
||||
## Human-like input and interaction
|
||||
|
||||
- [Human-like mouse movement: Bezier curves are the easy part](human-mouse-movement.md) - Every pointer event carries fields saying where it came from, and a perfect curve can still fail.
|
||||
@@ -74,3 +76,8 @@ override from the page, because the page is not where the tell originates.
|
||||
- [Playwright set_input_files uploads and the tell](playwright-set-input-files-upload.md) - No native OS picker opens, plus the trusted change-event caveat most upload tutorials skip.
|
||||
- [Record a Playwright trace to debug a failed scrape](record-playwright-trace-debug-scraper.md) - Record a trace with screenshots and DOM snapshots, and keep the content-leaking artifact out of production.
|
||||
- [Record a video of a Playwright browser session](record-video-of-playwright-session.md) - Record a .webm with record_video_dir; it works headless and never changes what the site sees.
|
||||
|
||||
## Recent Playwright engine changes
|
||||
|
||||
- [Playwright 1.61's WebAuthn Virtual Authenticator](playwright-161-webauthn-passkey-virtual-authenticator.md) - `browserContext.credentials` adds a virtual passkey authenticator; whether it looks different depends on whether the site asks for attestation.
|
||||
- [Playwright 1.62: Headless No Longer Shares the OS Clipboard](playwright-162-clipboard-isolation-headless.md) - `navigator.clipboard` no longer reads or writes the real machine's clipboard in headless mode.
|
||||
@@ -26,6 +26,8 @@ platform the browser claims to be, not just look plausible in isolation.
|
||||
- [WebGL shader precision as a fingerprint surface](webgl-shader-precision-fingerprint.md) - getShaderPrecisionFormat is a third WebGL fingerprint, hashed apart from parameters and extensions.
|
||||
- [Is WebGPU a browser fingerprint?](is-webgpu-a-browser-fingerprint.md) - navigator.gpu exposes a second GPU identity most guides ignore, and it must match WebGL.
|
||||
|
||||
- [Why the same canvas draws differently on Windows and Linux](canvas-differs-across-operating-systems.md) - Why the same canvas call draws different pixels on Windows and on Linux, layer by layer.
|
||||
|
||||
## Fonts, emoji and text metrics
|
||||
|
||||
- [How to make Linux and macOS report real Windows fonts](bundled-fonts-cross-platform.md) - Bundle the real font files and read only from them; filtering a list leaves the host underneath.
|
||||
|
||||
@@ -25,6 +25,29 @@ whether a browser is telling the truth about what it claims to be.
|
||||
- [Why a FingerprintJS visitor ID changes](fingerprintjs-visitor-id.md) - a visitor ID is a hash of 41 components; why it changes or stays.
|
||||
- [reCAPTCHA v3 score: why a fresh browser scores badly](recaptcha-v3-score.md) - a fresh automated browser scores low even with a clean fingerprint. The reason is history.
|
||||
- [Browser trust scores explained: what the number means](browser-trust-score-explained.md) - CreepJS trust, FingerprintJS confidence and reCAPTCHA v3 score measure different things; one green is not the rest.
|
||||
- [How Cloudflare Turnstile actually works](cloudflare-turnstile-explained.md) - a signal-gathering decision engine, not a puzzle: non-interactive JS checks, proof-of-work, and a risk-scored escalation to a checkbox.
|
||||
- [How DataDome's bot detection actually works](datadome-explained.md) - TLS/HTTP fingerprint, a JS device and behavior collector, and a cookie that remembers the verdict.
|
||||
- [How Kasada's bot detection actually works](kasada-explained.md) - an obfuscated bytecode VM and a proof-of-work token that keeps renewing through the session.
|
||||
- [PerimeterX (now HUMAN Bot Defender): what the sensor actually checks](perimeterx-explained.md) - the sensor script and `_px` cookie chain, from the vendor's own SDK source.
|
||||
- [How Akamai Bot Manager actually works](akamai-bot-manager-explained.md) - the `_abck` cookie and Bot Score, and a real case where a matching TLS/JA3/JA4 fingerprint was not enough.
|
||||
- [Imperva (Incapsula), Explained](imperva-incapsula-explained.md) - an obfuscated JS sensor and a three-step cookie/JS/CAPTCHA escalation, still known by its old Incapsula cookie names.
|
||||
- [F5 Distributed Cloud Bot Defense (Shape), Explained](f5-shape-distributed-cloud-bot-defense-explained.md) - JavaScript and mobile-SDK telemetry, with mitigation that only kicks in once server-side evaluation finishes.
|
||||
- [Fastly Bot Management, Explained](fastly-bot-management-explained.md) - server-side header analysis at the CDN edge plus an opt-in JS probe aimed at headless browsers.
|
||||
- [reCAPTCHA Enterprise vs reCAPTCHA v3](recaptcha-enterprise-vs-v3.md) - the same 0.0-1.0 score plus an explainable risk-analysis API, Account Defender, and paid-by-default access.
|
||||
- [Arkose Labs (FunCaptcha), Explained](arkose-labs-funcaptcha-explained.md) - a risk engine decides puzzle difficulty before you ever see the 3D puzzle.
|
||||
- [AWS WAF Bot Control, Explained](aws-waf-bot-control-explained.md) - Common tier static analysis, Targeted tier a token-backed challenge pipeline with ML rules.
|
||||
- [Anubis: The Proof-of-Work Firewall, Explained](anubis-proof-of-work-explained.md) - a real, open-source SHA-256 puzzle gate now in front of many git forges.
|
||||
- [Cloudflare's AI Labyrinth, Explained](cloudflare-ai-labyrinth-explained.md) - an endless maze of real but irrelevant pages instead of an outright block.
|
||||
- [Private Access Tokens (Privacy Pass), Explained](private-access-tokens-explained.md) - a device-attestation replacement for CAPTCHAs, built on the IETF's Privacy Pass protocol.
|
||||
- [Beyond robots.txt: How Sites Actually Block AI Crawlers Now](beyond-robots-txt-anti-crawler-mechanisms.md) - rate limiting, behavioral scoring, IP/ASN blocking and decoy mazes underneath the advisory-only file.
|
||||
- [Vercel Bot Protection (BotID), Explained](vercel-bot-protection-botid-explained.md) - a client-side challenge plus an optional Kasada-powered Deep Analysis tier, including real false-positive reports.
|
||||
- [GeeTest v4 (Slide/Click Captcha), Explained](geetest-v4-explained.md) - drag, tap-in-order or match-three, encrypted client-side and verified server-side.
|
||||
- [Honeypot Fields and Hidden Links: How Sites Trap Scrapers](honeypot-fields-explained.md) - a field or link a real visitor never sees, that a script reading raw DOM will trigger.
|
||||
- [hCaptcha, Explained](hcaptcha-explained.md) - an invisible risk pass first, a visual puzzle only when unsure, and a data-labeling business underneath.
|
||||
- [hCaptcha Enterprise vs Standard](hcaptcha-enterprise-vs-standard.md) - the same mechanism, plus custom difficulty tuning, dedicated risk models and an SLA instead of the free tier's labeled-data economy.
|
||||
- [Cloudflare Bot Management, Explained](cloudflare-bot-management-explained.md) - the always-on scoring engine behind Cloudflare's edge, distinct from the Turnstile widget: a 1-99 bot score from JA3/JA4, HTTP fingerprinting, ML and behavior.
|
||||
|
||||
- [Queue-it virtual waiting rooms, explained for automation](queue-it-virtual-waiting-room-explained.md) - How a virtual waiting room splits the redirect, the return token and the JavaScript half from the server half.
|
||||
|
||||
## What a fingerprint is and how accurate it is
|
||||
|
||||
|
||||
@@ -33,6 +33,18 @@ which is exactly why it is worth understanding on its own.
|
||||
- [Does a proxy leak DNS? DoH and DNS leaks explained](does-a-proxy-leak-dns-doh-explained.md) - How a SOCKS5 proxy leaks DNS when the host resolves names locally, and how to verify.
|
||||
- [IPv6 vs IPv4: which does your proxy expose?](ipv6-vs-ipv4-which-does-your-proxy-use.md) - On a dual-stack host the browser can reach a site over IPv6 while the proxy carries only IPv4.
|
||||
- [How to check if a proxy leaks your real IP](how-to-check-proxy-ip-leak.md) - Confirm the actual WebRTC, IPv6, DNS and timezone values, not just that a leak is absent.
|
||||
- [ERR_HTTP2_PROTOCOL_ERROR in Playwright: causes and how to diagnose it](err-http2-protocol-error-playwright.md) - Chromium's catch-all for an HTTP/2 framing violation, often a proxy mangling the tunnel or a TLS/ALPN mismatch.
|
||||
- [ERR_TUNNEL_CONNECTION_FAILED in Playwright: what it means and how to fix it](err-tunnel-connection-failed-playwright.md) - The browser failing to open an HTTP CONNECT tunnel through your proxy, and the curl test that isolates why.
|
||||
- [ERR_SOCKS_CONNECTION_FAILED in Playwright: what it means and how to fix it](err-socks-connection-failed-playwright.md) - The browser's SOCKS5 handshake failing, a different failure mode from an HTTP CONNECT tunnel.
|
||||
- [net::ERR_CONNECTION_RESET in Playwright](err-connection-reset-playwright.md) - A TCP RST tore the connection down mid-request; proxy-side causes told apart from server-side ones.
|
||||
- [net::ERR_PROXY_CONNECTION_FAILED in Playwright](err-proxy-connection-failed-playwright.md) - The browser could not even open a socket to the proxy, before any CONNECT tunnel was attempted.
|
||||
- [net::ERR_ABORTED in Playwright](err-aborted-playwright.md) - Usually a cancelled navigation, not a failure: a redirect, a download, `route.abort()`, or a second `goto()`.
|
||||
- [net::ERR_NAME_NOT_RESOLVED in Playwright](err-name-not-resolved-playwright.md) - DNS failed before the proxy got a chance, or a SOCKS5 proxy is resolving hostnames on the wrong side.
|
||||
- [net::ERR_CERT_AUTHORITY_INVALID in Playwright](err-cert-authority-invalid-playwright.md) - The certificate chain does not trace to a trusted root, often a proxy intercepting TLS; what `ignoreHTTPSErrors` really disables.
|
||||
- [net::ERR_EMPTY_RESPONSE in Playwright](err-empty-response-playwright.md) - The server closed the connection without sending a single byte back, not even a status line.
|
||||
- [net::ERR_CONNECTION_REFUSED in Playwright](err-connection-refused-playwright.md) - Something actively rejected the connection; the Docker/CI variant where `localhost` isn't the host machine.
|
||||
- [net::ERR_INVALID_AUTH_CREDENTIALS in Playwright](err-invalid-auth-credentials-playwright.md) - An HTTP auth exchange failed to establish credentials, distinct from a 407 or a silently-dropped SOCKS5 credential.
|
||||
- [JA4H: The HTTP-Header-Order Fingerprint, Explained](ja4h-http-fingerprint-explained.md) - Method, header order, header count, cookies and Accept-Language folded into one string, JA4's HTTP-layer sibling.
|
||||
|
||||
## WebRTC candidates and leaks
|
||||
|
||||
|
||||
@@ -12,10 +12,10 @@ The rest of the Guides explain how a single surface gives you away. This group i
|
||||
other direction: a concrete task, in order, with the code that does it and the specific
|
||||
thing that breaks it.
|
||||
|
||||
Every page here is written against a real browser rather than a generic recipe. The
|
||||
Every page here is written against a real browser instead of a generic recipe. The
|
||||
launch is a two-line change from stock Playwright, the browser returned is a real
|
||||
Playwright `Browser` with no wrapped subset to learn, and each how-to carries at least one
|
||||
mistake we made first, measured and fixed rather than assumed.
|
||||
mistake we made first, measured and fixed, not assumed.
|
||||
|
||||
Start with [how to scrape without getting blocked](how-to-scrape-without-getting-blocked.md)
|
||||
for the model that orders the rest, then pick the task you have.
|
||||
@@ -58,6 +58,8 @@ for the model that orders the rest, then pick the task you have.
|
||||
- [Scrape a map-based search with Playwright](how-to-scrape-map-based-search-playwright.md) - Capture the bounding-box marker XHR, pan and zoom, grid the viewport to cover the area.
|
||||
- [How to scrape map-based local results with Playwright](how-to-scrape-map-based-local-results-playwright.md) - Drive the viewport, capture the bounds-keyed XHR per step, tile an area through an in-region proxy.
|
||||
|
||||
- [Select from dropdowns with Playwright, native and custom](playwright-select-option-dropdowns.md) - select_option() drives a real select element; a custom listbox needs a click, a wait, then a second click.
|
||||
|
||||
## Extracting content and structured data
|
||||
|
||||
- [How to extract JSON-LD structured data with Playwright](how-to-extract-json-ld-structured-data-playwright.md) - Parse JSON-LD and @graph instead of fragile selectors; an empty result reads as a blocked page.
|
||||
@@ -98,13 +100,22 @@ for the model that orders the rest, then pick the task you have.
|
||||
- [How to scrape vacation rental listings with Playwright](how-to-scrape-vacation-rental-listings-playwright.md) - Drive the date and guest inputs, read the fee-inclusive total from the pricing XHR, iterate windows.
|
||||
- [How to scrape hotel room prices with Playwright](how-to-scrape-hotel-prices-playwright.md) - Drive the date and occupancy form, read the rate XHR: rates exist only when you query.
|
||||
- [How to scrape flight prices with Playwright](how-to-scrape-flight-prices-playwright.md) - Wait for the results-complete signal instead of networkidle, then read the settled fare matrix.
|
||||
- [How to scrape flight status boards with Playwright](how-to-scrape-flight-status-boards-playwright.md) - Snapshot a board that rewrites itself in one evaluation, keep scheduled and estimated apart, key rows on the service day.
|
||||
- [How to scrape ferry schedules with Playwright](how-to-scrape-ferry-schedules-playwright.md) - Query date by date because sailings are seasonal, keep direction in the key, record cancellations as events.
|
||||
- [How to scrape flexible-date fare calendars with Playwright](how-to-scrape-fare-calendars-playwright.md) - Wait for each month's price XHR before reading the grid, page forward across a seed-stable sweep.
|
||||
- [How to scrape event and ticket listings with Playwright](how-to-scrape-event-and-ticket-listings-playwright.md) - Wait for the availability XHR, normalise event times to the source timezone, step the calendar.
|
||||
- [How to scrape car listings with Playwright](how-to-scrape-car-listings-playwright.md) - Drive the faceted filter sidebar, wait on the results XHR, pull VIN and specs, then dedupe.
|
||||
- [How to scrape classifieds listings with Playwright](how-to-scrape-classifieds-listings-playwright.md) - Align proxy region and timezone, harvest cards from the rotating feed, drive a contact-reveal click.
|
||||
- [How to scrape business directory listings with Playwright](how-to-scrape-business-directory-listings-playwright.md) - Drive the search form, reveal click-gated phone and email, walk filtered pagination as one visitor.
|
||||
- [How to scrape pet adoption listings with Playwright](how-to-scrape-pet-adoption-listings-playwright.md) - Reconcile each run against the last so a disappearance is data, and key animals on the shelter's own identifier.
|
||||
- [How to scrape job postings with Playwright](how-to-scrape-job-postings-playwright.md) - Drive the faceted search filters, wait for the results XHR, and read the JobPosting JSON-LD.
|
||||
- [How to scrape cryptocurrency prices with Playwright](how-to-scrape-cryptocurrency-prices-playwright.md) - Read WebSocket frames, not the flickering DOM node, and hold the feed open with a stable identity.
|
||||
- [How to scrape EV charging availability with Playwright](how-to-scrape-ev-charging-availability-playwright.md) - Capture the status feed behind the map, keep the operator's timestamp apart from yours, store transitions not snapshots.
|
||||
- [How to scrape fuel prices with Playwright](how-to-scrape-fuel-prices-playwright.md) - Set the location explicitly, keep grade and unit with every price, and record whether the number was reported or observed.
|
||||
- [How to scrape snow reports with Playwright](how-to-scrape-snow-reports-playwright.md) - Pin the unit before reading, keep base and summit as separate measurements, and take the resort's own report time.
|
||||
- [How to scrape parking rates with Playwright](how-to-scrape-parking-rates-playwright.md) - Capture the tariff table as duration bands instead of a price, and keep the small print that outranks the table.
|
||||
- [How to scrape energy tariff comparisons with Playwright](how-to-scrape-energy-tariffs-playwright.md) - Drive the consumption form, keep standing charge and unit rate apart, and copy the inputs into every quoted row.
|
||||
- [How to scrape bank interest rates with Playwright](how-to-scrape-bank-interest-rates-playwright.md) - Resolve the footnote markers while you have the DOM, keep the balance tiers as rows, and take the effective date.
|
||||
- [How to scrape stock and financial data with Playwright](how-to-scrape-stock-and-financial-data-playwright.md) - Scrape fundamentals from tables, capture the live quote stream at the WebSocket or polling XHR.
|
||||
- [How to scrape sports scores and stats with Playwright](how-to-scrape-sports-scores-and-stats-playwright.md) - Read the score feed over a WebSocket, click each stat tab to trigger its XHR, one long session.
|
||||
- [How to scrape forum and community threads with Playwright](how-to-scrape-forum-and-community-threads-playwright.md) - Walk the reply tree depth-first, expand collapsed branches over XHR, strip quoted text.
|
||||
@@ -150,7 +161,11 @@ for the model that orders the rest, then pick the task you have.
|
||||
- [How to scrape breadcrumb hierarchies with Playwright](how-to-scrape-breadcrumb-hierarchies-playwright.md) - read the trail from the markup instead of the truncated text, drop the self crumb, keep the category id from the href, and merge trails o...
|
||||
- [How to scrape fitness class schedules with Playwright](how-to-scrape-class-schedules-playwright.md) - key each row by studio, instructor, room and start time instead of the occurrence id, fetch spots remaining and waitlist state from their...
|
||||
- [How to scrape clinical trial listings with Playwright](how-to-scrape-clinical-trial-listings-playwright.md) - timestamp every status read, carry both trial identifiers, keep eligibility criteria as text, and split target enrollment from site-level...
|
||||
- [How to scrape conference agendas with Playwright](how-to-scrape-conference-agendas-playwright.md) - read the grid as tracks over time so a session keeps its column, resolve the event timezone once, and follow the session pages for speakers.
|
||||
- [How to scrape construction permit records with Playwright](how-to-scrape-construction-permits-playwright.md) - drive the postback search, assert the result count the portal prints, and capture the status history rather than the current stage.
|
||||
- [How to scrape course catalogs with Playwright](how-to-scrape-course-catalogs-playwright.md) - the catalog is a four-level tree, the seat counts live behind a term parameter, and one row per section is the only shape that survives a...
|
||||
- [How to scrape court docket listings with Playwright](how-to-scrape-court-dockets-playwright.md) - work from case numbers you can name rather than enumerating, keep the court's own sequence numbers, and pace it with a written daily cap.
|
||||
- [How to scrape CSS pseudo-element content with Playwright](how-to-scrape-css-pseudo-element-content-playwright.md) - text injected by ::before and ::after is not in the DOM, so read it from getComputedStyle and unwrap the quoted CSS value.
|
||||
- [How to scrape cursor-based pagination with Playwright](how-to-scrape-cursor-pagination-playwright.md) - read endCursor and hasNextPage out of the JSON payload, pass the token back untouched, and checkpoint it with the last item id.
|
||||
- [How to scrape delivery slots with Playwright](how-to-scrape-delivery-slots-playwright.md) - a slot row is keyed to a postcode, a basket and a UTC moment, the grid arrives one week per request, and full is not the same as not offe...
|
||||
- [How to scrape domain WHOIS records with Playwright](how-to-scrape-domain-whois-records-playwright.md) - Scrape WHOIS records with Playwright by parsing labeled fields instead of positions, treating REDACTED FOR PRIVACY as a real value, keepi...
|
||||
@@ -159,13 +174,17 @@ for the model that orders the rest, then pick the task you have.
|
||||
- [How to scrape GraphQL endpoints with Playwright](how-to-scrape-graphql-endpoints-playwright.md) - filter captured calls by the operationName in the POST body, replay persisted queries by hash, check the errors array on a 200, and page ...
|
||||
- [How to scrape infinite carousels with Playwright](how-to-scrape-infinite-carousels-playwright.md) - mark the cloned wrap slides by their own attribute, pause autoplay through reduced motion, track the real slide index, and stop when an i...
|
||||
- [How to scrape insurance quotes with Playwright](how-to-scrape-insurance-quotes-playwright.md) - fill the whole multi-step form fresh per profile, read only the final-step response, and capture every tier a tabbed result renders in on...
|
||||
- [How to scrape library catalog availability with Playwright](how-to-scrape-library-catalog-availability-playwright.md) - read holdings per copy and per branch instead of the record badge, stay inside the session the catalogue issued, and keep its status vocabulary.
|
||||
- [How to scrape live sports scores with Playwright](how-to-scrape-live-sports-scores-playwright.md) - read match state alongside the score, timestamp every update against its own clock, and accept that a score can go down after a VAR review.
|
||||
- [How to scrape currency and locale switchers with Playwright](how-to-scrape-locale-switchers-playwright.md) - find which signal the site obeys by moving one at a time, record the final URL, and separate a display conversion from a real regional pr...
|
||||
- [How to scrape microdata and RDFa markup with Playwright](how-to-scrape-microdata-markup-playwright.md) - walk [itemscope] and [itemprop] with page.evaluate, apply the nine-case value rule instead of textContent, resolve itemref, and read RDFa...
|
||||
- [How to scrape multi-select facet filters with Playwright](how-to-scrape-multi-select-facets-playwright.md) - expand show-more first, wait for the facet response before reading counts, store the state URL on every row, and sweep one group at a time.
|
||||
- [How to scrape newsletter archives with Playwright](how-to-scrape-newsletter-archives-playwright.md) - page until the archive repeats or runs dry, read the hosted rendering instead of the sent email, and resolve tracking-redirect links once...
|
||||
- [How to scrape numbers rendered as images with Playwright](how-to-scrape-numbers-rendered-as-images-playwright.md) - look in the accessible layer and the sprite offsets before reaching for pixels, and compare decoded pixels rather than PNG bytes.
|
||||
- [How to scrape nutrition labels with Playwright](how-to-scrape-nutrition-labels-playwright.md) - map every column to its per 100 g, per serving or per package basis, split the serving size, keep kilojoules and kilocalories apart, and ...
|
||||
- [How to scrape open data portals with Playwright](how-to-scrape-open-data-portals-playwright.md) - name the catalogue product from its JSON response shape, page its documented listing API, and open a browser only where the search UI hid...
|
||||
- [How to scrape package download statistics with Playwright](how-to-scrape-package-download-stats-playwright.md) - take the series the chart draws from, keep the version breakdown, and carry the mirror and CI caveats next to the number.
|
||||
- [How to scrape package tracking status with Playwright](how-to-scrape-package-tracking-playwright.md) - capture the event timeline rather than the headline status, merge revisions instead of appending, and widen the poll when nothing moves.
|
||||
- [How to scrape patent listings with Playwright](how-to-scrape-patent-listings-playwright.md) - bind each date to its labeled field, keep family members and claim dependencies intact instead of flattening them, and stamp legal status...
|
||||
- [How to scrape podcast episode listings with Playwright](how-to-scrape-podcast-episodes-playwright.md) - find the RSS feed behind the player, key episodes on the guid, and parse durations and episode numbers that arrive in several shapes.
|
||||
- [How to scrape podcast transcripts with Playwright](how-to-scrape-podcast-transcripts-playwright.md) - fetch the underlying VTT or SRT file instead of scrolling the panel, keep cue timing and text as rows, and detect speaker labels and auto...
|
||||
@@ -174,12 +193,15 @@ for the model that orders the rest, then pick the task you have.
|
||||
- [How to scrape range slider filters with Playwright](how-to-scrape-range-slider-filters-playwright.md) - read aria-valuenow instead of calling fill, prefer the URL parameter, wait for the debounced response, and sweep the field in half-open b...
|
||||
- [How to scrape recipe data with Playwright](how-to-scrape-recipe-data-playwright.md) - read the JSON-LD Recipe node, flatten the three recipeInstructions shapes, split ingredient strings, and parse ISO 8601 times.
|
||||
- [How to scrape salary and pay scale data with Playwright](how-to-scrape-salary-data-playwright.md) - expand the hidden pay breakdown, keep the range and period intact, tag self-reported figures apart from wage statistics, and carry sample...
|
||||
- [How to scrape scholarship listings with Playwright](how-to-scrape-scholarship-listings-playwright.md) - parse the deadline into a shape that admits it is often not a date, keep eligibility as prose, and follow through to the provider page.
|
||||
- [How to scrape school term calendars with Playwright](how-to-scrape-school-term-calendars-playwright.md) - prefer the calendar feed the page links to, expand ranges with an inclusive end, and keep a closure distinct from a staff day.
|
||||
- [How to scrape flight seat maps with Playwright](how-to-scrape-seat-maps-playwright.md) - Scrape flight seat maps with Playwright by reading each seat's own data attribute instead of its position, joining status and pricing fro...
|
||||
- [How to scrape server-sent events with Playwright](how-to-scrape-server-sent-events-playwright.md) - the response event fires but body() never returns, so replace window.EventSource in an init script, wrap fetch, and parse text/event-stre...
|
||||
- [How to scrape shipping rates with Playwright](how-to-scrape-shipping-rates-playwright.md) - a rate is keyed to destination, weight, dimensions and service level, the quote response carries surcharge lines the total hides, and fre...
|
||||
- [How to scrape size charts with Playwright](how-to-scrape-size-charts-playwright.md) - open the modal that holds the table, record which unit the toggle had active, detect row-versus-column orientation, and mark image-only c...
|
||||
- [How to scrape software changelogs and release notes with Playwright](how-to-scrape-software-changelogs-playwright.md) - detect the page shape, parse versions into sortable tuples, read the change type from the heading above each bullet, and stop at the vers...
|
||||
- [How to scrape sortable data tables with Playwright](how-to-scrape-sortable-tables-playwright.md) - read rows once keyed on an identifier, trust aria-sort over a click count, and sort the data yourself instead of the page's own string co...
|
||||
- [How to scrape spare part compatibility with Playwright](how-to-scrape-spare-part-compatibility-playwright.md) - drive the cascading dropdowns waiting on each level to repopulate, key results on the whole path, and keep the fitment notes.
|
||||
- [How to scrape stock levels with Playwright](how-to-scrape-stock-levels-playwright.md) - the badge is a bucket, the number lives in the variant endpoint, and a reading without a timestamp and a variant id is not a stock level.
|
||||
- [How to scrape store locator pages with Playwright](how-to-scrape-store-locator-pages-playwright.md) - seed the search with a point grid instead of postcodes, read the radius endpoint rather than the cards, and dedupe on the store id becaus...
|
||||
- [How to scrape public tender notices with Playwright](how-to-scrape-tender-notices-playwright.md) - one row per lot, deadlines kept with the offset the response carries, classification-code filters, and a re-scrape that reconciles revisi...
|
||||
@@ -192,3 +214,8 @@ for the model that orders the rest, then pick the task you have.
|
||||
- [How to scrape weather station data with Playwright](how-to-scrape-weather-station-data-playwright.md) - Scrape weather station data with Playwright by capturing the observation feed instead of the rendered table, converting timestamps to UTC...
|
||||
- [How to scrape WebSocket streams with Playwright](how-to-scrape-websocket-streams-playwright.md) - subscribe with page.on('websocket'), classify each frame before parsing, apply the deltas to a snapshot, and stamp every row with a UTC r...
|
||||
- [How to scrape wine and spirits catalogs with Playwright](how-to-scrape-wine-catalog-playwright.md) - key rows by name, vintage and bottle size, pass the age gate once per context, and normalize critic scores before averaging them.
|
||||
- [How to Handle a PDF That Opens in a New Tab with Playwright](how-to-handle-pdf-opens-new-tab-playwright.md) - Catch the new page with `context.expect_page()`, then pull the real bytes instead of screenshotting the viewer.
|
||||
- [Does Playwright Support Firefox Extensions?](does-playwright-support-firefox-extensions.md) - The documented extension API is Chromium-only; loading an .xpi into Firefox means a persistent profile, not a launch flag.
|
||||
- [Automating an Email OTP / Verification-Link Login with Playwright](automating-email-otp-verification-login-playwright.md) - Poll your own inbox over IMAP mid-login and feed the code back into the same session that requested it.
|
||||
- [Automating TOTP-Based 2FA Login with Playwright](automating-totp-2fa-login-playwright.md) - Generate a time-based code with pyotp from the same shared secret an authenticator app would scan; no inbox, no polling.
|
||||
- [How to Scrape a Sandboxed Iframe with Playwright](how-to-scrape-sandboxed-iframe-content-playwright.md) - A `sandbox` attribute can block Playwright's own injected scripts even on a same-origin frame; what the tokens restrict and how to detect it first.
|
||||
@@ -21,6 +21,21 @@ telling the difference before you ship a fix, not after.
|
||||
- [Can You Run Playwright Without Being Detected?](can-you-run-playwright-without-being-detected.md) - what removing browser-level tells clears, and the three signals it does not fix.
|
||||
- [Is Playwright Headless Detectable?](is-playwright-headless-detectable.md) - classic headless leaks its user agent, WebGL, window metrics and fonts; why output parity beats per-tell patching.
|
||||
- [Does Playwright Trigger reCAPTCHA More Often?](does-playwright-trigger-recaptcha.md) - how reCAPTCHA scores fingerprint, IP, session age and behaviour, and which inputs an engine can move.
|
||||
- [net::ERR_SSL_PROTOCOL_ERROR in Playwright](err-ssl-protocol-error-playwright.md) - The TLS handshake itself broke, before any certificate was evaluated; why `ignoreHTTPSErrors` does not fix it.
|
||||
- [net::ERR_CONNECTION_TIMED_OUT in Playwright](err-connection-timed-out-playwright.md) - The browser's own network stack giving up, a separate mechanism from Playwright's configurable `TimeoutError`.
|
||||
- [net::ERR_NETWORK_CHANGED in Playwright](err-network-changed-playwright.md) - Fires when the OS reports a network interface change mid-request; common and usually transient in CI.
|
||||
- [TimeoutError: Timeout 30000ms Exceeded](playwright-timeout-30000ms-exceeded.md) - The client giving up on waiting for an action or navigation; why raising the number is usually the wrong first move.
|
||||
- [Playwright "Frame Was Detached" Error](playwright-frame-was-detached-error.md) - The iframe itself was removed from the page's frame tree, usually by a framework remounting a widget.
|
||||
- [Playwright "Protocol Error (Page.navigate)"](playwright-protocol-error-page-navigate.md) - An internal navigation command rejected on Chromium and Firefox alike, not the same failure as TargetClosedError.
|
||||
- [Playwright Strict Mode Violation: Resolved to N Elements](playwright-strict-mode-violation.md) - Playwright refuses to guess which matching element you meant; the fix is a more specific locator.
|
||||
- [Playwright "Element Is Not Attached to the DOM"](playwright-element-not-attached-to-dom.md) - A framework re-render swaps the element out in the gap between resolution and action.
|
||||
- [Playwright "Subtree Intercepts Pointer Events"](playwright-element-click-intercepted.md) - Something else sits on top of the target; `force:true` clicks through it instead of finding out what.
|
||||
- [Content-Security-Policy Blocks Playwright's Injected Scripts](content-security-policy-blocks-playwright-scripts.md) - A page's CSP can refuse `addInitScript`; what `bypassCSP` fixes and what it changes about the test.
|
||||
- [Playwright "Executable Doesn't Exist" After Install](playwright-executable-doesnt-exist.md) - The most common first-run error, and its Docker, CI and serverless variants.
|
||||
- [Playwright "Page Crashed" Error](playwright-page-crashed-error.md) - An OOM-killed content process versus an actual engine bug, and how to tell them apart.
|
||||
- [Does Playwright Trigger hCaptcha More Often?](does-playwright-trigger-hcaptcha.md) - How hCaptcha's invisible pass reads fingerprint, IP and session inputs, and which of those an engine can actually move.
|
||||
- [Playwright Firefox: SEC_ERROR_UNKNOWN_ISSUER](playwright-firefox-sec-error-unknown-issuer.md) - Firefox's own NSS certificate-trust error, not a Chromium string; why curl works in a container and Firefox still fails.
|
||||
- [Playwright ERR_BLOCKED_BY_CLIENT via page.route](playwright-err-blocked-by-client-page-route.md) - Request blocking with `page.route()` reproduces the exact string a real ad-blocker extension produces.
|
||||
|
||||
## When you get blocked or detected
|
||||
|
||||
@@ -35,7 +50,11 @@ telling the difference before you ship a fix, not after.
|
||||
- [Playwright TargetClosedError: the causes and the fixes](playwright-targetclosederror-causes.md) - usually not a timeout; three specific Firefox and Juggler causes, their symptoms, and how to tell them apart.
|
||||
- [Firefox preferences that silently do nothing](firefox-prefs-not-applying.md) - a preference you set can be silently ignored with no error; the reasons in order, and how to confirm which one you hit.
|
||||
|
||||
- [First Firefox launch fails on Windows, then works](first-firefox-launch-fails-then-works-windows.md) - The first launch of a freshly extracted build fails, every later one works: what Windows remembers between the two.
|
||||
- [Keep Playwright Firefox memory flat on long runs](playwright-firefox-memory-long-runs.md) - Memory that grows over a long run comes from unclosed contexts, an accumulating list, or one context kept too long.
|
||||
|
||||
## Canvas, screenshots and fingerprint noise
|
||||
|
||||
- [Canvas fingerprint changes every run: use a seed](canvas-fingerprint-changes-every-run.md) - canvas, WebGL and audio hashes change each run; pass a fixed seed to make readbacks byte-identical.
|
||||
- [Playwright screenshot returns noise: readback fix](playwright-screenshot-returns-noise.md) - why page.screenshot() returned a noise PNG, and the principal-split canvas readback fix that made captures clean.
|
||||
- [Missing fonts in Docker break Playwright screenshots](playwright-firefox-fonts-docker.md) - A container ships almost no fonts, so text renders as boxes or as the wrong family.
|
||||
@@ -0,0 +1,198 @@
|
||||
---
|
||||
title: "hCaptcha Enterprise vs Standard"
|
||||
description: "hCaptcha Enterprise is not a harder version of the free widget, it is the same invisible-pass-plus-puzzle mechanism with custom difficulty tuning, dedicated risk models, an SLA, and a cash relationship instead of the free tier's labeled-data economy. What changes, from hCaptcha's own docs."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 43
|
||||
---
|
||||
|
||||
|
||||
# hCaptcha Enterprise vs Standard
|
||||
|
||||
This page assumes you already know how hCaptcha's two-stage mechanism works, the
|
||||
invisible risk pass and the visual puzzle it escalates to when that pass is unsure.
|
||||
[That is covered in full on its own page](hcaptcha-explained.md), and this one does not
|
||||
repeat it. What follows is specifically what changes between the free Basic tier, the
|
||||
mid-tier Pro plan, and Enterprise: what each adds, what it costs, and which parts stay,
|
||||
underneath, the same mechanism.
|
||||
|
||||
The short version: Enterprise is not a stricter widget. It is the same
|
||||
checkbox-or-invisible, escalate-to-a-puzzle model, given a visible risk score, custom
|
||||
challenge content, difficulty controls a free integration never sees, and a support
|
||||
contract, sold as a metered or negotiated product, not embedded for free in
|
||||
exchange for the puzzle answers themselves.
|
||||
|
||||
## Three tiers, not two
|
||||
|
||||
hCaptcha's own pricing and plans pages describe three tiers, not a simple free/paid
|
||||
split. **Basic** is free, with an allowance hCaptcha's own plans page states as "10,000
|
||||
requests/month," and hCaptcha's own FAQ describes Basic ("Publisher") accounts as
|
||||
choosing among four fixed difficulty modes: "Easy, Medium, Difficult, and Auto." **Pro**
|
||||
is a paid, self-serve tier priced, per hCaptcha's own pricing page, at "$99/month"
|
||||
billed annually or "$139/month" billed monthly, including 100,000 evaluations a month
|
||||
with overage at "$0.99/1K" beyond that, with a two-week free trial. **Enterprise** is
|
||||
custom-priced and sold through a sales contact, not a checkout page.
|
||||
|
||||
## What Pro adds over Basic
|
||||
|
||||
Pro's own documentation describes its centerpiece as "99.9% Passive" mode, the default
|
||||
for new Pro sitekeys, an evaluation "derived from thousands of factors" aimed at showing
|
||||
a visible challenge to "less than 0.1% of users" while still, per hCaptcha's own
|
||||
framing, "increasing the costs of an attack in virtually all cases." hCaptcha's own
|
||||
plans page lists Pro as also adding bot risk scores and threat signatures, custom
|
||||
widget themes, more detailed analytics than Basic, and room for a small team, up to five
|
||||
members, to share sitekeys and dashboards.
|
||||
|
||||
None of this exists on Basic. A Basic integration is limited to the four fixed
|
||||
difficulty levels named above and does not get the passive-mode risk evaluation, the
|
||||
score, or the analytics.
|
||||
|
||||
## What Enterprise adds on top of Pro
|
||||
|
||||
This is the part that is a genuine capability gap instead of a bigger number on the
|
||||
same feature, and hCaptcha's own plans page names it directly: **private learning**,
|
||||
described as training detection models on an Enterprise customer's own traffic patterns
|
||||
in place of a shared, general model, plus **custom challenges** and **challenge content
|
||||
control**, meaning an Enterprise account can bring its own images or questions instead
|
||||
of using hCaptcha's default challenge pool. hCaptcha's plans page also lists **human
|
||||
threat detection**, **difficulty tuning**, called out specifically as including the
|
||||
ability to "raise and lower challenge difficulty based on time of day," and, on the
|
||||
program-management side, multi-user dashboards with SAML SSO, advanced analytics and
|
||||
reporting APIs, and Enterprise-level SLAs.
|
||||
|
||||
hCaptcha's own FAQ separately describes Enterprise as unlocking two difficulty modes
|
||||
Pro and Basic do not have at all, "Passive" alongside "99.9% Passive," plus
|
||||
"sophisticated custom threat models" and "detailed bot scores" beyond what Pro's flat
|
||||
risk score exposes.
|
||||
|
||||
Put together, the shape of the gap is: Pro turns on a shared risk model and a passive
|
||||
mode; Enterprise turns on a model trained specifically on that customer's own traffic,
|
||||
gives that customer direct control over what the puzzle even looks like, and adds the
|
||||
operational scaffolding (SLA, SSO, reporting) an organization actually deploying this at
|
||||
scale asks for. None of it is a stricter version of the puzzle itself, it is control
|
||||
over when and how the puzzle appears, and how well the risk model fits one customer's
|
||||
own traffic instead of the general population hCaptcha sees.
|
||||
|
||||
| | Basic (free) | Pro | Enterprise |
|
||||
|---|---|---|---|
|
||||
| Price | $0 | $99-139/mo, 100K evals incl. | Custom |
|
||||
| Difficulty control | 4 fixed modes (Easy/Medium/Difficult/Auto) | Adds 99.9% Passive | Adds Passive, plus time-of-day tuning |
|
||||
| Risk score visible to you | No | Yes (bot risk scores, threat signatures) | Yes, plus custom threat models |
|
||||
| Model trained on | Shared, general | Shared, general | Your own traffic ("private learning") |
|
||||
| Challenge content | hCaptcha's default pool | hCaptcha's default pool | Customer-supplied images/questions |
|
||||
| Team/SSO/SLA | No | Up to 5 users | Multi-user dashboards, SAML SSO, SLA |
|
||||
|
||||
## The relationship changes too, not just the feature list
|
||||
|
||||
This is the differentiator that is easy to miss if you only read the feature tables,
|
||||
and it is stated plainly in a blog post from HUMAN Protocol, the labor marketplace
|
||||
hCaptcha's compensation model runs through: "hCaptcha also compensates integrators for
|
||||
the work their users do as they verify their humanity," framing that work as
|
||||
"annotation" feeding machine-learning training. The same post draws the Enterprise line
|
||||
explicitly: "Enterprise integrators of the hCaptcha security service like Cloudflare pay
|
||||
IM [Intuition Machines] for more features, rather than being compensated."
|
||||
|
||||
Read plainly, a free-tier integration sits inside a labeled-data economy: visitors solve
|
||||
puzzles, the site owner is compensated for that work, and hCaptcha's own labeling
|
||||
product resells the resulting annotations to machine-learning customers, described on
|
||||
[the hCaptcha explainer page](hcaptcha-explained.md#the-part-that-pays-for-the-free-tier-labeled-data)
|
||||
in full. An Enterprise integration is a direct commercial customer instead, paying
|
||||
Intuition Machines in money for the extra tier of product, rather than the arrangement
|
||||
running the other direction. That is a genuinely different relationship, not a
|
||||
messaging choice, and it is the closest hCaptcha equivalent to
|
||||
[the free-vs-metered split covered on the reCAPTCHA Enterprise page](recaptcha-enterprise-vs-v3.md#pricing-the-free-tier-is-smaller-than-v3s-used-to-feel),
|
||||
even though the mechanisms behind the two vendors' free tiers are not the same thing.
|
||||
|
||||
## What this means for anything actually being scored
|
||||
|
||||
Nothing about Enterprise's extra machinery changes what a browser engine can honestly
|
||||
answer versus what it cannot, because every tier sits on the same underlying widget and
|
||||
`siteverify` mechanism described on [the hCaptcha explainer page](hcaptcha-explained.md):
|
||||
an invisible pass first, a visual puzzle only if that pass is unsure, and a server-side
|
||||
token check either way. [The reasoning that applies to a Playwright session against the
|
||||
free tier](does-playwright-trigger-hcaptcha.md) applies without modification against
|
||||
Enterprise's version of the same pass: a real, engine-level browser answers the
|
||||
JavaScript-visible fingerprint surface honestly, which narrows one input among several
|
||||
undisclosed ones, and does nothing for the address you connect from or the history a
|
||||
session does or does not carry. Private learning specifically cannot be addressed by
|
||||
engine realness at all, because a model trained on one Enterprise customer's own traffic
|
||||
patterns is a property of that customer's deployment and its accumulated data, not of
|
||||
any single browser session run against it.
|
||||
|
||||
`invisible_playwright` does not include a private-learning workaround, a custom-challenge
|
||||
bypass, or any feature that changes a hCaptcha risk score or a puzzle escalation
|
||||
decision, on Basic, Pro, or Enterprise. What honest engine behavior affects here is
|
||||
exactly what it affects on the free tier and no more: it keeps the fingerprint-and-engine
|
||||
portion of the assessment from contradicting itself.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Is hCaptcha Enterprise just a harder version of the free widget?** No. All three
|
||||
tiers run the same invisible-pass-then-puzzle mechanism. Enterprise adds a risk model
|
||||
trained on the customer's own traffic, control over the puzzle's content, time-of-day
|
||||
difficulty tuning, and operational features (SSO, SLA, reporting) the free and Pro tiers
|
||||
do not have.
|
||||
|
||||
**What is the actual difference between Pro and Enterprise?** Pro turns on a shared,
|
||||
general risk model and a passive (low-friction) mode. Enterprise adds a model trained
|
||||
specifically on that customer's traffic ("private learning"), custom challenge content,
|
||||
an extra "Passive" difficulty tier, and enterprise support and reporting.
|
||||
|
||||
**Does Enterprise cost money the way Pro does?** Yes, but it is negotiated rather than a
|
||||
published metered rate; Pro is a published $99-139/month tier with per-evaluation
|
||||
overage, while Enterprise pricing is not published and requires contacting hCaptcha
|
||||
directly.
|
||||
|
||||
**Is the free tier really "paid for" by the puzzle answers?** According to hCaptcha's
|
||||
own labeling product and a HUMAN Protocol blog post describing the compensation model,
|
||||
yes in substance: free-tier site owners are compensated for the annotation work their
|
||||
visitors do, and hCaptcha's own labeling business resells that annotation category to
|
||||
machine-learning customers. hCaptcha's own privacy FAQ denies selling individually
|
||||
targeted ads or personal data specifically, which is a narrower claim than a denial that
|
||||
labeled answers are monetized.
|
||||
|
||||
**Do Enterprise customers participate in that same labeling economy?** Per the same
|
||||
HUMAN Protocol post, no: "Enterprise integrators of the hCaptcha security service like
|
||||
Cloudflare pay IM for more features, rather than being compensated," describing a direct
|
||||
cash relationship instead.
|
||||
|
||||
**Does a real browser engine answer Enterprise's assessment any differently than
|
||||
Basic's?** No. All three tiers share the same underlying mechanism, and the reasoning
|
||||
that already applies to a Playwright session against Basic or Pro applies to
|
||||
Enterprise's version of the same pass unchanged. Private learning, being trained on a
|
||||
specific customer's own traffic history, is outside what any single browser session can
|
||||
affect at all.
|
||||
|
||||
**See also:** [hCaptcha, Explained](hcaptcha-explained.md) for the underlying mechanism
|
||||
this page builds on, and [Does Playwright Trigger hCaptcha More Often?](does-playwright-trigger-hcaptcha.md)
|
||||
for what a Playwright session specifically does to that mechanism regardless of tier.
|
||||
|
||||
## Sources
|
||||
|
||||
- hCaptcha, [Pricing](https://www.hcaptcha.com/pricing), retrieved 2026-08-30, for the
|
||||
Basic/Pro/Enterprise price points and the Pro evaluation allowance and overage rate.
|
||||
- hCaptcha, [Plans](https://www.hcaptcha.com/plans), retrieved 2026-08-30, for the
|
||||
feature-by-tier breakdown (free-tier request allowance, Pro's risk scores and threat
|
||||
signatures, Enterprise's private learning, custom challenges, challenge content
|
||||
control, time-of-day difficulty tuning, multi-user dashboards, SAML SSO, and SLAs).
|
||||
- hCaptcha, [Pro Features](https://docs.hcaptcha.com/pro), retrieved 2026-08-30, for the
|
||||
"99.9% Passive" mode description, its "thousands of factors" and "less than 0.1%"
|
||||
framing, and the Pro pricing and trial terms.
|
||||
- hCaptcha, [Frequently Asked Questions](https://docs.hcaptcha.com/faq), retrieved
|
||||
2026-08-30, for the four Basic-tier difficulty modes and the Enterprise-only "Passive"
|
||||
mode plus "sophisticated custom threat models" and "detailed bot scores" framing.
|
||||
- HUMAN Protocol, ["How does hCaptcha fit into HUMAN Protocol?"](https://humanprotocol.org/blog/how-does-hcaptcha-fit-into-human-protocol),
|
||||
retrieved 2026-08-30, for the integrator-compensation model on the free tier and the
|
||||
explicit statement that Enterprise customers like Cloudflare pay Intuition Machines
|
||||
directly rather than being compensated.
|
||||
- hCaptcha, [Data Labeling](https://www.hcaptcha.com/labeling), retrieved 2026-08-30, for
|
||||
the annotation-service pitch that the free-tier economy above feeds into.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. Enterprise's extra
|
||||
machinery is risk-model customization, challenge content control, and a paid support
|
||||
contract on top of a mechanism this project already writes about on the main hCaptcha
|
||||
page; nothing here should be read as a claim that engine realness moves a private
|
||||
learning model trained on someone else's traffic, which this project has no access to.*
|
||||
@@ -0,0 +1,244 @@
|
||||
---
|
||||
title: "hCaptcha, Explained"
|
||||
description: "hCaptcha runs an invisible risk pass first and only falls back to a visual image-classification puzzle when that pass is unsure. It also doubles as a data-labeling business: puzzle answers train other companies' machine learning models. Read from hCaptcha's own docs."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 42
|
||||
---
|
||||
|
||||
|
||||
# hCaptcha, Explained
|
||||
|
||||
hCaptcha is a real captcha, not a background score wearing a captcha's name. Most of the
|
||||
time a visitor never sees it: an invisible pass runs first and only escalates to a
|
||||
visible puzzle when that pass is unsure. When it escalates, the puzzle is an actual
|
||||
image-classification task, select every image matching a label, the same family of
|
||||
thing reCAPTCHA v2 and GeeTest ask for.
|
||||
|
||||
Be clear about what this page is before reading further, because that distinction
|
||||
matters more here than on most pages in this corpus. This page explains the mechanism,
|
||||
read from hCaptcha's own documentation and independent, checkable sources. It is not
|
||||
instructions for solving the puzzle automatically, and `invisible_playwright` includes
|
||||
no puzzle-solving or captcha-solving capability, for hCaptcha or any other vendor. That
|
||||
boundary is stated once here, plainly, and repeated at the end of this page.
|
||||
|
||||
## What hCaptcha is
|
||||
|
||||
hCaptcha is a product of Intuition Machines, Inc., described in its own materials as
|
||||
"the world's most widely used independent CAPTCHA service," positioned against Google's
|
||||
reCAPTCHA on privacy and reach: "Unlike reCAPTCHA, we work in every country," with a
|
||||
claimed "Zero-PII architecture" and compliance with GDPR, CCPA, LGPD and PIPL. Its
|
||||
homepage describes current scale as "hundreds of millions of people around the world"
|
||||
and "the largest independent service of its kind," without a specific volume figure.
|
||||
|
||||
An independent reference work places its introduction in 2018. The most concrete public
|
||||
data point on adoption is independently reported rather than hCaptcha's own: Cloudflare's
|
||||
April 2020 switch away from reCAPTCHA, citing Google's advertising business, reCAPTCHA
|
||||
being blocked in China alongside every other Google service, and a newly announced
|
||||
reCAPTCHA price that would have cost Cloudflare, in its own account, millions of dollars
|
||||
a year to keep using for free.
|
||||
|
||||
## The two-stage model: an invisible pass, then maybe a puzzle
|
||||
|
||||
hCaptcha's own developer documentation describes the flow in two stages. First, "the
|
||||
user starts an hCaptcha evaluation: they click the checkbox or submit button, or you
|
||||
trigger it programmatically" through `hcaptcha.execute(widgetID)`. Second, once that
|
||||
evaluation finishes, "the hCaptcha script inserted a unique token into your form data,"
|
||||
which the integrating site's own backend then has to check.
|
||||
|
||||
The part that matters for automation is what happens between those two steps. A widget
|
||||
configured with `data-size="invisible"` renders nothing, and per hCaptcha's own
|
||||
documentation, "the widget will be rendered in the background and only presented when a
|
||||
challenge is required." Whether a challenge is required is a per-session decision:
|
||||
"the user will only be presented with a hCaptcha challenge if that user meets challenge
|
||||
criteria." hCaptcha's FAQ names the inputs to that decision only at the category level:
|
||||
"computed confidence in the visitor's humanity, the site difficulty setting, and other
|
||||
security factors." Neither document lists the specific signals or weights behind that
|
||||
confidence figure, and no page in this corpus claims to know them.
|
||||
|
||||
The clearest description of the invisible pass's intent comes from hCaptcha's own
|
||||
Pro-tier documentation, describing its highest-friction-reduction mode: an evaluation
|
||||
"derived from thousands of factors," built to "minimize challenges to real people to
|
||||
less than 0.1% of users, while still increasing the costs of an attack in virtually all
|
||||
cases." That shape, thousands of undisclosed factors feeding one pass/challenge
|
||||
decision, matches the risk engines covered elsewhere in this corpus for
|
||||
[Turnstile](cloudflare-turnstile-explained.md) and
|
||||
[Arkose Labs](arkose-labs-funcaptcha-explained.md): broad category claims, no published
|
||||
field list. One input is visible in the API itself: the server-side verification call
|
||||
accepts an optional `remoteip` parameter, recommended "for accuracy," about as direct a
|
||||
confirmation as a vendor gets that the requesting address feeds the decision too.
|
||||
|
||||
## The puzzle, when it appears
|
||||
|
||||
When the invisible pass escalates, a Basic (free, "Publisher") account has four fixed
|
||||
difficulty modes to pick from: "Easy, Medium, Difficult, and Auto." hCaptcha's own FAQ
|
||||
states a completed challenge takes "about the same as a traditional captcha: 3-10
|
||||
seconds depending on the difficulty mode," the same rough time budget as a reCAPTCHA v2
|
||||
checkbox-and-grid flow.
|
||||
|
||||
hCaptcha's own documentation does not spell out the puzzle's visual format in technical
|
||||
detail. An independent, encyclopedic reference describes it as asking a visitor to
|
||||
"select all images matching a generated query, called a label," which matches how
|
||||
hCaptcha's own data-labeling materials describe the underlying task category: bounding
|
||||
boxes, polygons, landmarks and attribute categorization on images and video. The puzzle
|
||||
a visitor solves and the annotation task a machine-learning customer pays for are, per
|
||||
that framing, the same category of work, which is the subject of the next section.
|
||||
|
||||
## The part that pays for the free tier: labeled data
|
||||
|
||||
hCaptcha's business model is unusual among captcha vendors in that the company is
|
||||
explicit, in its own public materials, about running a second product built on the same
|
||||
challenges visitors solve. hCaptcha's own labeling page pitches a data-annotation service
|
||||
directly at "companies working on artificial intelligence and machine learning
|
||||
applications," describing the same task types, bounding boxes, polygons, landmarks,
|
||||
categorization, that show up in the visual puzzle, and framing the pitch around solving
|
||||
"the most labor intensive problem in machine learning: labeling massive amounts of data
|
||||
in a timely, affordable, and reliable way."
|
||||
|
||||
hCaptcha's own FAQ is specific about what it does not do with the data it collects: "we
|
||||
are not in the business of selling individually targeted ads," and it works "to protect
|
||||
your personal data and limit collection rather than selling it to others." That is a
|
||||
claim about advertising and personal data, narrower than a claim that labeled answers
|
||||
are never monetized, and it should be read exactly that narrowly. An independent
|
||||
reference states plainly that "hCaptcha makes revenue by selling its datasets to 3rd
|
||||
party companies," and a blog post from HUMAN Protocol, the labor marketplace hCaptcha
|
||||
is connected to, describes hCaptcha compensating the sites that embed it for "the work
|
||||
their users do as they verify their humanity," framing that work as "annotation," a
|
||||
"vital part of building and improving machine intelligence." The same post draws a
|
||||
clean line on the other side of that arrangement: "Enterprise integrators... like
|
||||
Cloudflare pay IM [Intuition Machines] for more features, rather than being
|
||||
compensated." Free-tier integrations sit inside a labor-and-payment loop; Enterprise
|
||||
integrations pay cash instead.
|
||||
|
||||
That split, an ad-and-labeling-funded free tier against a directly paid Enterprise tier,
|
||||
is one axis of what actually changes between the two, and it is covered in full,
|
||||
alongside the pricing figures and the feature differences that are more than framing,
|
||||
on [hCaptcha Enterprise vs Standard](hcaptcha-enterprise-vs-standard.md).
|
||||
|
||||
## The server side: what actually proves the puzzle was solved
|
||||
|
||||
The puzzle, or the invisible pass, produces a token, and hCaptcha's own documentation is
|
||||
direct that the token proves nothing until a server checks it. The check is a
|
||||
server-to-server call to `https://api.hcaptcha.com/siteverify`, POSTing the site's secret
|
||||
key and the token (an optional `remoteip`, plus a `sitekey` to stop a token being
|
||||
replayed under a different site's key, are also accepted). The response is JSON: a
|
||||
`success` boolean, a `challenge_ts` timestamp, the `hostname`, `error-codes` on failure,
|
||||
and, Enterprise-only, a `score`/`score_reason` pair carrying the risk assessment itself.
|
||||
A token "can only be used once and must be verified within a short period of time," a
|
||||
default of 120 seconds, the same single-use, time-boxed shape as
|
||||
[the Turnstile token](cloudflare-turnstile-explained.md#the-token-and-why-passing-the-widget-is-not-the-finish-line).
|
||||
|
||||
## What invisible_playwright does and does not do here
|
||||
|
||||
Read this section carefully, because it is the point of this page. `invisible_playwright`
|
||||
is a patched Firefox that answers the JavaScript-visible parts of a browser fingerprint
|
||||
honestly, canvas and WebGL output, font enumeration, timing consistency, whether the
|
||||
engine claiming to be a real browser actually behaves like one. Whatever hCaptcha's
|
||||
undisclosed "thousands of factors" include on the fingerprint side, a genuinely real
|
||||
engine answers that category the way any other real instance of that engine does, for
|
||||
the same reason argued on [the Turnstile page](cloudflare-turnstile-explained.md#where-an-engine-level-browser-actually-helps-and-where-it-does-not)
|
||||
and [the GeeTest page](geetest-v4-explained.md#what-invisible_playwright-does-and-does-not-do-here).
|
||||
|
||||
That is where the honest boundary sits, and it sits well short of the puzzle. Selecting
|
||||
the images that match a label is a human-interaction and image-recognition problem, not
|
||||
a fingerprint problem, and no amount of engine-level realness answers it for you.
|
||||
`invisible_playwright` does not solve, automate past, or sell a solution to hCaptcha's
|
||||
visual challenge, and it never will as a feature of this project. A tool claiming to
|
||||
"bypass hCaptcha" is describing a different, separate product category, commercial
|
||||
captcha-solving services exist for exactly this reason, not something this project
|
||||
does, sells, or intends to build.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Is hCaptcha a real captcha, like GeeTest, or a silent score, like Turnstile?** Both, in
|
||||
sequence. An invisible risk pass runs first and handles most sessions with no visible
|
||||
step at all; only the sessions it leaves unsure escalate to an actual visual puzzle.
|
||||
|
||||
**What does the hCaptcha puzzle actually ask you to do?** Per independent description of
|
||||
the format, select every image matching a given label, in the same family as a
|
||||
reCAPTCHA v2 image grid, taking roughly 3 to 10 seconds by hCaptcha's own account of
|
||||
typical completion time.
|
||||
|
||||
**Does hCaptcha publish what its invisible pass checks?** No. hCaptcha's own materials
|
||||
describe the decision only at category level, "computed confidence," "thousands of
|
||||
factors," an accepted `remoteip` parameter, without publishing the specific signals or
|
||||
their weights.
|
||||
|
||||
**Is it true that hCaptcha sells the data from the puzzles people solve?** Its own
|
||||
labeling product pitches image and video annotation directly to AI and ML companies
|
||||
using the same task categories as the visitor-facing puzzle, and an independent
|
||||
reference states it sells datasets to third parties; hCaptcha's own privacy FAQ denies
|
||||
selling individually targeted ads or personal data specifically, a narrower claim than a
|
||||
denial that labeled answers are monetized.
|
||||
|
||||
**Does invisible_playwright solve hCaptcha's puzzle for me?** No. That is a
|
||||
human-interaction, image-recognition challenge, not a browser-fingerprint check, and this
|
||||
project does not include a puzzle-solving or captcha-solving capability of any kind, for
|
||||
hCaptcha or any other vendor.
|
||||
|
||||
**Does a real, engine-level browser help against hCaptcha at all?** Only against
|
||||
whatever portion of the invisible pass reads genuine browser-engine behavior, canvas,
|
||||
WebGL, font and timing consistency, the same category argued throughout this corpus. It
|
||||
has no effect on the puzzle interaction itself.
|
||||
|
||||
**Is hCaptcha the same thing whether I'm on the free tier or Enterprise?** The underlying
|
||||
widget and verification mechanism described on this page is shared. What changes across
|
||||
tiers, difficulty controls, risk-score visibility, custom challenges, and the
|
||||
labeling-versus-cash relationship, is covered on
|
||||
[hCaptcha Enterprise vs Standard](hcaptcha-enterprise-vs-standard.md).
|
||||
|
||||
## Sources
|
||||
|
||||
- hCaptcha, [Developer Guide](https://docs.hcaptcha.com/), retrieved 2026-08-30, for the
|
||||
two-stage widget flow, the `hcaptcha.execute()` trigger, and the `siteverify` endpoint,
|
||||
its parameters, response fields and the single-use/120-second token behavior.
|
||||
- hCaptcha, [Invisible Captcha](https://docs.hcaptcha.com/invisible), retrieved
|
||||
2026-08-30, for the `data-size="invisible"` behavior and the challenge-criteria framing.
|
||||
- hCaptcha, [Configuration](https://docs.hcaptcha.com/configuration), retrieved
|
||||
2026-08-30, for the documented widget parameters (`data-size`, `data-theme`, the
|
||||
callback hooks) and confirmation that difficulty selection is not a client-side option.
|
||||
- hCaptcha, [Pro Features](https://docs.hcaptcha.com/pro), retrieved 2026-08-30, for the
|
||||
"99.9% Passive" mode description and its "thousands of factors" / "less than 0.1%"
|
||||
framing.
|
||||
- hCaptcha, [Frequently Asked Questions](https://docs.hcaptcha.com/faq), retrieved
|
||||
2026-08-30, for the challenge-decision factors ("computed confidence... site
|
||||
difficulty... other security factors"), the four Basic-tier difficulty modes, the
|
||||
3-10 second completion-time figure, and the privacy/no-targeted-ads statement.
|
||||
- hCaptcha, [Pricing](https://www.hcaptcha.com/pricing) and
|
||||
[Plans](https://www.hcaptcha.com/plans), both retrieved 2026-08-30, for tier
|
||||
positioning referenced briefly here (full comparison on the Enterprise-vs-Standard
|
||||
page).
|
||||
- hCaptcha, [homepage](https://www.hcaptcha.com/) and [About](https://www.hcaptcha.com/about),
|
||||
both retrieved 2026-08-30, for the "hundreds of millions of people," "largest
|
||||
independent service," "every country," "Zero-PII architecture" claims, and the
|
||||
company's relationship to Intuition Machines.
|
||||
- hCaptcha, [Data Labeling](https://www.hcaptcha.com/labeling), retrieved 2026-08-30, for
|
||||
the annotation-service pitch to AI/ML companies and its overlap with the puzzle.
|
||||
- HUMAN Protocol, ["How does hCaptcha fit into HUMAN Protocol?"](https://humanprotocol.org/blog/how-does-hcaptcha-fit-into-human-protocol),
|
||||
retrieved 2026-08-30, for the integrator-compensation model and the explicit statement
|
||||
that Enterprise customers like Cloudflare pay Intuition Machines rather than being paid.
|
||||
- HandWiki, [HCaptcha](https://handwiki.org/wiki/HCaptcha), retrieved 2026-08-30, an
|
||||
independent encyclopedic mirror, for the 2018 introduction date, the "select all images
|
||||
matching a generated query, called a label" challenge description, the claim that
|
||||
hCaptcha "makes revenue by selling its datasets to 3rd party companies," and the
|
||||
~10-million-users-per-month 2019 adoption figure.
|
||||
- BleepingComputer, ["Cloudflare drops Google's reCAPTCHA due to privacy concerns"](https://www.bleepingcomputer.com/news/technology/cloudflare-drops-googles-recaptcha-due-to-privacy-concerns/),
|
||||
published 2020-04-13, retrieved 2026-08-30, independent corroboration of Cloudflare's
|
||||
April 2020 move to hCaptcha and its stated reasons (privacy, China accessibility, cost).
|
||||
|
||||
**See also:** [Does Playwright Trigger hCaptcha More Often?](does-playwright-trigger-hcaptcha.md)
|
||||
for what a Playwright session specifically does to the invisible pass described above;
|
||||
[hCaptcha Enterprise vs Standard](hcaptcha-enterprise-vs-standard.md) for the tier
|
||||
comparison this page defers to; [GeeTest v4 (Slide/Click Captcha), Explained](geetest-v4-explained.md)
|
||||
and [Arkose Labs (FunCaptcha), Explained](arkose-labs-funcaptcha-explained.md) for two
|
||||
other vendors whose visible puzzle sits behind a similar undisclosed risk pass; and
|
||||
[How Cloudflare Turnstile actually works](cloudflare-turnstile-explained.md) for the
|
||||
non-interactive counterpart of the same fingerprint-versus-human-gate split.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level and driven by stock Playwright. This page explains a
|
||||
mechanism and a business model, not a workaround: the product does not solve captchas,
|
||||
and a claim that any tool defeats hCaptcha's puzzle step is a different promise than
|
||||
anything documented here.*
|
||||
@@ -0,0 +1,171 @@
|
||||
---
|
||||
title: "Honeypot Fields and Hidden Links: How Sites Trap Scrapers"
|
||||
description: "A honeypot is a form field or link a real visitor never sees and a script that processes the raw DOM will trigger. The CSS that hides it, how a trip gets detected, and why a real browser engine does not avoid this on its own."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 40
|
||||
---
|
||||
|
||||
|
||||
# Honeypot Fields and Hidden Links: How Sites Trap Scrapers
|
||||
|
||||
A honeypot is a form field or a link that exists in a page's HTML, is hidden from a
|
||||
human visitor by CSS, and does something a real person never does when a script
|
||||
touches it: fills it in, or follows it. It is one of the oldest anti-scraping tricks
|
||||
still in wide use, cheap to add, and effective against exactly the class of script it
|
||||
targets, one that reads raw HTML or the DOM and interacts with everything it finds
|
||||
rather than what a person would actually see.
|
||||
|
||||
This is a different kind of check from most of this corpus. It is not a fingerprint
|
||||
of the browser engine. It is a trap for how your own crawling code behaves, and that
|
||||
distinction decides most of what follows.
|
||||
|
||||
## The classic form: a field only a bot fills in
|
||||
|
||||
The pattern, well documented across scraping-infrastructure writeups, is a form field
|
||||
added to the markup with a name that looks legitimate, `email2`, `phone_confirm`,
|
||||
`website`, styled so a human never sees it and never has a reason to type into it. A
|
||||
script that fills every input it finds on a form, which is a common and reasonable
|
||||
default for a naive scraper or a bulk form-fill tool, fills that field too. The
|
||||
server checks on submit: if the honeypot field is non-empty, the submission did not
|
||||
come from a person looking at the rendered page, because a person looking at the
|
||||
rendered page cannot see a field that is not there.
|
||||
|
||||
The link version works the same way at the level of navigation instead of form
|
||||
submission: an anchor tag hidden from view, sometimes leading to a dedicated trap
|
||||
page. A crawler that walks every `<a href>` it finds in the markup follows it; a
|
||||
person browsing the rendered page has nothing to click. Hitting the trap page at all
|
||||
is the tell, independent of anything filled in.
|
||||
|
||||
## The CSS, and why it is not one trick
|
||||
|
||||
Real writeups on this technique describe several distinct hiding methods, and they
|
||||
matter individually because they defeat different levels of scraper sophistication:
|
||||
|
||||
- **`display: none`** removes the element from layout entirely. Cheap, common, and
|
||||
the first thing a slightly more careful scraper checks for.
|
||||
- **`visibility: hidden`** keeps the element's layout space but removes it from view
|
||||
and from the accessibility tree. A scraper checking only for presence in the DOM,
|
||||
not computed style, still misses this distinction.
|
||||
- **Zero width or height**, sometimes combined with `overflow: hidden`, makes an
|
||||
element technically present and even technically "displayed" by some narrow
|
||||
definitions, while occupying no visible space.
|
||||
- **Off-screen positioning**, `position: absolute` with a large negative offset,
|
||||
keeps normal display and visibility values while placing the element outside the
|
||||
visible viewport entirely, which specifically defeats a check that only reads
|
||||
`display` and `visibility` and nothing about actual position.
|
||||
- **Color-matching**, text or a link styled the same color as its background,
|
||||
produces an element that is technically visible by every layout-level definition
|
||||
and simply cannot be read by a human eye.
|
||||
|
||||
The reason a site layers several of these rather than picking one is exactly the
|
||||
reason a naive detection-avoidance check fails: each individual method is cheap to
|
||||
detect once you know to look for it, and a scraper hardened against `display: none`
|
||||
alone still walks straight into a color-matched link or an off-screen field.
|
||||
|
||||
## A real browser engine does not dodge this by itself
|
||||
|
||||
This is the point worth being precise about, because it cuts against an assumption
|
||||
that runs through a lot of this corpus in the other direction. Most of what
|
||||
`invisible_playwright` answers is a question the *browser engine* gets asked: does
|
||||
canvas render like a real GPU, does the JavaScript engine behave like the one it
|
||||
claims to be, does the TLS handshake match a real Firefox. A honeypot is not that
|
||||
kind of question. It is asked of your *automation code*: did the script that is
|
||||
driving this browser, real engine or not, interact with an element a human would
|
||||
never have seen? A perfectly genuine Firefox, patched at the C++ level or not, walks
|
||||
into a color-matched honeypot link exactly as readily as a bare HTTP client does, if
|
||||
the code driving it calls `.click()` on every anchor tag it finds without checking
|
||||
whether a human could ever have seen it.
|
||||
|
||||
Playwright's own actionability checks help here, but only partially, and knowing
|
||||
the boundary matters more than knowing the feature exists. Per Playwright's own
|
||||
documentation on auto-waiting, a standard action like `locator.click()` or
|
||||
`locator.fill()` first confirms the target element is "visible," and Playwright's own
|
||||
definition of visible is specific: a non-empty bounding box and no `visibility:
|
||||
hidden` computed style. That check genuinely refuses to interact with a `display:
|
||||
none` or zero-size element by default, which quietly defeats two of the five hiding
|
||||
methods above without any extra code. It does **not** extend to `opacity: 0`,
|
||||
which Playwright's own actionability documentation states explicitly is still
|
||||
treated as visible, nor to an element that is technically laid out and displayed but
|
||||
sitting off-screen or color-matched against its background. A scraper relying only
|
||||
on Playwright's default actionability checks is protected against `display: none`
|
||||
and zero-size traps, and exposed to opacity, off-screen and color-matching ones,
|
||||
which is precisely why real honeypot writeups recommend those latter techniques over
|
||||
plain `display: none`.
|
||||
|
||||
## The defensive habit, stated as a fact about behavior rather than a promise
|
||||
|
||||
The only reliable defense is code that reasons about what a human would actually
|
||||
see before interacting with an element, not code that assumes a real browser engine
|
||||
handles it automatically. Checking computed style directly, `display`, `visibility`,
|
||||
`opacity`, actual bounding-box position relative to the viewport, and foreground
|
||||
versus background color, before filling or following anything a page did not
|
||||
obviously ask for, is a property of the automation script, not of how honest the
|
||||
browser engine underneath it is. This is the same distinction [DataDome's own
|
||||
behavioral-scoring layer draws](datadome-explained.md#behavior-does-not-stop-being-scored-once-you-are-past-the-door):
|
||||
a click that lands somewhere no human would click is a signal about the driver, not
|
||||
the engine, and no amount of engine-level realness changes what the code on top of
|
||||
it decides to touch.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What is a honeypot field?** A form input or link present in a page's markup,
|
||||
hidden from a human visitor by CSS, that a script processing the raw HTML or DOM is
|
||||
likely to fill in or follow, which the server reads as a sign the requester is not a
|
||||
person.
|
||||
|
||||
**What CSS actually hides a honeypot?** `display: none`, `visibility: hidden`,
|
||||
zero width/height, off-screen absolute positioning, and color-matching text against
|
||||
its background are all documented in real use, individually and combined.
|
||||
|
||||
**Does using a real browser engine avoid honeypots automatically?** No. A honeypot
|
||||
is a trap for what your automation code interacts with, not for what the browser
|
||||
engine is. A genuinely real Firefox driven by code that clicks every link it finds
|
||||
walks into a color-matched honeypot exactly like any other client would.
|
||||
|
||||
**Does Playwright's own click behavior protect against this?** Partially.
|
||||
Playwright's default actionability checks refuse to click or fill an element with
|
||||
`display: none` or a zero-size bounding box, but explicitly treat `opacity: 0` as
|
||||
visible, and do not check whether an element is actually inside the viewport or
|
||||
color-matched against its background.
|
||||
|
||||
**What is the actual defense?** Code that checks computed style and real position
|
||||
before interacting with any element a script did not explicitly expect to need,
|
||||
rather than processing every input or link a page happens to contain.
|
||||
|
||||
**Is this the same category of check as a fingerprinting detector?** No. Most of
|
||||
this corpus is about the browser engine answering a JavaScript-visible question
|
||||
honestly. A honeypot scores the automation code's own behavior, independent of how
|
||||
real the engine underneath it is.
|
||||
|
||||
## Sources
|
||||
|
||||
- Scrapfly, ["What are honeypots and how to avoid them"](https://scrapfly.io/blog/posts/what-are-honeypots-and-how-to-avoid-them),
|
||||
retrieved 2026-08-30, for the CSS hiding techniques (`display: none`,
|
||||
color-matching) and the detection-script pattern of checking computed style.
|
||||
- Stytch, ["How to block AI web crawlers without breaking your site"](https://stytch.com/blog/how-to-block-ai-web-crawlers/),
|
||||
retrieved 2026-08-30, for the hidden-form-field and tarpit description in the
|
||||
context of anti-crawler defenses generally.
|
||||
- Cloudflare, [AI Labyrinth](https://developers.cloudflare.com/bots/additional-configurations/ai-labyrinth/),
|
||||
retrieved 2026-08-30, for a large-scale, `nofollow`-tagged production version of
|
||||
the hidden-link honeypot pattern, covered in full on [this project's separate page
|
||||
on AI-crawler blocking](beyond-robots-txt-anti-crawler-mechanisms.md).
|
||||
- Playwright, [Auto-waiting / actionability documentation](https://playwright.dev/docs/actionability),
|
||||
retrieved 2026-08-30, for the exact definition of "visible" Playwright's own
|
||||
action methods check (`display: none` and zero bounding box excluded,
|
||||
`opacity: 0` explicitly included as visible), and which checks `force: true`
|
||||
disables.
|
||||
|
||||
**See also:** [Beyond robots.txt: how sites actually block AI crawlers now](beyond-robots-txt-anti-crawler-mechanisms.md)
|
||||
for the wider stack this trap sits inside, [how DataDome's bot detection actually
|
||||
works](datadome-explained.md) for the behavioral-scoring layer that scores automation
|
||||
code the same way, and [what BrowserLeaks actually tests, surface by
|
||||
surface](browserleaks-explained.md) for the engine-level checks this page
|
||||
deliberately contrasts against.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. A honeypot tests the
|
||||
code driving the browser, not the browser's own realness, and no amount of engine
|
||||
patching changes what a script decides to click.*
|
||||
@@ -19,7 +19,7 @@ validating itself against the one call almost no real script makes.
|
||||
Every guide to human-like mouse movement measures the same thing: draw a curve, add
|
||||
jitter, check that the shape looks plausible. [The curve is the easy half](human-mouse-movement.md).
|
||||
This page is about a failure mode one level up, found by measuring the feature on the
|
||||
call scripts actually make rather than the one it's easiest to test with, and it
|
||||
call scripts actually make instead of the one it's easiest to test with, and it
|
||||
turned out the humanization had been validating itself against the wrong call the
|
||||
whole time.
|
||||
|
||||
@@ -45,7 +45,7 @@ That is a teleport with two extra samples decorating it, not a human path.
|
||||
|
||||
## Why the hit-target check eats the movement
|
||||
|
||||
The mechanism is specific rather than mysterious. A hit-target check has to move the
|
||||
The mechanism is specific, not mysterious. A hit-target check has to move the
|
||||
pointer onto the target before it can confirm the target is really there. If the
|
||||
humanized path is generated *inside* that same step, the check consumes the distance
|
||||
first, and the path that runs afterward has almost nothing left to cover. The stroke
|
||||
|
||||
@@ -16,7 +16,7 @@ and its neighbours is real, it is worth doing, and it is also the cheapest thing
|
||||
detector checks. The durable tells are not values you can redefine from a page
|
||||
script. They are outputs a real machine produces and a script cannot: what the
|
||||
engine actually renders, what it can actually decrypt, how a pointer actually moves.
|
||||
Building toward that from the start, rather than patching properties after a block
|
||||
Building toward that from the start, not patching properties after a block
|
||||
shows up, is the difference this page is about.
|
||||
|
||||
This page is written for before you launch a session, not after one gets blocked. If
|
||||
@@ -43,14 +43,14 @@ ceiling:
|
||||
|
||||
[The full breakdown of what each level can and cannot reach is
|
||||
here](playwright-stealth-levels.md). The proactive move is to pick a level
|
||||
deliberately, before you write a line of scraping code, rather than discovering the
|
||||
deliberately, before you write a line of scraping code, not discovering the
|
||||
ceiling of level 1 three weeks into a project when a site starts checking something
|
||||
a page script cannot touch.
|
||||
|
||||
## Start from what a level-1 patch actually buys you
|
||||
|
||||
`navigator.webdriver` is the property everyone reaches for first, and it is worth
|
||||
doing correctly rather than skipping. The naive version looks like this:
|
||||
doing correctly instead of skipping. The naive version looks like this:
|
||||
|
||||
```python
|
||||
from playwright.sync_api import sync_playwright
|
||||
@@ -90,13 +90,13 @@ none of them are JavaScript properties:
|
||||
- **The behaviour.** How the pointer moves, how a form gets filled, whether the page
|
||||
is ever scrolled.
|
||||
|
||||
This is the argument for moving down a level rather than writing a longer init
|
||||
This is the argument for moving down a level instead of writing a longer init
|
||||
script. A property can be redefined by anyone with a console. An output has to be
|
||||
produced by something that actually has the capability being tested.
|
||||
|
||||
## The capability check a Playwright property patch cannot pass
|
||||
|
||||
A capability check asks the browser to do something rather than report something,
|
||||
A capability check asks the browser to do something, not report something,
|
||||
which is why a page-level patch cannot pass one. Here is a concrete version you can
|
||||
run yourself against whatever Playwright launches today.
|
||||
|
||||
@@ -124,7 +124,7 @@ with sync_playwright() as p:
|
||||
|
||||
On a default managed Chromium this prints `no`. Setting the user agent to claim
|
||||
Chrome does not change the answer, because the missing piece is a DRM module, not a
|
||||
string. [The full argument, including why this is a capability rather than a
|
||||
string. [The full argument, including why this is a capability, not a
|
||||
value and what closes it, is here](chromium-is-not-chrome.md). No `add_init_script`
|
||||
reaches this, because there is no property to redefine. The module either exists in
|
||||
the binary or it does not.
|
||||
|
||||
@@ -95,7 +95,7 @@ with InvisiblePlaywright(seed=42) as browser:
|
||||
```
|
||||
|
||||
Two habits worth keeping. Build the destination name from
|
||||
`suggested_filename` rather than from link text, and always assert a non-zero
|
||||
`suggested_filename`, not from link text, and always assert a non-zero
|
||||
size afterwards. An empty file that saved without raising is the download
|
||||
equivalent of a page that came back blank: it did not error, and it is still a
|
||||
failure.
|
||||
|
||||
@@ -51,7 +51,7 @@ that happens to be all furniture and no article.
|
||||
## Render first: wait for the body, then take page.content()
|
||||
|
||||
The fix has two halves. Let the page finish rendering, then hand the *rendered*
|
||||
HTML to the extractor rather than the initial response.
|
||||
HTML to the extractor instead of the initial response.
|
||||
|
||||
[`page.content()`](https://playwright.dev/python/docs/api/class-page#page-content)
|
||||
serialises the live DOM as it stands now, after scripts have run and injected
|
||||
@@ -146,7 +146,7 @@ reading it *after* the body was injected.
|
||||
|
||||
## Why a real engine sees paragraphs an HTTP fetch never receives
|
||||
|
||||
There is a reason this recipe uses a browser at all rather than `requests` plus
|
||||
There is a reason this recipe uses a browser at all, not `requests` plus
|
||||
readability. The clean-extraction problem and the not-getting-blocked problem
|
||||
share a root cause, and it is worth being explicit about.
|
||||
|
||||
@@ -168,7 +168,7 @@ wearing two hats.
|
||||
This is where a consistent, real-looking fingerprint earns its place. Because
|
||||
`InvisiblePlaywright` derives every surface - GPU, canvas, audio, fonts, screen
|
||||
- from one seed, `seed=42` gets you the same coherent machine on every run, so
|
||||
the same full article is served each time rather than the article once and a
|
||||
the same full article is served each time instead of the article once and a
|
||||
stripped variant the next. That reproducibility is also what makes a broken
|
||||
extraction debuggable: a failing run replays exactly instead of vanishing into
|
||||
the next random draw. The general version of "get the real page, not the bot
|
||||
@@ -187,7 +187,7 @@ Three cheap checks catch most of the failures:
|
||||
|
||||
- **Byline and headline survived.** These often sit in their own elements
|
||||
outside the main content block, and readability drops them more often than it
|
||||
drops paragraphs. If you need the author, extract it separately rather than
|
||||
drops paragraphs. If you need the author, extract it separately instead of
|
||||
hoping the summary kept it.
|
||||
- **It did not truncate at an inline widget.** A pull-quote, an embedded video,
|
||||
a subscribe box or a mid-article "related" card can look like the end of the
|
||||
|
||||
@@ -14,7 +14,7 @@ To extract JSON-LD structured data with Playwright, select every
|
||||
`all_text_contents()`, and `json.loads` it; then flatten any `@graph` array and filter
|
||||
by `@type` instead of trusting document order. It is less fragile than chasing CSS
|
||||
selectors, and an empty result is a useful signal that you were handed a blocked or
|
||||
simplified page rather than the real one.
|
||||
simplified page instead of the real one.
|
||||
|
||||
Most scraping guides teach you to chase CSS selectors down through a layout that
|
||||
changes the week after you ship. There is often a cleaner record sitting on the same
|
||||
@@ -48,7 +48,7 @@ The difference in practice:
|
||||
A class name changes, a wrapper `div` moves, a component re-renders with different
|
||||
attributes, and your selector-based extractor breaks. The JSON-LD block is a contract
|
||||
with search engines, so it changes far less often and, when it does, it changes in a
|
||||
documented shape rather than an arbitrary one.
|
||||
documented shape, not an arbitrary one.
|
||||
|
||||
The one thing to know before you start: a page can carry several blocks of different
|
||||
`@type`, and they can be nested inside a `@graph` array. You cannot take the first
|
||||
@@ -90,10 +90,10 @@ with InvisiblePlaywright(seed=42) as browser:
|
||||
```
|
||||
|
||||
`all_text_contents()` returns the text of every matching `<script>` tag, so you get
|
||||
all of them in one call rather than looping locators by hand. `json.loads` turns each
|
||||
all of them in one call instead of looping locators by hand. `json.loads` turns each
|
||||
into a Python object. The `seed=42` gives you a reproducible identity so that if one
|
||||
run gets the block and another does not, you can replay the exact same browser and
|
||||
find out why rather than blaming the random draw.
|
||||
find out why instead of blaming the random draw.
|
||||
|
||||
## Filter by @type, and walk the @graph
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ links, a tenth of the pages return an empty dict, and a few come back looking pe
|
||||
from a page that never actually loaded for you.
|
||||
|
||||
This page is the four things that turn that one-liner into something you can trust:
|
||||
where the tags really live, why you must read the rendered head rather than the first
|
||||
where the tags really live, why you must read the rendered head instead of the first
|
||||
response, how to resolve a relative `og:image`, and the fallback chain to use when a
|
||||
key is simply absent. It ends on one honest caveat that is specific to running against
|
||||
sites that would rather you did not.
|
||||
|
||||
@@ -0,0 +1,234 @@
|
||||
---
|
||||
title: "How to Handle a PDF That Opens in a New Tab with Playwright"
|
||||
description: "Catch the new page with context.expect_page() when a link opens Firefox's PDF viewer, then pull the real bytes with context.request or a response listener instead of screenshotting the viewer."
|
||||
parent: "Scraping with Playwright"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 144
|
||||
---
|
||||
|
||||
|
||||
# How to Handle a PDF That Opens in a New Tab with Playwright
|
||||
|
||||
A link that opens a PDF in a new tab hands you two separate problems, and most
|
||||
attempts at this fail because they only solve the first one. The first problem is
|
||||
catching the tab at all, before it opens and closes out of reach. The second, the one
|
||||
that actually matters, is that once you have the tab, what you are looking at is
|
||||
Firefox's built-in viewer rendering the file, not the file. A screenshot of that
|
||||
viewer is a picture of a picture. What you want is the bytes.
|
||||
|
||||
This page covers both: catching the popup with the standard Playwright event, and then
|
||||
getting the real PDF, either by fetching it directly or by reading it off the network
|
||||
response, instead of settling for whatever the viewer happened to render on screen.
|
||||
|
||||
## Step 1: catch the tab before it opens and closes on you
|
||||
|
||||
A link with `target="_blank"`, or a `window.open()` call, creates a brand new `Page`
|
||||
the instant it fires. If you are not already listening when that happens, you get
|
||||
nothing back. The fix is Playwright's own pattern for this: wrap the click inside
|
||||
`context.expect_page()` so the listener is armed before the action runs.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com/reports")
|
||||
|
||||
with page.context.expect_page() as new_page_info:
|
||||
page.click("a[href$='.pdf']") # opens the viewer in a new tab
|
||||
|
||||
pdf_tab = new_page_info.value # a real Playwright Page
|
||||
pdf_tab.wait_for_load_state()
|
||||
```
|
||||
|
||||
This part is not specific to PDFs. It is the same mechanism covered in
|
||||
[how to handle popups and modals in Playwright](how-to-handle-popups-and-modals-playwright.md):
|
||||
register the listener, run the triggering click inside the block, read the result off
|
||||
`.value` after. Register it after the click and the tab is already open and unreachable.
|
||||
|
||||
If the site instead navigates the *current* tab straight to the PDF URL - no new tab,
|
||||
just a normal `page.goto()` that happens to land on a PDF - skip this step entirely.
|
||||
There is no popup to catch, and everything below still applies to the one page you
|
||||
already have.
|
||||
|
||||
## Step 2: know what that tab actually contains
|
||||
|
||||
Once you have `pdf_tab`, resist the urge to `pdf_tab.screenshot()` and call it done.
|
||||
Firefox renders PDFs with its bundled viewer, pdf.js, which is a real web page in its
|
||||
own right - toolbar, page canvas, scroll container - not the document. A screenshot of
|
||||
it captures whatever fits in the viewport at that scroll position: usually one page of
|
||||
a document that may have twenty, none of it selectable or extractable as text. For a
|
||||
quick visual confirmation that a PDF opened, that is fine. For anything that needs the
|
||||
actual content, it is close to useless, for the same underlying reason
|
||||
[`page.pdf()` cannot produce text from a rendered page either](how-to-generate-pdf-with-playwright-firefox.md):
|
||||
a picture of a document is not the document.
|
||||
|
||||
What you actually want is the byte stream the browser downloaded before it ever handed
|
||||
those bytes to the viewer. There are two ways to get it, and which one applies depends
|
||||
on whether you have a direct link to work with.
|
||||
|
||||
## Route 1: fetch the URL directly, and never load the viewer at all
|
||||
|
||||
If the link has a real `href`, the simplest and most reliable route skips the viewer
|
||||
completely. Read the URL from the anchor before you click anything, then fetch it with
|
||||
Playwright's own request context instead of opening it in a page:
|
||||
|
||||
```python
|
||||
from pathlib import Path
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com/reports")
|
||||
|
||||
pdf_url = page.get_attribute("a[href$='.pdf']", "href")
|
||||
if not pdf_url.startswith("http"):
|
||||
pdf_url = page.url.rsplit("/", 1)[0] + "/" + pdf_url.lstrip("/")
|
||||
|
||||
response = page.context.request.get(pdf_url)
|
||||
Path("report.pdf").write_bytes(response.body())
|
||||
```
|
||||
|
||||
`page.context.request` is a Playwright `APIRequestContext` tied to the same browser
|
||||
context - the same cookies, and if you launched with a proxy, the same proxied exit as
|
||||
every page load in the session. That matters for exactly the reason it matters for any
|
||||
other download: fetching the file with a separate, unproxied HTTP client would send it
|
||||
out from your real address instead of the browser's, which is
|
||||
[the same self-inflicted mismatch covered on the file-download page](how-to-download-files-playwright.md).
|
||||
Using `context.request` here keeps the PDF fetch inside the one identity the rest of
|
||||
the session already presents.
|
||||
|
||||
Once you have the bytes, extract text with any PDF library:
|
||||
|
||||
```python
|
||||
from pypdf import PdfReader
|
||||
import io
|
||||
|
||||
reader = PdfReader(io.BytesIO(response.body()))
|
||||
text = "\n".join(p.extract_text() or "" for p in reader.pages)
|
||||
```
|
||||
|
||||
This route never opens pdf.js, never spends time rendering anything, and works exactly
|
||||
the same whether the original link used `target="_blank"` or not, because you never
|
||||
click it in the first place. It is the one to reach for whenever a stable URL exists.
|
||||
|
||||
## Route 2: read the response when there is no stable link
|
||||
|
||||
Some PDFs are not a link with an `href` you can grab. A button posts a form and the
|
||||
server streams a PDF back as the response to that POST, or the tab's URL is a
|
||||
short-lived, signed link you cannot reconstruct by hand. In that case, catch the bytes
|
||||
off the response as the new tab loads it, instead of trying to re-derive the URL:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
pdf_bytes = None
|
||||
|
||||
def capture_pdf(response):
|
||||
global pdf_bytes
|
||||
if "application/pdf" in (response.headers.get("content-type") or ""):
|
||||
pdf_bytes = response.body()
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com/reports")
|
||||
|
||||
with page.context.expect_page() as new_page_info:
|
||||
page.click("#generate-pdf") # posts a form; server streams a PDF back
|
||||
|
||||
pdf_tab = new_page_info.value
|
||||
pdf_tab.on("response", capture_pdf)
|
||||
pdf_tab.wait_for_load_state()
|
||||
|
||||
if pdf_bytes:
|
||||
from pathlib import Path
|
||||
Path("report.pdf").write_bytes(pdf_bytes)
|
||||
```
|
||||
|
||||
Register the `response` listener on the new tab as early as possible - ideally right
|
||||
after you get it back from `new_page_info.value`, before calling
|
||||
`wait_for_load_state()` - because the main-frame response that carries the actual PDF
|
||||
bytes can arrive before your next line executes. Filter on content type rather than
|
||||
assuming: a redirect or an error page can land in the same tab and you do not want to
|
||||
write its HTML to a `.pdf` file and find out later.
|
||||
[`Response.body()`](https://playwright.dev/python/docs/api/class-response) returns the
|
||||
raw buffer regardless of what the browser's UI ends up doing with it, so the same
|
||||
method works whether the viewer eventually renders it or not - the capture happens at
|
||||
the network layer, one level below the tab's on-screen content.
|
||||
|
||||
## Choosing between the two routes
|
||||
|
||||
| Situation | Route |
|
||||
|---|---|
|
||||
| The link has a real, fetchable `href` | Route 1: `context.request.get()`, skip the viewer entirely |
|
||||
| The PDF is generated by a POST or a signed, short-lived URL you cannot reconstruct | Route 2: catch it off the `response` event in the new tab |
|
||||
| You only need visual confirmation the PDF opened, not its content | A screenshot of the viewer tab is enough, and nothing above is necessary |
|
||||
|
||||
Route 1 is simpler, faster, and never touches pdf.js, so prefer it whenever a plain URL
|
||||
is available. Reach for route 2 only when there genuinely is no stable link to fetch
|
||||
directly.
|
||||
|
||||
## Conclusion
|
||||
|
||||
A PDF that opens in a new tab is two ordinary Playwright problems stacked on top of
|
||||
each other: catching a popup, which `context.expect_page()` already solves, and
|
||||
getting real content out of what the popup shows, which the viewer itself cannot give
|
||||
you. Fetch the URL directly through `context.request` when you can, so the file never
|
||||
passes through pdf.js at all; fall back to reading the `response` event on the new tab
|
||||
when there is no direct link to fetch. Either way, the bytes are what you were after,
|
||||
and a screenshot of the viewer was never going to be a substitute for them.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**How do I catch a PDF that opens in a new tab with Playwright?** Wrap the click that
|
||||
opens it in `with page.context.expect_page() as info:`, then read the new `Page` from
|
||||
`info.value`. Register the listener before the click, not after.
|
||||
|
||||
**Can I just screenshot the PDF viewer tab?** You can, and it only captures whatever
|
||||
fits in the current viewport, usually one page, with no selectable text. For content
|
||||
extraction, fetch the real bytes instead.
|
||||
|
||||
**What is the most reliable way to get the actual PDF bytes?** If the link has a real
|
||||
URL, fetch it directly with `page.context.request.get(url)` and read
|
||||
`response.body()`. This never opens the viewer at all.
|
||||
|
||||
**What if there is no direct link to the PDF?** Listen on the new tab's `response`
|
||||
event, filter for `content-type: application/pdf`, and read `response.body()` off the
|
||||
matching response as it loads.
|
||||
|
||||
**Does fetching the PDF through context.request keep it on my proxy?** Yes.
|
||||
`context.request` shares the browser context, so the fetch uses the same cookies and
|
||||
proxied exit as the rest of the session, avoiding the address mismatch a separate HTTP
|
||||
client would introduce.
|
||||
|
||||
**Why shouldn't I just use page.pdf() instead?** `page.pdf()` generates a new PDF from
|
||||
a page's own rendered output and is Chromium-only in Playwright; it has nothing to do
|
||||
with retrieving a PDF that already exists at a URL. See
|
||||
[how to generate a PDF with Playwright and Firefox](how-to-generate-pdf-with-playwright-firefox.md)
|
||||
for that separate question.
|
||||
|
||||
## Sources
|
||||
|
||||
- Playwright's own documentation on [pages and popups](https://playwright.dev/docs/pages)
|
||||
(`context.expect_page()`), retrieved 2026-08-30, for the popup-capture pattern used
|
||||
above.
|
||||
- Playwright's [`Response` API reference](https://playwright.dev/python/docs/api/class-response),
|
||||
retrieved 2026-08-30, for `Response.body()` returning the raw buffer independent of
|
||||
how the page renders it.
|
||||
- Playwright's [`APIRequestContext` documentation](https://playwright.dev/python/docs/api/class-apirequestcontext),
|
||||
retrieved 2026-08-30, for `context.request` sharing the browser context's cookies and
|
||||
proxy configuration.
|
||||
|
||||
**See also:** [how to handle popups and modals in Playwright](how-to-handle-popups-and-modals-playwright.md)
|
||||
for the general popup-catching pattern this page builds on,
|
||||
[how to download files with Playwright](how-to-download-files-playwright.md) for why a
|
||||
transfer should stay on the browser's own proxied exit, and
|
||||
[how to generate a PDF with Playwright and Firefox](how-to-generate-pdf-with-playwright-firefox.md)
|
||||
for the different problem of producing a PDF rather than consuming one.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The viewer tab is a real
|
||||
page and Playwright will happily hand it to you; it is just not the document you
|
||||
actually wanted.*
|
||||
@@ -63,7 +63,7 @@ The engine's mouse model handles per-action realism, not request cadence, so it
|
||||
rate limit your loop for you. It is worth being precise about what the engine already does,
|
||||
because it covers one behaviour signal and not the other.
|
||||
|
||||
Every click arcs the pointer to the target along a Bezier curve rather than teleporting to
|
||||
Every click arcs the pointer to the target along a Bezier curve instead of teleporting to
|
||||
the coordinate, which adds a realistic, variable latency to each action and is
|
||||
[movement that is produced rather than declared](human-mouse-movement.md). That defeats
|
||||
the pointer-teleport tell inside a page.
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
---
|
||||
title: "How to Read a Stealth-Browser Benchmark Without Being Misled"
|
||||
description: "Almost every published comparison in this space ranks its own tool first, including implicitly this project's. What to check before trusting a benchmark: undisclosed targets, dates and IP types, non-comparable pass criteria, and shared implementations wearing different names."
|
||||
parent: "Comparisons"
|
||||
nav_order: 35
|
||||
---
|
||||
|
||||
|
||||
# How to Read a Stealth-Browser Benchmark Without Being Misled
|
||||
|
||||
Say the conflict of interest first, because every comparison in this space has one and
|
||||
most don't say so: this project publishes comparison pages too, and they are written by
|
||||
the people who maintain the tool being compared. That does not make them wrong, but it
|
||||
does mean the same skepticism this page recommends for someone else's benchmark applies
|
||||
to ours, including a hypothetical one that made this project look best. Nobody grading
|
||||
their own homework gets a pass on that just because they said it out loud first.
|
||||
|
||||
This page is not about which tool wins. It's about what a comparison has to disclose
|
||||
before "wins" means anything at all, and what tends to be missing from the ones that
|
||||
circulate without it.
|
||||
|
||||
## Four things an undisclosed benchmark hides
|
||||
|
||||
**The test targets.** "We tested against major anti-bot vendors" names nothing
|
||||
checkable. Which sites, how many, and were they picked because they're representative or
|
||||
because they're the ones the tool already handles well? A benchmark that names its
|
||||
targets can be reproduced by someone who disagrees with it. One that doesn't can only be
|
||||
believed.
|
||||
|
||||
**The date.** Every detector this corpus documents changes its own scoring over time.
|
||||
[Akamai told two versions of the same patched Firefox family apart](akamai-bot-manager-explained.md)
|
||||
on one site while treating them identically on others, and the difference tracked the
|
||||
build, not some property that held still. A pass rate from six months ago is a claim
|
||||
about that detector's configuration six months ago, not about today, and a benchmark
|
||||
that doesn't date itself is asking you to assume nothing changed.
|
||||
|
||||
**The IP type.** Datacenter versus residential versus mobile changes outcomes on its own,
|
||||
independent of anything the browser does. [ASN and IP reputation are properties of the
|
||||
network path, not the browser](asn-and-ip-reputation-in-bot-detection.md), and a
|
||||
[datacenter address is detectable on its own terms](can-websites-detect-a-datacenter-proxy-ip.md),
|
||||
so two runs on different IP classes are not testing the same thing even with identical
|
||||
binaries. A benchmark that doesn't name the IP type used, or worse, runs different arms
|
||||
through different IP types without saying so, has let the network do part of the
|
||||
deciding and credited the browser for it.
|
||||
|
||||
**Whether "pass" means the same thing across tools.** This corpus's own [testing
|
||||
methodology page](how-to-test-bot-detection.md) makes this point about testing your own
|
||||
browser: sannysoft, CreepJS, BotD, FingerprintJS and BrowserLeaks each answer a different
|
||||
question, and "we pass every suite" is five different claims wearing one sentence. A
|
||||
benchmark comparing two automation tools has the identical problem one level up. A "pass"
|
||||
against a sitekey test page, a "pass" meaning no block occurred on a live production
|
||||
page, and a "pass" meaning a JavaScript test suite returned a clean verdict are three
|
||||
different bars, and stacking them into one leaderboard column erases the difference that
|
||||
matters.
|
||||
|
||||
## The tools might not even be the different things they're compared as
|
||||
|
||||
A comparison implicitly promises that its rows are independent measurements. Sometimes
|
||||
they aren't. Several entries in
|
||||
[this corpus's own comparisons hub](comparisons.md) exist specifically to flag when two
|
||||
differently-named tools share more plumbing than their names suggest: multiple
|
||||
Chrome-only, driverless-CDP projects sit in close lineage to each other, and a stealth
|
||||
plugin that patches the page in JavaScript can be functionally the same handful of
|
||||
overrides as another plugin under a different package name, because both are shimming
|
||||
the same well-known tells.
|
||||
|
||||
That matters for reading a benchmark because a table that lists five tools as five
|
||||
independent data points, when three of them share a code ancestor or the same underlying
|
||||
CDP quirks, is reporting less independent evidence than it looks like it's reporting.
|
||||
Three rows agreeing is weaker evidence than it appears if the three rows are close
|
||||
cousins, not three separate engineering efforts arriving at the same answer.
|
||||
|
||||
## What a trustworthy report actually looks like, with a real example
|
||||
|
||||
A GitHub issue is not usually where you'd point someone for methodology, but
|
||||
[`daijro/camoufox#555`](https://github.com/daijro/camoufox/issues/555), already covered
|
||||
in more depth in [how Akamai Bot Manager actually works](akamai-bot-manager-explained.md),
|
||||
is a genuinely good example of what disclosure looks like in practice. The reporter named
|
||||
exact software versions (Camoufox v135.0.1-beta.24, Playwright 1.58.0), the platform
|
||||
(Linux), confirmed both arms shared the same IP, named the specific fingerprint fields
|
||||
compared (JA3, JA4, Akamai's own HTTP/2 signature, all matched), and reported one
|
||||
concrete, checkable inconsistency (a viewport reported as 1280x720 to the automation
|
||||
layer against 1920 read back from `window.innerWidth` inside the page) rather than a bare
|
||||
"it got detected." It also reported the negative result honestly: several other
|
||||
Akamai-protected sites treated both browsers identically, which the reporter included
|
||||
even though it undercut the more dramatic claim.
|
||||
|
||||
Compare that to the shape most circulating benchmarks actually take: a screenshot of a
|
||||
green checkmark on a fingerprinting test page, no build number, no date, no IP type
|
||||
named, and a target described only as "top e-commerce sites." One of these can be
|
||||
independently checked by someone with no stake in the outcome. The other can only be
|
||||
taken on faith, and faith is exactly what a benchmark exists to replace.
|
||||
|
||||
## What would make a benchmark trustworthy
|
||||
|
||||
None of this is unique to browser stealth. Software and academic benchmarking both ran
|
||||
into the same problem earlier and arrived at similar answers. The ACM's own artifact
|
||||
review framework, built for exactly the "can I trust this published result" question,
|
||||
distinguishes **reproducibility** ("an independent group can obtain the same result using
|
||||
the author's own artifacts") from **replicability** ("an independent group can obtain the
|
||||
same result using artifacts which they develop completely independently"), and awards
|
||||
separate badges for whether artifacts are merely available versus whether results were
|
||||
actually reproduced by someone other than the author. A benchmark in this space doesn't
|
||||
need a formal badge, but the checklist behind it transfers directly:
|
||||
|
||||
- **Disclosed software versions**, both the tool under test and the framework driving it,
|
||||
named precisely enough that someone else could install the same ones.
|
||||
- **A dated result**, because every detector on the other side of the comparison keeps
|
||||
changing.
|
||||
- **A named IP type**, at minimum residential versus datacenter versus mobile, since
|
||||
that alone can flip an outcome independent of the browser.
|
||||
- **A comparable pass criterion across every arm**, the same test suite, the same site,
|
||||
the same definition of success, not a different bar for each tool being compared.
|
||||
- **A reproducible setup**, ideally a script or a repository someone else can run,
|
||||
which is the practical form the ACM's "artifacts available" badge takes outside
|
||||
academia.
|
||||
- **The negative results included**, not just the wins. The Camoufox issue above is more
|
||||
credible, not less, for reporting that most tested sites showed no difference at all.
|
||||
|
||||
## Reading this corpus's own comparisons with the same checklist
|
||||
|
||||
[This project's comparison pages](comparisons.md) try to apply some of this: [the
|
||||
Camoufox comparison](vs-camoufox.md) has a section titled "Where I could not verify a
|
||||
difference" that states plainly which claims about the other project's internals could
|
||||
not be checked against their own source, rather than filling the gap with an assumption
|
||||
in this project's favor. That is a real attempt at the discipline above, and it is still
|
||||
written by the maintainer of one of the two tools being compared. Read it, and every other
|
||||
comparison here, the way this whole page argues you should read anyone else's: check
|
||||
whether the targets, dates, IP types and pass criteria are actually disclosed, and treat
|
||||
the absence of a disclosed negative result as a gap, not as evidence there wasn't one.
|
||||
That standard doesn't relax for a benchmark that happens to favor this project. It's the
|
||||
same standard, applied without an exception clause for the author.
|
||||
|
||||
## Conclusion
|
||||
|
||||
A benchmark is a claim, not evidence, until it discloses what it tested, when, over what
|
||||
kind of IP, and what counting as a "pass" actually meant, in terms specific enough that
|
||||
someone with no stake in the outcome could rerun it and get a different answer if the
|
||||
original claim was wrong. Most comparisons in this space, including some published under
|
||||
this project's own name, fall short of that on at least one axis. The fix isn't to
|
||||
distrust every number; it's to ask the four questions above before treating any of them
|
||||
as settled, this page's own examples included.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Why do all the stealth-tool comparisons disagree with each other?** Usually because
|
||||
they tested different sites, on different dates, through different IP types, using
|
||||
different definitions of "pass." Those four variables alone can flip a leaderboard
|
||||
without either browser changing at all.
|
||||
|
||||
**Is a benchmark useless if it doesn't disclose everything?** Not useless, but it should
|
||||
be read as a claim rather than a settled result. Weight it in proportion to what it did
|
||||
disclose, and be specifically wary of a comparison that reports only wins.
|
||||
|
||||
**How do I know if two "different" tools are actually different?** Check whether they
|
||||
share an underlying implementation, a common CDP quirk, a common upstream library, or the
|
||||
same well-known JavaScript overrides under a different package name. Agreement between
|
||||
close cousins is weaker evidence than agreement between independent efforts.
|
||||
|
||||
**Should I trust this project's own comparison pages?** Apply the same checklist to them
|
||||
that this page recommends for anyone else's: are versions, dates, IP types and pass
|
||||
criteria disclosed, and are negative results included alongside the positive ones. Being
|
||||
the tool's own maintainer is a real conflict of interest regardless of how the page is
|
||||
written.
|
||||
|
||||
**What's the single best sign a benchmark is trustworthy?** A reproducible setup:
|
||||
something a stranger with no stake in the outcome could actually run themselves and get a
|
||||
checkable answer from, rather than a screenshot or a summary paragraph.
|
||||
|
||||
**Does a bigger sample of sites make a benchmark more trustworthy?** Only if the sites
|
||||
are named and the sample wasn't selected to favor one side. An undisclosed large sample
|
||||
is not more trustworthy than a disclosed small one; it's just a bigger unverifiable claim.
|
||||
|
||||
**See also:** [How to test bot detection without a false pass](how-to-test-bot-detection.md),
|
||||
for the companion question of testing your own browser rather than reading someone else's
|
||||
published comparison; [the comparisons hub](comparisons.md), for this project's own
|
||||
attempts, imperfect as any author's, to apply this standard to itself; and
|
||||
[invisible_playwright vs Camoufox: two patched Firefoxes](vs-camoufox.md), for the
|
||||
specific comparison that names what it could and could not verify.
|
||||
|
||||
## Sources
|
||||
|
||||
- ACM, [Artifact Review and Badging](https://www.acm.org/publications/policies/artifact-review-and-badging-current),
|
||||
retrieved 2026-08-30, for the reproducibility/replicability distinction and the
|
||||
disclosed-artifact badging framework the checklist above is adapted from.
|
||||
- GitHub, [`daijro/camoufox` issue #555](https://github.com/daijro/camoufox/issues/555),
|
||||
retrieved 2026-08-30, for the disclosed-methodology example: named versions, matched
|
||||
IP and network fingerprints, a specific reported inconsistency, and included negative
|
||||
results across other tested sites.
|
||||
- This project's own [how to test bot detection without a false pass](how-to-test-bot-detection.md)
|
||||
and [invisible_playwright vs Camoufox](vs-camoufox.md) pages, for the internal
|
||||
precedent this page holds itself to, including where each already discloses a limit
|
||||
on what it could verify.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. This page names its own conflict of interest in the
|
||||
first paragraph because that's the discipline it's asking of everyone else's benchmark,
|
||||
including any that would have made this project look good.*
|
||||
@@ -11,7 +11,7 @@ nav_order: 74
|
||||
|
||||
To resume an interrupted Playwright scrape, write a small durable checkpoint after each
|
||||
unit of work, then on restart skip the work already done, re-validate the boundary item,
|
||||
and relaunch with the same seed so the site sees one returning visitor rather than a new
|
||||
and relaunch with the same seed so the site sees one returning visitor instead of a new
|
||||
one. Stock Playwright gives you the checkpoint and the resume path; a seeded fingerprint
|
||||
keeps the resumed run continuous.
|
||||
|
||||
@@ -26,7 +26,7 @@ There is a second failure most guides miss. If every restart launches a fresh br
|
||||
identity, the site does not see one job that hiccuped. It sees a new visitor appear each
|
||||
time the job restarts, which is a pattern in its own right. The fix for that is the same
|
||||
lever this project uses everywhere: a seeded, reproducible fingerprint, so a resumed run
|
||||
is the same visitor coming back rather than a new one arriving.
|
||||
is the same visitor coming back, not a new one arriving.
|
||||
|
||||
## Why a naive restart is the worst of both options
|
||||
|
||||
@@ -53,7 +53,7 @@ a paginated crawl it is the last page number and the last item ID on it. For a c
|
||||
it is the cursor token the server handed you. For a list of URLs it is the set of URLs
|
||||
already done.
|
||||
|
||||
Two rules make it durable rather than decorative. Write it incrementally, after each unit
|
||||
Two rules make it durable, not decorative. Write it incrementally, after each unit
|
||||
of work, not once at the end where a crash guarantees you never reach it. And write it
|
||||
atomically, so a crash in the middle of writing the file cannot leave you with a
|
||||
half-written checkpoint that is worse than none.
|
||||
@@ -142,7 +142,7 @@ def run():
|
||||
|
||||
`done_ids` doing the dedup means the boundary page can be re-read safely: rows already
|
||||
written are skipped by ID, so re-validating costs you a re-fetch and never a duplicate. For
|
||||
larger runs, keep `done_ids` in a set-backed store (a SQLite table, a Redis set) rather than
|
||||
larger runs, keep `done_ids` in a set-backed store (a SQLite table, a Redis set) in place of
|
||||
a growing JSON array, but the shape is identical.
|
||||
|
||||
If a page fails transiently rather than fatally, resuming the whole process is the wrong
|
||||
|
||||
@@ -29,7 +29,7 @@ mention it because their browser cannot fix it anyway.
|
||||
|
||||
Rotate the proxy once per browser session, not once per request: give one browser
|
||||
launch one proxy and hold it for the whole visit, then close the session and start the
|
||||
next one on a different proxy. This is the [sticky-session pattern rather than a
|
||||
next one on a different proxy. This is the [sticky-session pattern instead of a
|
||||
per-request rotating pool](sticky-vs-rotating-proxy-sessions.md), and for a browser it
|
||||
is the correct default.
|
||||
|
||||
@@ -68,7 +68,7 @@ for i, proxy in enumerate(proxies):
|
||||
|
||||
Each iteration is a separate process, a separate seed, and a separate proxy. Each one
|
||||
gets its own canvas hash, GPU string, font set and timezone, because those are derived
|
||||
from the seed and the exit rather than left over from the previous session. That is
|
||||
from the seed and the exit, not left over from the previous session. That is
|
||||
also the property a shared-browser, proxy-per-context setup does not have: every
|
||||
context in one browser reports the same hardware regardless of which proxy it is
|
||||
tunneled through, which is exactly what
|
||||
@@ -114,7 +114,7 @@ with InvisiblePlaywright(proxy=proxy) as browser:
|
||||
```
|
||||
|
||||
A `socks5://` or `socks4://` server is written into the browser's own proxy
|
||||
preferences, credentials included, rather than handed to Playwright's proxy layer
|
||||
preferences, credentials included, not handed to Playwright's proxy layer
|
||||
where the credentials are silently dropped. `http://` and `https://` servers go to
|
||||
Playwright directly, because that is the path where its credential support is real.
|
||||
The endpoint needs an explicit port; a bare host with no port is refused rather than
|
||||
|
||||
@@ -9,7 +9,7 @@ nav_order: 63
|
||||
|
||||
# How to scrape a sitemap.xml with Playwright
|
||||
|
||||
To scrape a `sitemap.xml` with Playwright, treat it as a tree rather than a flat list: read
|
||||
To scrape a `sitemap.xml` with Playwright, treat it as a tree instead of a flat list: read
|
||||
the root element to tell a `<sitemapindex>` from a `<urlset>`, recurse into the child
|
||||
sitemaps, decompress any `.xml.gz` leaves, and key each URL on its `<lastmod>` so later runs
|
||||
recrawl only what changed. Fetch the whole tree through the browser context, because the file
|
||||
@@ -56,7 +56,7 @@ A **sitemap index** is a table of contents whose `<loc>` values point at more si
|
||||
|
||||
The single most common way this code breaks is iterating a document as if it were a url set
|
||||
when it is really an index. You get a list of `<loc>` values that look like URLs, you crawl
|
||||
them, and every one is another XML file rather than a page. So the rule is: read the root
|
||||
them, and every one is another XML file, not a page. So the rule is: read the root
|
||||
element first and branch on it. Never assume the shape.
|
||||
|
||||
Child sitemaps are frequently gzip-compressed and served as `.xml.gz`, because an
|
||||
@@ -75,7 +75,7 @@ driving, it returns the file.
|
||||
So fetch it through the browser context.
|
||||
[Playwright's request API](https://playwright.dev/python/docs/api/class-apirequestcontext) sends
|
||||
the fetch through the same browser network stack, sharing its cookies, its proxy, and its
|
||||
engine-level handshake, which is the whole point of using a patched engine rather than a
|
||||
engine-level handshake, which is the whole point of using a patched engine instead of a
|
||||
header generator. With `invisible_playwright` that browser is a real Firefox patched at the
|
||||
C++ level and driven by stock Playwright, so switching to it is the launch line and nothing else:
|
||||
|
||||
@@ -99,7 +99,7 @@ def fetch_xml(page, url):
|
||||
return ET.fromstring(raw)
|
||||
```
|
||||
|
||||
`resp.body()` gives you the raw bytes rather than a decoded string, which matters because a
|
||||
`resp.body()` gives you the raw bytes in place of a decoded string, which matters because a
|
||||
`.xml.gz` leaf is not text yet. Checking the
|
||||
[two-byte gzip magic](https://datatracker.ietf.org/doc/html/rfc1952) and calling
|
||||
`gzip.decompress` handles the compressed case; a file the server already decompressed for you
|
||||
|
||||
@@ -92,7 +92,7 @@ raises nothing, because an empty string is a legal value for an empty element. A
|
||||
forty panels finishes green, writes forty rows, and every row is blank.
|
||||
|
||||
That is why the guard above is not decoration. An empty panel means your assumption about
|
||||
the page was wrong, and the run should stop and say so rather than fill a file with nothing.
|
||||
the page was wrong, and the run should stop and say so, not fill a file with nothing.
|
||||
|
||||
## aria-expanded and aria-controls beat class names
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ nav_order: 100
|
||||
To scrape appointment availability with Playwright, capture the calendar response the
|
||||
page fetches for each week or month instead of reading the painted cells, key every row
|
||||
to the provider, the service type and the location it was resolved for, stamp it in UTC
|
||||
when the response lands, and stop at the grid rather than clicking a slot, because in
|
||||
when the response lands, and stop at the grid instead of clicking a slot, because in
|
||||
many systems selecting one places a hold that takes it away from every other visitor.
|
||||
|
||||
An appointment grid looks like a published schedule and behaves like contested
|
||||
|
||||
@@ -0,0 +1,275 @@
|
||||
---
|
||||
title: "How to scrape bank interest rates with Playwright"
|
||||
description: "Scrape published deposit and lending rates with Playwright: resolve the footnotes that change the rate, keep the balance tiers separate, and record the effective date the bank prints."
|
||||
parent: "Scraping with Playwright"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 164
|
||||
---
|
||||
|
||||
|
||||
# How to scrape bank interest rates with Playwright
|
||||
|
||||
To scrape published rates, capture the **footnote with the number**. A rate table on a
|
||||
bank site is a set of headline figures whose real meaning lives in the small print
|
||||
underneath: an introductory period, a balance tier, a requirement to hold another product,
|
||||
a rate that drops after twelve months. The headline without its footnote is not a
|
||||
simplification, it is a different number.
|
||||
|
||||
The second structural fact is tiering. One product usually has several rates, one per
|
||||
balance band, and the page shows the best one in large type. A scrape that takes the large
|
||||
type produces a table where every bank looks like its best case.
|
||||
|
||||
This page covers resolving footnote markers to their text, reading tiers as rows, and
|
||||
keeping the effective date the bank publishes.
|
||||
|
||||
## Resolve the marker to the text, at capture time
|
||||
|
||||
Footnote markers are superscripts that point at a list further down the page. Follow the
|
||||
pointer while you have the DOM:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
RESOLVE = """
|
||||
() => {
|
||||
const notes = {};
|
||||
document.querySelectorAll('.footnotes li[id]').forEach(li => {
|
||||
notes[li.id] = li.textContent.trim();
|
||||
});
|
||||
return Array.from(document.querySelectorAll('table.rates tbody tr')).map(tr => {
|
||||
const cells = Array.from(tr.querySelectorAll('td')).map(td => td.textContent.trim());
|
||||
const marks = Array.from(tr.querySelectorAll('sup a[href^="#"]'))
|
||||
.map(a => notes[a.getAttribute('href').slice(1)])
|
||||
.filter(Boolean);
|
||||
return { cells, footnotes: marks };
|
||||
});
|
||||
}
|
||||
"""
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example-bank.com/savings/rates")
|
||||
page.wait_for_selector("table.rates tbody tr")
|
||||
rows = page.evaluate(RESOLVE)
|
||||
```
|
||||
|
||||
Doing this in one evaluation matters because the markers and the notes are in different
|
||||
parts of the document, and resolving them later from two separately captured lists means
|
||||
matching on an id you may not have kept.
|
||||
|
||||
## Tiers are rows, and the tier bounds are part of the rate
|
||||
|
||||
```python
|
||||
import re
|
||||
|
||||
TIER = re.compile(r"(?P<lo>[\d,]+)\s*(?:to|-|and above|\+)?\s*(?P<hi>[\d,]+)?", re.I)
|
||||
|
||||
def parse_tier(text):
|
||||
m = TIER.search(text.replace("$", "").replace("£", ""))
|
||||
if not m:
|
||||
return {"tier_text": text}
|
||||
return {
|
||||
"tier_text": text,
|
||||
"min_balance": int(m.group("lo").replace(",", "")),
|
||||
"max_balance": int(m.group("hi").replace(",", "")) if m.group("hi") else None,
|
||||
}
|
||||
```
|
||||
|
||||
A null `max_balance` means the top band, which is open ended. Keep `tier_text` as well,
|
||||
because banks write bands in ways this regex will not always survive, and the original
|
||||
string is what lets you tell a parse failure from an unusual product.
|
||||
|
||||
## APR and APY are not interchangeable
|
||||
|
||||
Deposit products publish an annual yield that includes compounding; lending products
|
||||
publish an annual rate that includes fees, under names that vary by country. The two are
|
||||
not comparable and the page often shows both:
|
||||
|
||||
```python
|
||||
row["rate_kind"] = header_for(column_index) # "APY", "APR", "AER", "nominal"
|
||||
```
|
||||
|
||||
Take the label from the column header instead of assuming. Storing every percentage in a
|
||||
column called `rate` merges two different quantities, and the error is invisible until
|
||||
someone compares a savings account to a loan and gets a sensible-looking answer.
|
||||
|
||||
## Effective date, and the fact that these pages are cached hard
|
||||
|
||||
Banks print an effective date, and it is the closest thing to a timestamp the data has:
|
||||
|
||||
```python
|
||||
node = page.query_selector(".rates-effective, .as-of-date")
|
||||
row["effective_text"] = node.inner_text().strip() if node else None
|
||||
row["captured_at"] = time.time()
|
||||
```
|
||||
|
||||
Keep both, for the same reason as any live-status scrape: the page you fetched today may
|
||||
be serving a rate table from last week, and the effective date is the only field that
|
||||
reveals it. If the effective date has not moved in weeks while a central bank has, the
|
||||
page is stale, not the rates being unchanged.
|
||||
|
||||
## Products live behind a selector
|
||||
|
||||
Larger banks put rates behind a product picker, a region picker, or both, with no URL
|
||||
change. Set them explicitly and record them:
|
||||
|
||||
```python
|
||||
page.select_option("select#region", "CA")
|
||||
page.select_option("select#product", "TFSA")
|
||||
page.wait_for_selector("table.rates tbody tr")
|
||||
row["region"] = "CA"
|
||||
row["product"] = "TFSA"
|
||||
```
|
||||
|
||||
Rates genuinely differ by region within the same bank, and a table captured without the
|
||||
region column cannot be compared with itself next month. Where the region is inferred from
|
||||
the visitor rather than selected, that is
|
||||
[geotargeted content](how-to-scrape-geotargeted-content-playwright.md) and the exit
|
||||
becomes part of the query.
|
||||
|
||||
## Read the published rate, and nothing behind a login
|
||||
|
||||
Everything above is the public rate card, which banks publish deliberately and update on a
|
||||
schedule. The parts behind authentication are account data belonging to a person, and the
|
||||
reasoning in
|
||||
[why automating login is riskier than reusing a session](automating-login-vs-session-reuse.md)
|
||||
applies with the extra weight that financial institutions treat automated access to
|
||||
accounts as a security event, correctly.
|
||||
|
||||
Public rate cards change daily at most, usually less. A daily pass is generous, the pacing
|
||||
in [rate limiting your own scraper](how-to-rate-limit-your-scraper-playwright.md) applies,
|
||||
and storing the history in
|
||||
[a SQLite database](how-to-scrape-into-a-database-playwright.md) gives you the one thing
|
||||
the bank's own page never shows: what the rate used to be.
|
||||
|
||||
## A complete pass over several products
|
||||
|
||||
```python
|
||||
import json, time
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
PRODUCTS = [("CA", "TFSA"), ("CA", "GIC"), ("CA", "SAVINGS")]
|
||||
|
||||
def read_rates(page, region, product):
|
||||
page.goto("https://example-bank.com/savings/rates", wait_until="domcontentloaded")
|
||||
page.select_option("select#region", region)
|
||||
page.select_option("select#product", product)
|
||||
page.wait_for_function(
|
||||
"() => document.querySelectorAll('table.rates tbody tr').length > 0")
|
||||
|
||||
node = page.query_selector(".rates-effective, .as-of-date")
|
||||
effective = node.inner_text().strip() if node else None
|
||||
kinds = page.eval_on_selector_all(
|
||||
"table.rates thead th", "els => els.map(e => e.textContent.trim())")
|
||||
|
||||
rows = []
|
||||
for parsed in page.evaluate(RESOLVE):
|
||||
cells, notes = parsed["cells"], parsed["footnotes"]
|
||||
if len(cells) < 2:
|
||||
continue
|
||||
rows.append({
|
||||
"region": region, "product": product,
|
||||
**parse_tier(cells[0]),
|
||||
"rate_text": cells[1],
|
||||
"rate_kind": kinds[1] if len(kinds) > 1 else None,
|
||||
"footnotes": notes,
|
||||
"effective_text": effective,
|
||||
"observed_at": time.time(),
|
||||
})
|
||||
return rows
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser, open("rates.jsonl", "a", encoding="utf-8") as out:
|
||||
page = browser.new_page()
|
||||
for region, product in PRODUCTS:
|
||||
for row in read_rates(page, region, product):
|
||||
out.write(json.dumps(row, ensure_ascii=False) + "\n")
|
||||
out.flush()
|
||||
page.wait_for_timeout(4000)
|
||||
```
|
||||
|
||||
Reading the column headers into `rate_kind` rather than hardcoding "APY" is what keeps the
|
||||
dataset correct when the bank reorders its table or serves a different label by region.
|
||||
It costs one line and removes a whole class of silent mismatch.
|
||||
|
||||
## Banks cache hard, and that is the failure to design for
|
||||
|
||||
Retail banking sites are rarely hostile to a reader, and they are aggressively cached and
|
||||
heavily regionalised. Three consequences.
|
||||
|
||||
**A stale page is the normal failure.** The request succeeds, the table renders, and the
|
||||
effective date is from last week. That is why `effective_text` is captured on every row
|
||||
rather than derived once: without it, a series shows a rate holding steady when the page
|
||||
simply was not refreshed.
|
||||
|
||||
**The region control sometimes loses.** Where the site also infers a region from the
|
||||
visitor, selecting one in the dropdown can be overridden on the next navigation. Read the
|
||||
region back from the page after the table loads, and record what the page says rather than
|
||||
what you asked for:
|
||||
|
||||
```python
|
||||
shown = page.eval_on_selector("select#region", "e => e.value")
|
||||
if shown != region:
|
||||
row["region_requested"], row["region"] = region, shown
|
||||
```
|
||||
|
||||
**Product pages sit behind an interstitial.** Regulatory splash screens and region pickers
|
||||
appear on first visit in several markets, and a run that does not clear them reads the
|
||||
splash instead of the rates. Handle it once per session the same way as any
|
||||
[cookie consent banner](how-to-handle-cookie-consent-banners-playwright.md).
|
||||
|
||||
If a rate table does come back empty rather than stale, the page itself is the fastest
|
||||
diagnosis, in the order set out in
|
||||
[scraping without getting blocked](how-to-scrape-without-getting-blocked.md).
|
||||
|
||||
## The schema, and the join that makes it useful
|
||||
|
||||
One row per bank, region, product, tier and observation, with footnotes as an array:
|
||||
|
||||
| field | why it earns its place |
|
||||
|---|---|
|
||||
| `min_balance` / `max_balance` | the tier, with null meaning open ended |
|
||||
| `rate_text` and parsed `rate` | the string survives a format change |
|
||||
| `rate_kind` | APY and APR are different quantities |
|
||||
| `footnotes` | resolved text, not markers |
|
||||
| `effective_text` | the bank's clock |
|
||||
| `observed_at` | yours, so staleness is measurable |
|
||||
|
||||
The analysis this shape enables, and that the banks' own pages cannot, is the one comparing
|
||||
a headline rate against its conditions over time. Introductory rates that quietly shorten
|
||||
their bonus period, tiers whose thresholds drift upward, and footnotes that gain a
|
||||
requirement between two captures are all visible as a diff, and all invisible in a table
|
||||
that keeps only the current best rate per product.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What do the little superscript markers next to a rate mean?** They point at a
|
||||
footnote further down the page, and the footnote frequently carries the condition that
|
||||
makes the rate real: a minimum balance, a term, a new-money-only clause. Resolve the
|
||||
marker to its text at capture time, while the pointer is still in front of you.
|
||||
|
||||
**Is APR the same as APY?** No, and mixing them is the most common error in this data.
|
||||
Deposit products publish a yield that includes compounding; lending products publish a
|
||||
rate that does not. Read the column header into the row instead of hardcoding either.
|
||||
|
||||
**The rate table has bands. What is the row?** The tier. Tier bounds are part of the
|
||||
rate, and a null upper bound means the open-ended top band. Keep the tier text as
|
||||
written too, because banks describe the same band in words that do not always match
|
||||
the numbers.
|
||||
|
||||
**How fresh is a published rate?** Banks print an effective date, and it is the
|
||||
closest thing to a timestamp this data has. These pages are also cached hard, so the
|
||||
effective date and your fetch time can differ by days.
|
||||
|
||||
**See also:** [How to scrape geotargeted content with
|
||||
Playwright](how-to-scrape-geotargeted-content-playwright.md), [How to handle cookie
|
||||
consent banners in Playwright](how-to-handle-cookie-consent-banners-playwright.md),
|
||||
[How to scrape into a SQLite database with
|
||||
Playwright](how-to-scrape-into-a-database-playwright.md)
|
||||
|
||||
## Sources
|
||||
|
||||
- Playwright, Locators, https://playwright.dev/python/docs/api/class-locator - driving
|
||||
a product or region picker that changes content with no URL change, and waiting for
|
||||
the table to repopulate before reading it.
|
||||
- This project's page on geotargeted content, which covers the region half of the same
|
||||
problem.
|
||||
@@ -13,7 +13,7 @@ To scrape business directory listings with Playwright, drive the search form for
|
||||
location-and-category pair, wait for the results to render, un-obfuscate the contact fields,
|
||||
and follow the site's own next control to walk the filtered pagination to its end. Run the
|
||||
whole city-by-category matrix under one pinned identity so it reads as a single visitor
|
||||
rather than a fleet of one-page strangers.
|
||||
instead of a fleet of one-page strangers.
|
||||
|
||||
A business directory looks like a flat list and behaves like a nested loop. There is no
|
||||
page you can request that returns every listing. There is a search form that wants a
|
||||
@@ -41,7 +41,7 @@ for city in cities:
|
||||
extract the listings on this page
|
||||
```
|
||||
|
||||
That structure is why a directory is throttled by identity rather than by request rate
|
||||
That structure is why a directory is throttled by identity, not by request rate
|
||||
alone. A human browsing the plumbers in one city visits a handful of pages. A full sweep
|
||||
visits every city crossed with every category, and every one of those is the same visitor
|
||||
asking a slightly different question. If that visitor's fingerprint changes between the
|
||||
@@ -50,7 +50,7 @@ watching a fleet of one-page strangers, which is a far cheaper thing to detect.
|
||||
|
||||
So the first design decision is to pin the identity for the whole sweep with a seed, and
|
||||
only vary the exit address deliberately. A fixed seed also makes the crawl replayable: if
|
||||
the extractor breaks on one category, you re-run the exact same browser rather than a new
|
||||
the extractor breaks on one category, you re-run the exact same browser instead of a new
|
||||
random one and get the same page back. That reproducibility is the whole reason
|
||||
[this project derives every surface from one seed](quickstart.md).
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ with InvisiblePlaywright(seed=42) as browser:
|
||||
page.wait_for_selector("[data-testid='listing-card']")
|
||||
```
|
||||
|
||||
Waiting for a concrete element rather than a load event matters more here than on a static
|
||||
Waiting for a concrete element instead of a load event matters more here than on a static
|
||||
page, because the grid arrives after the document does. The difference between the load
|
||||
events and why `networkidle` misleads on a feed like this is covered in [how to wait for a
|
||||
page to load](how-to-wait-for-page-load-playwright.md); on a faceted search the honest
|
||||
|
||||
@@ -10,7 +10,7 @@ nav_order: 132
|
||||
# How to scrape fitness class schedules with Playwright
|
||||
|
||||
To scrape fitness class schedules with Playwright, read each row into a natural key
|
||||
of studio, class name, room and start time rather than trusting the row's own
|
||||
of studio, class name, room and start time instead of trusting the row's own
|
||||
occurrence id, fetch spots remaining and waitlist state from the separate endpoints
|
||||
that actually carry them instead of the rendered grid, walk the calendar forward one
|
||||
week per request because there is no week-agnostic feed, and stamp every pull with
|
||||
@@ -37,7 +37,7 @@ two behave identically until you diff two weeks and every row looks new.
|
||||
Do not build a pipeline that assumes the id survives. Build the key out of the facts
|
||||
that describe the slot itself: studio, class name, room and the ISO start time
|
||||
carries the schedule's meaning, and the occurrence id becomes metadata you store
|
||||
alongside it rather than the thing you key on.
|
||||
alongside it, not the thing you key on.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
@@ -193,6 +193,17 @@ responses mid-scrape](how-to-handle-403-429-backoff-mid-scrape-playwright.md).
|
||||
```python
|
||||
from datetime import timedelta
|
||||
|
||||
def read_row(row, week_start):
|
||||
# the same shape as the first block, plus the week it came from
|
||||
return {
|
||||
"occurrence_id": row.get_attribute("data-occurrence-id"),
|
||||
"class_name": row.locator(".class-name").inner_text(),
|
||||
"instructor": row.locator(".instructor").inner_text(),
|
||||
"room": row.locator(".room").inner_text(),
|
||||
"start_time": row.get_attribute("data-start-iso"),
|
||||
"week_start": week_start.isoformat(),
|
||||
}
|
||||
|
||||
def pull_weeks(page, base_url, studio, start_week, max_weeks=8):
|
||||
all_classes = []
|
||||
for week_offset in range(max_weeks):
|
||||
@@ -279,8 +290,8 @@ def scrape_schedule(studio, start_week, max_weeks=4):
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
|
||||
capacities = {}
|
||||
page.on("response", lambda r: on_response(r, capacities))
|
||||
capacities.clear() # the module-level store the listener writes into
|
||||
page.on("response", on_response)
|
||||
|
||||
rows = pull_weeks(page, "https://example.com/schedule",
|
||||
studio, start_week, max_weeks)
|
||||
|
||||
@@ -67,7 +67,7 @@ timezone is several surfaces a detector cross-checks, not one value.
|
||||
|
||||
## Set the site's location the way a visitor does
|
||||
|
||||
Drive the site's location selector rather than injecting a value. The selector is usually
|
||||
Drive the site's location selector instead of injecting a value. The selector is usually
|
||||
a control that opens, takes a typed city, and offers a suggestion to click:
|
||||
|
||||
```python
|
||||
@@ -87,7 +87,7 @@ a pointer that traveled to the control, which is
|
||||
|
||||
Once the feed is scoped, the cards are a repeating DOM structure and you read them in a
|
||||
loop. Because the feed is infinite and rotates, treat "how many cards" as "how many you
|
||||
scroll to", and dedupe on the listing's own id rather than on position, since positions
|
||||
scroll to", and dedupe on the listing's own id, not on position, since positions
|
||||
shift as new listings arrive:
|
||||
|
||||
```python
|
||||
@@ -146,7 +146,7 @@ for listing in list(seen.values()):
|
||||
```
|
||||
|
||||
That the click looks human is not a slogan here, it is the whole reason a patched engine
|
||||
is doing the driving. The pointer travels to the control on a curved path rather than
|
||||
is doing the driving. The pointer travels to the control on a curved path instead of
|
||||
teleporting, which is [what human mouse movement means in practice](human-mouse-movement.md),
|
||||
and the resulting event is trusted rather than synthetic. Space the reveals out. A hundred
|
||||
reveal clicks a minute from one session is a velocity signal no fingerprint can launder.
|
||||
|
||||
@@ -13,9 +13,9 @@ To scrape clinical trial listings with Playwright, timestamp every status read s
|
||||
status field decays between visits, carry both the registry's own identifier and any
|
||||
international identifier the same trial carries in a different country's registry, keep
|
||||
eligibility criteria as a list of text strings instead of parsed logic, store enrollment
|
||||
as a target figure with its actual-or-anticipated label rather than a headcount, extract
|
||||
as a target figure with its actual-or-anticipated label instead of a headcount, extract
|
||||
one recruiting status per listed site instead of one per trial, and log the absence of a
|
||||
results section as unreported rather than unfinished.
|
||||
results section as unreported, not unfinished.
|
||||
|
||||
A trial listing reads like a fact sheet and behaves like several records glued onto one
|
||||
page. The status line, the enrollment number, the site table and the results tab each
|
||||
@@ -118,11 +118,10 @@ a numbered or bulleted list under an "Inclusion Criteria" heading, another under
|
||||
each line is not something a scraper should try to parse.
|
||||
|
||||
An age range written as "must be between 18 and 65 years of age" looks like two numbers
|
||||
waiting to be extracted, until the next criterion reads "diagnosed within the last five
|
||||
years" or "prior treatment with at least one but no more than three agents," where the
|
||||
comparison, the units and the exceptions are all doing real work in the sentence. Storing
|
||||
each criterion as its own string keeps the boundary honest: the scraper's job stops at
|
||||
splitting the list, and a clinician or a downstream model reads the sentence.
|
||||
waiting to be extracted, until the next criterion reads "prior treatment with at least one
|
||||
but no more than three agents," where the comparison and the exception are doing real work
|
||||
in the sentence. Storing each criterion as its own string keeps the boundary honest: the
|
||||
scraper's job stops at splitting the list, and a clinician reads the sentence.
|
||||
|
||||
```python
|
||||
def read_eligibility(page):
|
||||
@@ -211,12 +210,11 @@ and gone through whatever review the registry requires before publishing it. A t
|
||||
no results section is, more often than not, simply a trial whose results have not arrived
|
||||
yet.
|
||||
|
||||
The distinction worth encoding is "not reported" versus "not applicable," and most
|
||||
registries mark the second case explicitly rather than leaving it to be inferred: a note
|
||||
attached to the results area stating that results reporting does not apply to this study
|
||||
type or this outcome. Absent that explicit marker, treat a missing results section on a
|
||||
completed or terminated trial as pending, not as evidence the study never finished, and
|
||||
re-check it on the same schedule you use for status.
|
||||
The distinction worth encoding is "not reported" versus "not applicable." Most registries
|
||||
mark the second case explicitly, with a note attached to the results area stating that
|
||||
reporting does not apply to this study type. Absent that marker, treat a missing results
|
||||
section on a completed or terminated trial as pending, and re-check it on the same
|
||||
schedule you use for status.
|
||||
|
||||
```python
|
||||
def read_results_status(page):
|
||||
@@ -238,13 +236,12 @@ a re-check cycle on a record that is already complete in every sense that matter
|
||||
|
||||
## Assembling one row per trial, sized for re-checking
|
||||
|
||||
Put the pieces together and the record for one trial is a dict with a handful of scalar
|
||||
fields, two nested lists (eligibility, sites), and a checked-at timestamp that makes the
|
||||
whole thing safe to overwrite on the next pass instead of trusting it forever. Getting to
|
||||
that record usually means walking a paginated search listing first to collect trial URLs,
|
||||
the same [numbered pagination](how-to-scrape-paginated-pages-playwright.md) pattern used
|
||||
on any other listing page, then visiting each one, which is the general [list-to-detail
|
||||
crawl](how-to-crawl-list-to-detail-pages-playwright.md) shape.
|
||||
Put the pieces together and one trial's record is a dict with a handful of scalar fields,
|
||||
two nested lists, and a checked-at timestamp that makes the whole thing safe to overwrite
|
||||
on the next pass. Getting there means walking a paginated search listing first to collect
|
||||
trial URLs, the same [numbered pagination](how-to-scrape-paginated-pages-playwright.md)
|
||||
pattern used on any listing page, then visiting each one, the general
|
||||
[list-to-detail crawl](how-to-crawl-list-to-detail-pages-playwright.md) shape.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
@@ -291,14 +288,13 @@ database](how-to-scrape-into-a-database-playwright.md), and it is what makes the
|
||||
## Conclusion
|
||||
|
||||
A clinical trial listing is not one fact, it is several records at different ages sharing
|
||||
a page. Status decays and needs a re-check timestamp. The registry-specific identifier and
|
||||
the international identifier both belong on the row, because a dedup step across
|
||||
registries needs the second one. Eligibility criteria stay as text, because the logic
|
||||
inside them is not something a scraper should parse. Enrollment needs its label kept
|
||||
alongside the number, or a target quietly becomes a headcount. Site status is a separate,
|
||||
finer field than trial status. And a missing results section is usually a timing gap, not
|
||||
a dead end, unless the page says otherwise. Build the row to be overwritten safely on the
|
||||
next pass, and the pipeline stays honest about how current every field actually is.
|
||||
a page. Status decays and needs a re-check timestamp. Both identifiers belong on the row,
|
||||
because a dedup step across registries needs the international one. Eligibility criteria
|
||||
stay as text, because the logic inside them is not something a scraper should parse.
|
||||
Enrollment needs its label kept alongside the number, or a target quietly becomes a
|
||||
headcount. Site status is a separate, finer field than trial status, and a missing results
|
||||
section is usually a timing gap rather than a dead end. Build the row to be overwritten
|
||||
safely on the next pass, and the pipeline stays honest about how current every field is.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
@@ -315,21 +311,15 @@ inside the sentences is a separate problem from scraping the page.
|
||||
often the target written into the protocol, and it is only an actual count when the page
|
||||
labels it that way. Store the label with the number.
|
||||
|
||||
**A trial shows one status but a location page shows a different one for a specific
|
||||
site. Which is right?** Both, because they are different fields. Trial-level status and
|
||||
site-level status move independently, and a site can close or open without the overall
|
||||
trial status changing.
|
||||
**A trial shows one status but a listed site shows a different one. Which is right?**
|
||||
Both. They are different fields, and a site can close or open without the overall trial
|
||||
status changing.
|
||||
|
||||
**A completed trial has no results section. Is that a bug in my scraper?** Probably not.
|
||||
Results are added long after registration, sometimes years later, so a completed trial can
|
||||
legitimately show no results yet. Look for an explicit "not applicable" marker before
|
||||
assuming the study never finished.
|
||||
|
||||
**How often should I re-scrape a trial once I have it?** Often enough that the
|
||||
`status_checked_at` field stays meaningful for your use case. A recruiting trial changes
|
||||
state more often than a completed one, so a fixed schedule for every trial wastes cycles
|
||||
on the ones that rarely move and under-checks the ones that do.
|
||||
|
||||
## Sources
|
||||
|
||||
- Playwright's [`Locator`](https://playwright.dev/python/docs/api/class-locator) API,
|
||||
@@ -339,10 +329,9 @@ on the ones that rarely move and under-checks the ones that do.
|
||||
- Playwright's
|
||||
[`wait_for_load_state`](https://playwright.dev/python/docs/api/class-page#page-wait-for-load-state),
|
||||
used to detect the end of a pagination click before reading the next page's rows.
|
||||
- This page describes registry mechanics in generic terms on purpose: field names,
|
||||
status vocabularies and identifier formats differ between registries, so verify the
|
||||
selectors above against the specific registry you are reading before trusting them
|
||||
at scale.
|
||||
- This page describes registry mechanics in generic terms on purpose, since field names
|
||||
and identifier formats differ between registries: verify the selectors above against
|
||||
the specific registry you are reading before trusting them at scale.
|
||||
|
||||
**See also:** [crawling a list to its detail pages](how-to-crawl-list-to-detail-pages-playwright.md)
|
||||
for the general listing-to-detail shape used in the last section,
|
||||
|
||||
@@ -0,0 +1,261 @@
|
||||
---
|
||||
title: "How to scrape conference agendas with Playwright"
|
||||
description: "Scrape conference schedules with Playwright: read a grid with parallel tracks without losing the track, resolve the event timezone once, and follow the session pages for speakers and abstracts."
|
||||
parent: "Scraping with Playwright"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 162
|
||||
---
|
||||
|
||||
|
||||
# How to scrape conference agendas with Playwright
|
||||
|
||||
To scrape an agenda, read the schedule as a **grid of tracks over time**, not as a
|
||||
list of sessions, and resolve the timezone once for the whole event. A conference agenda
|
||||
is one of the few web tables where position carries meaning: the column a session sits in
|
||||
is its track, and the rows above and below it are what it clashes with.
|
||||
|
||||
A list-shaped scrape loses that. It gives you every session with a start time and no way
|
||||
to answer the only question most people have, which is what runs against what.
|
||||
|
||||
This page covers reading the grid with its track intact, handling the timezone properly,
|
||||
and following through to the session pages where the speakers and abstracts live.
|
||||
|
||||
## Read the column, because the column is the track
|
||||
|
||||
Grid layouts put the track in a header, not in each cell. Read the header once, then map
|
||||
each session to the column it occupies:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
GRID = """
|
||||
() => {
|
||||
const tracks = Array.from(document.querySelectorAll('.schedule-grid .track-header'))
|
||||
.map(h => h.textContent.trim());
|
||||
return Array.from(document.querySelectorAll('.schedule-grid .session')).map(s => {
|
||||
const col = Number(getComputedStyle(s).getPropertyValue('grid-column-start')) || null;
|
||||
return {
|
||||
title: s.querySelector('.session-title')?.textContent.trim() || null,
|
||||
start: s.dataset.start || null,
|
||||
end: s.dataset.end || null,
|
||||
href: s.querySelector('a')?.getAttribute('href') || null,
|
||||
track: col && tracks[col - 1] ? tracks[col - 1] : (s.dataset.track || null),
|
||||
};
|
||||
});
|
||||
}
|
||||
"""
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example-conf.com/schedule")
|
||||
page.wait_for_selector(".schedule-grid .session")
|
||||
sessions = page.evaluate(GRID)
|
||||
```
|
||||
|
||||
Reading `grid-column-start` from computed style is the trick that makes CSS-grid agendas
|
||||
tractable. The DOM order of sessions in these layouts is frequently meaningless, because
|
||||
the grid places them, so column position is the only reliable link between a session and
|
||||
its track header.
|
||||
|
||||
Where the site uses a data attribute for the track, prefer it and skip the geometry. Check
|
||||
both, because a redesign will switch between them.
|
||||
|
||||
## The timezone belongs to the event, not to you
|
||||
|
||||
Agendas print local times without zones almost universally. Resolve the event's zone once
|
||||
and attach it, not letting each row inherit whatever your machine thinks:
|
||||
|
||||
```python
|
||||
tz = page.eval_on_selector(
|
||||
"meta[name='event-timezone'], .event-timezone",
|
||||
"e => e.content || e.textContent.trim()",
|
||||
) if page.query_selector("meta[name='event-timezone'], .event-timezone") else None
|
||||
row["event_timezone"] = tz # e.g. "Europe/Lisbon"
|
||||
```
|
||||
|
||||
When the page does not say, take it from the venue city and record that you inferred it.
|
||||
An agenda stored in naive local time is usable; one silently converted to your machine's
|
||||
zone is a schedule that is wrong by hours for everyone who reads it later, and there is
|
||||
nothing in the data that reveals the error.
|
||||
|
||||
Hybrid and online events make this worse by publishing two schedules, one in venue time
|
||||
and one in the viewer's, sometimes switched by a toggle. Pin the toggle explicitly and
|
||||
record which one you read.
|
||||
|
||||
## Sessions are stubs; the detail page has the substance
|
||||
|
||||
The grid cell carries a title and a time. Speakers, abstract, room and level live on the
|
||||
session page:
|
||||
|
||||
```python
|
||||
def session_detail(page, href):
|
||||
page.goto(href)
|
||||
page.wait_for_selector(".session-detail")
|
||||
return {
|
||||
"abstract": page.inner_text(".session-abstract"),
|
||||
"room": page.inner_text(".session-room") if page.query_selector(".session-room") else None,
|
||||
"speakers": [{
|
||||
"name": s.query_selector(".speaker-name").inner_text().strip(),
|
||||
"affiliation": (s.query_selector(".speaker-affiliation").inner_text().strip()
|
||||
if s.query_selector(".speaker-affiliation") else None),
|
||||
} for s in page.query_selector_all(".speaker")],
|
||||
}
|
||||
```
|
||||
|
||||
Keep speakers as a list of objects instead of a joined string. A comma-separated field
|
||||
looks fine until a name contains a comma, and academic affiliations contain commas
|
||||
constantly.
|
||||
|
||||
## Multi-day tabs and the day you did not read
|
||||
|
||||
Agendas split by day, behind tabs that swap the grid without changing the URL. The failure
|
||||
is quiet: you scrape one day and get a complete-looking dataset:
|
||||
|
||||
```python
|
||||
for tab in page.query_selector_all(".day-tabs [role='tab']"):
|
||||
day = tab.inner_text().strip()
|
||||
tab.click()
|
||||
page.wait_for_selector(".schedule-grid .session")
|
||||
for s in page.evaluate(GRID):
|
||||
s["day"] = day
|
||||
```
|
||||
|
||||
This is the same mechanic as any
|
||||
[tab or accordion panel](how-to-scrape-accordion-and-tab-content-playwright.md), and the
|
||||
same rule applies: click the control, wait for the content, do not guess a URL.
|
||||
|
||||
## Agendas change until the morning of the event
|
||||
|
||||
Schedules are edited constantly in the final weeks: rooms move, speakers cancel, sessions
|
||||
swap slots. If the change history matters to you, keep each capture whole with its
|
||||
timestamp instead of updating rows in place, and diff captures later. If it does not,
|
||||
a daily pass in the fortnight before the event, and one after it, is enough.
|
||||
|
||||
Either way this is a small site with a spiky audience, so keep to the pacing in
|
||||
[rate limiting your own scraper](how-to-rate-limit-your-scraper-playwright.md) and prefer
|
||||
running outside the conference hours themselves, when the site is serving the people
|
||||
actually at the event.
|
||||
|
||||
## A complete capture, days and sessions
|
||||
|
||||
```python
|
||||
import json, time
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
def capture_agenda(page, url):
|
||||
page.goto(url, wait_until="domcontentloaded")
|
||||
page.wait_for_selector(".schedule-grid .session", timeout=20000)
|
||||
|
||||
tz_node = page.query_selector("meta[name='event-timezone'], .event-timezone")
|
||||
tz = page.evaluate("e => e.content || e.textContent.trim()", tz_node) if tz_node else None
|
||||
|
||||
days, sessions = page.query_selector_all(".day-tabs [role='tab']"), []
|
||||
if not days:
|
||||
for s in page.evaluate(GRID):
|
||||
sessions.append({**s, "day": None})
|
||||
else:
|
||||
for tab in days:
|
||||
label = tab.inner_text().strip()
|
||||
tab.click()
|
||||
page.wait_for_function(
|
||||
"() => document.querySelectorAll('.schedule-grid .session').length > 0")
|
||||
page.wait_for_timeout(400) # let the grid settle after the swap
|
||||
for s in page.evaluate(GRID):
|
||||
sessions.append({**s, "day": label})
|
||||
|
||||
return {"url": url, "event_timezone": tz,
|
||||
"captured_at": time.time(), "sessions": sessions}
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser, open("agenda.jsonl", "a", encoding="utf-8") as out:
|
||||
page = browser.new_page()
|
||||
agenda = capture_agenda(page, "https://example-conf.com/schedule")
|
||||
out.write(json.dumps(agenda, ensure_ascii=False) + "\n")
|
||||
|
||||
for session in agenda["sessions"]:
|
||||
if not session.get("href"):
|
||||
continue
|
||||
detail = session_detail(page, session["href"])
|
||||
out.write(json.dumps({"session_href": session["href"], **detail,
|
||||
"captured_at": time.time()}, ensure_ascii=False) + "\n")
|
||||
out.flush()
|
||||
page.wait_for_timeout(1500)
|
||||
```
|
||||
|
||||
Writing the whole agenda as one record per capture, rather than one row per session, is
|
||||
deliberate. Agendas are edited constantly in the final fortnight, and the interesting
|
||||
analysis is the diff between two captures: which sessions moved, which speakers dropped,
|
||||
which rooms changed. A row-per-session table updated in place erases exactly that.
|
||||
|
||||
## Why conference sites break in the last two weeks
|
||||
|
||||
These are usually built quickly on a platform, deployed once, and then edited under
|
||||
pressure. The failures are not defences.
|
||||
|
||||
**The grid is rebuilt on every tab click.** Elements captured before the click are detached
|
||||
afterwards, so a Python-side loop holding handles across a tab change throws or reads
|
||||
stale nodes. Capturing each day in one evaluation, as above, avoids the whole class.
|
||||
|
||||
**Session pages 404 while the grid still lists them.** A withdrawn talk is removed from the
|
||||
detail route before the schedule is regenerated. Record the failure as a row rather than
|
||||
letting it stop the run, and the disappearance becomes data about the event.
|
||||
|
||||
**The timezone toggle changes the grid under you.** Hybrid events render either venue time
|
||||
or viewer time, and the control sometimes defaults from a stored preference. Read the
|
||||
resolved zone back after setting it rather than assuming, which is the same verify-the-lever
|
||||
discipline that applies to the unit toggles on other targets.
|
||||
|
||||
Where a platform does put the schedule behind protection, which a few of the larger ones
|
||||
do, the page is worth a look before assuming a selector problem, using the order in
|
||||
[scraping without getting blocked](how-to-scrape-without-getting-blocked.md).
|
||||
|
||||
## The shape that answers scheduling questions
|
||||
|
||||
From captures, derive two tables:
|
||||
|
||||
| table | key | holds |
|
||||
|---|---|---|
|
||||
| `session` | `event`, `day`, `track`, `start` | title, room, href, first and last seen |
|
||||
| `speaker` | `session_id`, `name` | affiliation, ordinal |
|
||||
|
||||
Keeping speakers in their own table rather than a joined string is what makes the useful
|
||||
queries possible: who appears most across tracks, which affiliations dominate a programme,
|
||||
whether a speaker is double-booked against themselves. The last one happens more often than
|
||||
organisers would like, and it is only visible when track and time are both kept.
|
||||
|
||||
The clash query is the one that justifies the grid work at the start of this page. Two
|
||||
sessions clash when they share a day and overlap in time on different tracks, and that is a
|
||||
single join once the track is a real column rather than a heading you read past.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Where does the track name live in a grid agenda?** In the column header, once, and
|
||||
not in the cells. Read the header first and map each session to its column, or every
|
||||
session arrives without the one field that makes a grid a schedule.
|
||||
|
||||
**The agenda prints times with no timezone. Which one applies?** The event's,
|
||||
essentially always. Agendas print local times bare, so resolve the event zone once and
|
||||
attach it to every session; your own machine's zone is the wrong answer and the
|
||||
easiest one to record by accident.
|
||||
|
||||
**Why is my capture missing half the sessions?** Because the agenda splits by day
|
||||
behind tabs that swap the grid without changing the URL. The failure is quiet: you get
|
||||
a full, valid, complete-looking grid for one day.
|
||||
|
||||
**How stable is a conference agenda?** Not stable at all in the final weeks. Rooms
|
||||
move, speakers cancel and sessions swap slots up to the morning of the event, which is
|
||||
why a capture is stored as a dated record and not as the truth.
|
||||
|
||||
**See also:** [How to scrape accordion and tab content with
|
||||
Playwright](how-to-scrape-accordion-and-tab-content-playwright.md), [How to rate limit
|
||||
your own Playwright scraper](how-to-rate-limit-your-scraper-playwright.md), [How to
|
||||
scrape without getting blocked](how-to-scrape-without-getting-blocked.md)
|
||||
|
||||
## Sources
|
||||
|
||||
- MDN, the `time` element,
|
||||
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/time - the
|
||||
`datetime` attribute as the machine-readable form of a printed time, checked for
|
||||
where an agenda may carry a zone the visible text omits.
|
||||
- Playwright, Locators, https://playwright.dev/python/docs/api/class-locator - reading
|
||||
a header row once and mapping cells to it, and driving tabs that swap content
|
||||
without a navigation.
|
||||
@@ -0,0 +1,263 @@
|
||||
---
|
||||
title: "How to scrape construction permit records with Playwright"
|
||||
description: "Scrape municipal permit portals with Playwright: drive the postback search forms these systems use, page through result sets that only exist in a session, and keep the permit status history."
|
||||
parent: "Scraping with Playwright"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 159
|
||||
---
|
||||
|
||||
|
||||
# How to scrape construction permit records with Playwright
|
||||
|
||||
To scrape a permit portal, drive its **search form** and stay in the session it gives you.
|
||||
These systems are almost always server-rendered enterprise software, where the results
|
||||
page is a postback instead of a URL, page two is a form submission, and a link copied out
|
||||
of the browser returns a session-expired notice ten minutes later.
|
||||
|
||||
That single property decides the whole design. You cannot build a list of URLs and fetch
|
||||
them in parallel. You drive one session in order, and you make it resumable, because a
|
||||
run over a year of permits takes long enough that something will interrupt it.
|
||||
|
||||
This page covers filling the search the way the form expects, walking result pages that
|
||||
only exist inside a session, and capturing a permit's status history, not its
|
||||
current state.
|
||||
|
||||
## Fill the search in the order the form expects
|
||||
|
||||
Permit searches are usually date-range plus type, and the fields depend on each other:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://permits.example.gov/search")
|
||||
|
||||
page.select_option("select#permitType", "BUILDING")
|
||||
page.fill("input#dateFrom", "01/01/2026")
|
||||
page.fill("input#dateTo", "01/31/2026")
|
||||
page.click("input#btnSearch")
|
||||
page.wait_for_selector("#resultsGrid tr, .no-records")
|
||||
```
|
||||
|
||||
Select the type before the dates where the form reloads on change. Many of these pages
|
||||
issue a postback when a dropdown changes, which clears fields filled before it, so the
|
||||
order that works is the order a person would use: the thing that reshapes the form first,
|
||||
the details after.
|
||||
|
||||
If the date fields are pickers that ignore typed values, treat them as
|
||||
[date-picker calendars](how-to-scrape-date-picker-calendar-playwright.md) and click the
|
||||
days.
|
||||
|
||||
## Page two is a form submission, not a URL
|
||||
|
||||
```python
|
||||
def next_page(page):
|
||||
link = page.query_selector("a#nextPage:not(.disabled)")
|
||||
if not link:
|
||||
return False
|
||||
first_before = page.inner_text("#resultsGrid tr:nth-child(1)")
|
||||
link.click()
|
||||
page.wait_for_function(
|
||||
"prev => document.querySelector('#resultsGrid tr').innerText !== prev",
|
||||
arg=first_before,
|
||||
)
|
||||
return True
|
||||
```
|
||||
|
||||
Waiting for the first row to change is the reliable signal. Waiting for a navigation
|
||||
returns immediately on a page that never navigates, and waiting a fixed time either wastes
|
||||
seconds or reads the previous page. The general shape is the one in
|
||||
[scraping paginated pages](how-to-scrape-paginated-pages-playwright.md), with the extra
|
||||
constraint that here you genuinely cannot skip ahead.
|
||||
|
||||
Narrow the query instead of paging deeply. Most portals cap results, often silently, at a
|
||||
few hundred rows. A month at a time with an explicit row count check is more work and
|
||||
returns the whole set:
|
||||
|
||||
```python
|
||||
total = page.inner_text(".result-count") # "1 to 25 of 412"
|
||||
```
|
||||
|
||||
Compare the total against what you collected and fail loudly on a mismatch. A silent cap
|
||||
is the most common way these datasets end up missing a third of a year.
|
||||
|
||||
## Capture the status history, not just the current status
|
||||
|
||||
A permit moves through review stages, and the interesting questions are about duration:
|
||||
how long between application and issue, where files stall, which reviewers are backed up.
|
||||
The detail page usually carries this as a table:
|
||||
|
||||
```python
|
||||
def permit_detail(page, href):
|
||||
page.click(f"a[href='{href}']")
|
||||
page.wait_for_selector("#permitDetail")
|
||||
stages = []
|
||||
for tr in page.query_selector_all("#statusHistory tbody tr"):
|
||||
cells = [td.inner_text().strip() for td in tr.query_selector_all("td")]
|
||||
stages.append({"stage": cells[0], "date": cells[1], "outcome": cells[2] if len(cells) > 2 else None})
|
||||
return stages
|
||||
```
|
||||
|
||||
If the portal only shows a current status, capture it with your run timestamp and build
|
||||
the history yourself across runs. That is slower to become useful, and it is the only way
|
||||
to get duration data out of a system that does not publish it.
|
||||
|
||||
## Make the run resumable, because it will be interrupted
|
||||
|
||||
A session-bound sequential crawl over months of records is exactly the job that dies at
|
||||
70%. Write each page as you go and record where you were:
|
||||
|
||||
```python
|
||||
checkpoint = {"type": "BUILDING", "from": "01/01/2026", "to": "01/31/2026", "page": 7}
|
||||
```
|
||||
|
||||
Then a restart re-runs the search and pages forward to the checkpoint rather than starting
|
||||
over. The pattern and its edge cases are in
|
||||
[resuming an interrupted scrape](how-to-resume-an-interrupted-scrape-playwright.md), and
|
||||
[retrying failed requests](how-to-retry-failed-requests-playwright.md) covers the
|
||||
transient failures that make it necessary.
|
||||
|
||||
## These are public records, and they contain people
|
||||
|
||||
Permit data is published deliberately, and it is genuinely useful: construction activity,
|
||||
contractor patterns, neighbourhood change. It also contains owner names and addresses,
|
||||
which are personal data in most jurisdictions regardless of being publicly displayed.
|
||||
|
||||
Take the fields your question needs rather than the whole record by default, keep the
|
||||
retention deliberate, and check whether the jurisdiction already publishes a bulk export.
|
||||
Many do, on an open data portal, and pulling a file is better for everyone than paging a
|
||||
search form for a week. The technique for those is in
|
||||
[scraping open data portals](how-to-scrape-open-data-portals-playwright.md).
|
||||
|
||||
## A complete month-by-month sweep
|
||||
|
||||
```python
|
||||
import json, time
|
||||
from datetime import date
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
def months(start_year, start_month, count):
|
||||
y, m = start_year, start_month
|
||||
for _ in range(count):
|
||||
nxt_y, nxt_m = (y, m + 1) if m < 12 else (y + 1, 1)
|
||||
yield date(y, m, 1), date(nxt_y, nxt_m, 1)
|
||||
y, m = nxt_y, nxt_m
|
||||
|
||||
def sweep_month(page, permit_type, first, nxt):
|
||||
page.goto("https://permits.example.gov/search")
|
||||
page.select_option("select#permitType", permit_type)
|
||||
page.fill("input#dateFrom", first.strftime("%m/%d/%Y"))
|
||||
page.fill("input#dateTo", (nxt - timedelta(days=1)).strftime("%m/%d/%Y"))
|
||||
page.click("input#btnSearch")
|
||||
page.wait_for_selector("#resultsGrid tr, .no-records")
|
||||
|
||||
if page.query_selector(".no-records"):
|
||||
return [], 0
|
||||
|
||||
total_text = page.inner_text(".result-count") # "1 to 25 of 412"
|
||||
total = int(total_text.rsplit(" ", 1)[-1].replace(",", ""))
|
||||
rows = []
|
||||
while True:
|
||||
rows.extend(read_grid(page))
|
||||
if not next_page(page):
|
||||
break
|
||||
return rows, total
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser, open("permits.jsonl", "a", encoding="utf-8") as out:
|
||||
page = browser.new_page()
|
||||
for first, nxt in months(2026, 1, 12):
|
||||
rows, total = sweep_month(page, "BUILDING", first, nxt)
|
||||
if total and len(rows) != total:
|
||||
raise SystemExit(f"{first:%Y-%m}: collected {len(rows)} of {total}, refusing to continue")
|
||||
for row in rows:
|
||||
out.write(json.dumps({**row, "month": f"{first:%Y-%m}",
|
||||
"observed_at": time.time()}, ensure_ascii=False) + "\n")
|
||||
out.flush()
|
||||
page.wait_for_timeout(4000)
|
||||
```
|
||||
|
||||
The count assertion is the most valuable line in the sweep. These portals cap silently,
|
||||
and a month that quietly returns 200 of 412 permits produces a dataset that looks complete
|
||||
and is missing half the construction in a city. Failing loudly there costs you a rerun;
|
||||
not checking costs you the conclusion.
|
||||
|
||||
## Government portals fail politely and confusingly
|
||||
|
||||
These systems are not defending against you in the adversarial sense. They are old, they
|
||||
are shared, and they degrade in ways that look like data.
|
||||
|
||||
**The session times out mid-sweep.** After a pause the next postback returns the search
|
||||
form rather than results, which reads as a month with no permits. Detect it by asserting
|
||||
the results grid or the no-records marker exists after every submission, and re-establish
|
||||
the session rather than recording an absence.
|
||||
|
||||
**Business hours matter more than rate limits.** Many of these portals are slow enough
|
||||
during working hours that a page load exceeds a naive timeout, and fine overnight. Running
|
||||
outside the jurisdiction's hours is both faster for you and invisible to the staff who
|
||||
depend on the same server.
|
||||
|
||||
**The grid renders before it fills.** Waiting for `#resultsGrid tr` matches the header row
|
||||
on several platforms. Wait for a row that carries a permit number:
|
||||
|
||||
```python
|
||||
page.wait_for_function(
|
||||
"() => document.querySelectorAll('#resultsGrid tr td:first-child').length > 0"
|
||||
)
|
||||
```
|
||||
|
||||
Where a portal does sit behind commodity edge protection, which a minority do, the browser
|
||||
still needs to look like a browser for the search to run at all, and the debug order is
|
||||
in [scraping without getting blocked](how-to-scrape-without-getting-blocked.md).
|
||||
|
||||
## Two tables, and the durations they unlock
|
||||
|
||||
Keep the permit and its status history separately:
|
||||
|
||||
| table | key | holds |
|
||||
|---|---|---|
|
||||
| `permit` | `jurisdiction`, `permit_number` | type, address, valuation, contractor, applicant |
|
||||
| `stage` | `permit_number`, `sequence` | stage name, date, outcome |
|
||||
|
||||
The second table is where the value is. With stages, you can compute time from application
|
||||
to issue, find which review stage holds files longest, and see whether a backlog is growing
|
||||
or clearing. Those questions are why permit data is scraped at all, and none of them are
|
||||
answerable from a table of current statuses.
|
||||
|
||||
On the personal data, one practical default: keep `contractor` and drop `applicant` unless
|
||||
your question genuinely needs the individual. Contractor activity is commercial and is the
|
||||
subject of most legitimate analysis; applicant names are the part that makes a permit
|
||||
dataset a dataset about people.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Why does my search return nothing when the same query works by hand?** Order. Permit
|
||||
search forms have dependent fields, and a type or status list only populates after the
|
||||
date range or the jurisdiction is set. Filling them out of order leaves a control
|
||||
empty and the search runs against a filter that was never applied.
|
||||
|
||||
**Page two does nothing when I change the URL. Why?** Because paging is a form
|
||||
submission, not a navigation. Click the control and wait for the first row to change;
|
||||
waiting for a navigation returns immediately and you read page one twice.
|
||||
|
||||
**Should I capture the current status or the whole history?** The history. These
|
||||
records exist to answer questions about duration - how long a permit sat in each
|
||||
review stage - and a single current status cannot answer any of them.
|
||||
|
||||
**How do I know the portal is not silently capping my results?** Ask it for the count
|
||||
and compare. These systems cap without saying so, and a month that returns exactly the
|
||||
cap is a month you have not actually read.
|
||||
|
||||
**See also:** [Scrape a multi-step wizard flow with
|
||||
Playwright](how-to-scrape-multi-step-wizard-flow-playwright.md), [How to resume an
|
||||
interrupted scrape with
|
||||
Playwright](how-to-resume-an-interrupted-scrape-playwright.md), [How to retry failed
|
||||
requests when scraping Playwright](how-to-retry-failed-requests-playwright.md)
|
||||
|
||||
## Sources
|
||||
|
||||
- Playwright, Locators, https://playwright.dev/python/docs/api/class-locator - waiting
|
||||
for content to change after a form submission rather than waiting for a navigation,
|
||||
checked for the paging behaviour these portals use.
|
||||
- This project's page on resuming an interrupted scrape, which this page depends on
|
||||
because a months-long sequential crawl is the job that dies partway through.
|
||||
@@ -9,7 +9,7 @@ nav_order: 94
|
||||
|
||||
# How to scrape course catalogs with Playwright
|
||||
|
||||
To scrape a course catalog with Playwright, treat it as a four-level tree rather than a
|
||||
To scrape a course catalog with Playwright, treat it as a four-level tree instead of a
|
||||
list of courses: walk department to course to section to meeting time, pin the term in
|
||||
the query string so every request describes the same academic period, read seat counts
|
||||
from the section endpoint instead of the rendered badge, and emit one row per section so
|
||||
@@ -79,7 +79,7 @@ Put the term in the URL and never rely on the session:
|
||||
page.goto(f"{base}/search?term={term}&subject={dept}", wait_until="domcontentloaded")
|
||||
```
|
||||
|
||||
If the catalog keeps the term in a cookie or a POST body rather than the query string,
|
||||
If the catalog keeps the term in a cookie or a POST body, not the query string,
|
||||
set it once per context and assert it on every response before parsing. The assertion is
|
||||
cheap and the alternative is a silently mixed dataset.
|
||||
|
||||
@@ -92,7 +92,7 @@ The green "Open" pill on the results page is a rendering of a number the page al
|
||||
fetched. It is rounded, it is cached, and on many catalogs it stops updating once the
|
||||
section closes. The underlying call carries the real integers.
|
||||
|
||||
Capture the response rather than the pixel:
|
||||
Capture the response instead of the pixel:
|
||||
|
||||
```python
|
||||
seats = {}
|
||||
@@ -118,18 +118,28 @@ with zero sections and no error.
|
||||
Click each course, wait for its own container rather than a timeout, then read:
|
||||
|
||||
```python
|
||||
for course in page.query_selector_all("[data-course-id]"):
|
||||
cid = course.get_attribute("data-course-id")
|
||||
course.click()
|
||||
page.wait_for_selector(f"[data-sections-for='{cid}'] [data-section-id]")
|
||||
for sec in page.query_selector_all(f"[data-sections-for='{cid}'] [data-section-id]"):
|
||||
rows.append(parse_section(sec, cid))
|
||||
courses = page.locator("[data-course-id]")
|
||||
ids = [courses.nth(i).get_attribute("data-course-id")
|
||||
for i in range(courses.count())] # read ids first, hold no handles
|
||||
|
||||
for cid in ids:
|
||||
page.locator(f"[data-course-id='{cid}']").click() # re-resolved every round
|
||||
sections = page.locator(f"[data-sections-for='{cid}'] [data-section-id]")
|
||||
sections.first.wait_for()
|
||||
for i in range(sections.count()):
|
||||
rows.append(parse_section(sections.nth(i), cid))
|
||||
```
|
||||
|
||||
Waiting for the container keyed to that specific course matters. A generic wait on
|
||||
`[data-section-id]` passes immediately because the previous course's sections are still
|
||||
in the DOM, and you parse the same section twice under two different course codes.
|
||||
|
||||
Holding the element handles from a first pass and clicking them one by one looks
|
||||
equivalent and is not. A catalog that re-renders its course list when a row expands
|
||||
detaches every handle taken before that click, and the loop dies on the second course
|
||||
with a detached-node error. Reading the identifiers first and re-resolving the locator on
|
||||
each round costs one extra query and removes the failure.
|
||||
|
||||
The same trap in its general form is described in
|
||||
[how to scrape a load-more button with Playwright](how-to-scrape-load-more-button-playwright.md).
|
||||
|
||||
@@ -207,28 +217,31 @@ that only the seat counts moved.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
### Should one row be a course or a section?
|
||||
|
||||
A section. A course with two sections has two instructors, two schedules and two seat
|
||||
**Should one row be a course or a section?** A section. A course with two sections has two instructors, two schedules and two seat
|
||||
counts, and a course-level row cannot hold either pair without duplicating the other.
|
||||
|
||||
### Why do the seat numbers differ from the page?
|
||||
|
||||
The badge on the results page is usually a cached rendering that stops updating once a
|
||||
**Why do the seat numbers differ from the page?** The badge on the results page is usually a cached rendering that stops updating once a
|
||||
section closes. The section endpoint carries the current integers, so read the response
|
||||
rather than the element.
|
||||
|
||||
### Why does the filtered result count not match the rows I extract?
|
||||
|
||||
Catalog filters commonly count courses while returning sections. Partition the crawl by
|
||||
**Why does the filtered result count not match the rows I extract?** Catalog filters commonly count courses while returning sections. Partition the crawl by
|
||||
department and term, then filter locally.
|
||||
|
||||
### Is a cross-listed course a duplicate?
|
||||
|
||||
No. It is one section reachable under two course codes. Keep one row per section and
|
||||
**Is a cross-listed course a duplicate?** No. It is one section reachable under two course codes. Keep one row per section and
|
||||
record the additional codes alongside it.
|
||||
|
||||
## Sources
|
||||
|
||||
- Playwright documentation, [Events and response handling](https://playwright.dev/python/docs/events), retrieved 2026-08-28
|
||||
- Playwright documentation, [Auto-waiting](https://playwright.dev/python/docs/actionability), retrieved 2026-08-28
|
||||
|
||||
**See also:** [capturing XHR API responses](how-to-capture-xhr-api-responses-playwright.md)
|
||||
for reading the section endpoint instead of the badge, [scraping a load-more button](how-to-scrape-load-more-button-playwright.md)
|
||||
for the wait that passes on the previous panel, and [resuming an interrupted scrape](how-to-resume-an-interrupted-scrape-playwright.md)
|
||||
for picking a long term back up.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The generic wait on `[data-section-id]` is a mistake that shipped here first: it
|
||||
passes on the previous course's sections and doubles them under a new code.*
|
||||
@@ -0,0 +1,251 @@
|
||||
---
|
||||
title: "How to scrape court docket listings with Playwright"
|
||||
description: "Scrape public court dockets with Playwright: work case by case, not by enumeration, capture the docket entries as an ordered record, and handle the documents that open in a viewer."
|
||||
parent: "Scraping with Playwright"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 160
|
||||
---
|
||||
|
||||
|
||||
# How to scrape court docket listings with Playwright
|
||||
|
||||
To scrape a public docket, work from **case numbers you already have** and capture the
|
||||
docket entries as an ordered list. A docket is a chronological record of filings, and its
|
||||
value is the sequence: what was filed, when, by which party, and what the court did next.
|
||||
The case summary at the top is a rollup of that sequence and loses the timing.
|
||||
|
||||
The other thing to settle before writing code is scope. Court systems publish these
|
||||
records deliberately, and they also rate limit hard, because enumeration is a known abuse
|
||||
pattern. A scraper that walks a case number space is doing the thing the defences exist
|
||||
for, and it will be stopped. One that resolves a list of cases it has a reason to hold
|
||||
behaves like a researcher and generally works.
|
||||
|
||||
This page covers driving the case lookup, reading the docket sheet, and dealing with the
|
||||
documents attached to entries.
|
||||
|
||||
## Look up cases you already identified
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
def open_case(page, case_number):
|
||||
page.goto("https://courts.example.gov/case-search")
|
||||
page.fill("input#caseNumber", case_number)
|
||||
page.click("button#search")
|
||||
page.wait_for_selector("#docketSheet, .case-not-found")
|
||||
return page.query_selector("#docketSheet") is not None
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
for case_number in known_cases:
|
||||
if open_case(page, case_number):
|
||||
rows = docket_entries(page)
|
||||
```
|
||||
|
||||
Keep the not-found branch explicit. Sealed, expunged and simply mistyped cases all render
|
||||
as an absence, and conflating them with an empty docket produces a dataset that quietly
|
||||
asserts cases had no activity.
|
||||
|
||||
## The docket sheet is an ordered record
|
||||
|
||||
```python
|
||||
def docket_entries(page):
|
||||
entries = []
|
||||
for tr in page.query_selector_all("#docketSheet tbody tr"):
|
||||
cells = [td.inner_text().strip() for td in tr.query_selector_all("td")]
|
||||
if len(cells) < 3:
|
||||
continue
|
||||
entries.append({
|
||||
"sequence": cells[0],
|
||||
"filed": cells[1],
|
||||
"text": cells[2],
|
||||
"documents": [a.get_attribute("href")
|
||||
for a in tr.query_selector_all("a[href]")],
|
||||
})
|
||||
return entries
|
||||
```
|
||||
|
||||
Keep the court's sequence number as given, and do not renumber. Courts skip numbers, add
|
||||
entries out of order after the fact, and use suffixes such as `12-1` for related filings.
|
||||
Your own index built by enumeration will silently disagree with every citation anyone
|
||||
writes against that docket.
|
||||
|
||||
Store `text` verbatim. Docket text is terse legal shorthand written by clerks, and any
|
||||
normalisation loses information that a lawyer reading the row will need.
|
||||
|
||||
## Documents open in a viewer, not as a download
|
||||
|
||||
Attachments on these systems usually open a PDF in a viewer tab rather than downloading.
|
||||
That is a specific mechanic worth handling deliberately, and it is the same one described
|
||||
in [when a PDF opens in a new tab](how-to-handle-pdf-opens-new-tab-playwright.md).
|
||||
|
||||
Where documents are behind a paywall or a per-page fee, which is common, stop at the
|
||||
metadata. The entry text plus the document reference is usually enough to answer questions
|
||||
about activity and timing, and it avoids both the cost and the licensing question that
|
||||
comes with mirroring court documents. If you do fetch documents you are entitled to,
|
||||
[downloading linked PDFs](how-to-scrape-linked-pdfs-playwright.md) covers doing it through
|
||||
the browser session rather than a side client.
|
||||
|
||||
## Pace it slowly and deliberately
|
||||
|
||||
Court portals are among the strictest rate limiters in public web infrastructure, and for
|
||||
good reason. A pace of one case every several seconds, with a hard daily cap, is both
|
||||
respectful and the pace that keeps working:
|
||||
|
||||
```python
|
||||
import time
|
||||
for case_number in known_cases[:200]: # a cap, not a full sweep
|
||||
...
|
||||
time.sleep(5)
|
||||
```
|
||||
|
||||
The reasoning behind self-imposed limits, and why they beat waiting to be blocked, is in
|
||||
[rate limiting your own scraper](how-to-rate-limit-your-scraper-playwright.md). Run
|
||||
overnight in the court's timezone where you can: these systems are used by people doing
|
||||
their jobs during the day.
|
||||
|
||||
## The parts to leave alone
|
||||
|
||||
Three things on these systems are worth naming as out of scope, not because they are hard
|
||||
but because taking them is the difference between research and harm.
|
||||
|
||||
**Do not enumerate.** Walking a case number range harvests the cases of people who are not
|
||||
your subject, including sealed matters that leak through misconfiguration.
|
||||
|
||||
**Do not aggregate people.** A docket is public; a compiled profile of every case a named
|
||||
individual appears in is a different artefact with different consequences, and several
|
||||
jurisdictions treat it as such in law.
|
||||
|
||||
**Do not re-publish documents wholesale.** Court records frequently contain personal
|
||||
identifiers that the court expects a human reader to see one at a time.
|
||||
|
||||
Scraping dockets for a defined question, on cases you can name, is the version of this
|
||||
that is both legal in most places and defensible. Store it in something queryable such as
|
||||
[a SQLite database](how-to-scrape-into-a-database-playwright.md), keep the raw entry text,
|
||||
and keep the run's own metadata so you can say later exactly what you asked and when.
|
||||
|
||||
## A complete run over a named case list
|
||||
|
||||
```python
|
||||
import json, time
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
CASES = ["2026-CV-001234", "2026-CV-001987"] # cases you can name and justify
|
||||
PACE_SECONDS, DAILY_CAP = 6, 200
|
||||
|
||||
def already_done(path):
|
||||
seen = set()
|
||||
try:
|
||||
with open(path, encoding="utf-8") as f:
|
||||
for line in f:
|
||||
seen.add(json.loads(line)["case_number"])
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
return seen
|
||||
|
||||
path = "dockets.jsonl"
|
||||
done = already_done(path)
|
||||
budget = DAILY_CAP
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser, open(path, "a", encoding="utf-8") as out:
|
||||
page = browser.new_page()
|
||||
for case_number in CASES:
|
||||
if case_number in done or budget <= 0:
|
||||
continue
|
||||
found = open_case(page, case_number)
|
||||
record = {
|
||||
"case_number": case_number,
|
||||
"observed_at": time.time(),
|
||||
"found": found,
|
||||
"entries": docket_entries(page) if found else [],
|
||||
}
|
||||
if not found:
|
||||
note = page.query_selector(".case-not-found")
|
||||
record["not_found_text"] = note.inner_text().strip() if note else None
|
||||
out.write(json.dumps(record, ensure_ascii=False) + "\n")
|
||||
out.flush()
|
||||
budget -= 1
|
||||
time.sleep(PACE_SECONDS)
|
||||
```
|
||||
|
||||
The daily cap is written into the loop rather than left to discipline. A court portal that
|
||||
decides you are abusive does not send a warning, and the cap is what keeps a long research
|
||||
project from ending on its second day.
|
||||
|
||||
Keeping the `not_found_text` verbatim matters more here than elsewhere: sealed, expunged,
|
||||
transferred and mistyped all produce different wording, and that wording is the only
|
||||
evidence you will have about which one it was.
|
||||
|
||||
## What these systems do when they decide you are a problem
|
||||
|
||||
Court portals sit at the strict end of public infrastructure, and their responses are worth
|
||||
recognising because two of the three look like ordinary results.
|
||||
|
||||
**A silent empty docket.** The case page renders with no entries rather than an error. Since
|
||||
a genuinely new case also has few entries, the difference is invisible unless you compare
|
||||
against a previous read. A case that had thirty entries yesterday and none today is a
|
||||
failed read, not a purged docket:
|
||||
|
||||
```python
|
||||
if previous.get(case_number) and not record["entries"]:
|
||||
record["suspect"] = "entries vanished from a docket that had them"
|
||||
```
|
||||
|
||||
**An interstitial that consumes the click.** Several portals put a terms page in front of
|
||||
the first search per session and again after a period of inactivity. A run that does not
|
||||
re-check for it after a pause submits its search into a page that is not the search page.
|
||||
|
||||
**A hard block on the address.** This is the honest end state of ignoring the pace, and it
|
||||
is usually not reversible by waiting a few minutes. The general diagnosis order is in
|
||||
[scraping without getting blocked](how-to-scrape-without-getting-blocked.md), but the
|
||||
specific advice for court systems is different from most targets: the fix is almost always
|
||||
to slow down and narrow the question, not to look more like a browser.
|
||||
|
||||
## The schema, and the retention decision that comes with it
|
||||
|
||||
| table | key | holds |
|
||||
|---|---|---|
|
||||
| `case` | `court`, `case_number` | caption, type, filed date, current status |
|
||||
| `entry` | `court`, `case_number`, `sequence` | filed date, verbatim text, document references |
|
||||
| `run` | `run_id` | what was asked, when, and under what cap |
|
||||
|
||||
The `run` table is unusual and worth keeping. Docket research is the kind of work where
|
||||
someone may later ask what you collected and why, and a log of the queries you made is a
|
||||
better answer than a reconstruction from the data.
|
||||
|
||||
For retention, the defensible default is to keep the entries you analysed and drop the
|
||||
rest, rather than accumulating dockets because they were cheap to fetch. The value of this
|
||||
data is in answering a specific question about court activity; the risk in it is that a
|
||||
general archive of dockets is a general archive about people, and the second grows quietly
|
||||
out of the first if nobody decides otherwise.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can I search for cases by name?** This page does not, and that is deliberate. It
|
||||
looks up cases already identified by number. Bulk identification of people through a
|
||||
court portal is a different activity with different consequences.
|
||||
|
||||
**Why is the docket numbering full of gaps?** Because courts skip numbers, add entries
|
||||
out of sequence and amend them later. Keep the court's sequence number exactly as
|
||||
given and never renumber: the gaps are part of the record.
|
||||
|
||||
**The document did not download, it opened in a viewer.** That is the normal behaviour
|
||||
on these systems: attachments open a PDF in a viewer tab instead of triggering a
|
||||
download, so the download-handling route does not apply.
|
||||
|
||||
**A case returned nothing. Does that mean it does not exist?** Not necessarily.
|
||||
Sealed, expunged and mistyped cases all render as the same absence, so keep the
|
||||
not-found branch explicit instead of treating it as an empty result.
|
||||
|
||||
**See also:** [How to Handle a PDF That Opens in a New Tab with
|
||||
Playwright](how-to-handle-pdf-opens-new-tab-playwright.md), [Download and read PDFs
|
||||
linked from a page with Playwright](how-to-scrape-linked-pdfs-playwright.md), [How to
|
||||
rate limit your own Playwright scraper](how-to-rate-limit-your-scraper-playwright.md)
|
||||
|
||||
## Sources
|
||||
|
||||
- Playwright, Network, https://playwright.dev/python/docs/network - request
|
||||
interception and response capture, checked for the case where a document opens in a
|
||||
viewer instead of arriving as a download.
|
||||
- This project's pages on PDFs that open in a new tab and on scraping linked PDFs,
|
||||
which carry the mechanics this page points at instead of repeating them.
|
||||
@@ -14,7 +14,7 @@ WebSocket and read each price from the frames it delivers, not from the DOM node
|
||||
live ticker overwrites that node several times a second, so the value you read back is
|
||||
stale the instant you have it. Handle the ranked market-cap table as a separate
|
||||
scroll-and-collect job, and hold the connection open with a stable browser identity so
|
||||
that a dropped-and-reconnected feed reads as one steady client rather than a churn of
|
||||
that a dropped-and-reconnected feed reads as one steady client instead of a churn of
|
||||
new devices.
|
||||
|
||||
Before writing a line of code, though: if the exchange or aggregator you are reading
|
||||
@@ -26,8 +26,8 @@ and you have to get them out of a live browser without capturing garbage.
|
||||
That case is harder than it looks, for a reason specific to prices: they do not sit
|
||||
still. A crypto ticker updates many times a second over a persistent WebSocket, and
|
||||
the number you see in the DOM is the tail end of a stream that has already moved on by
|
||||
the time your `text_content()` call returns. This page is about reading the stream
|
||||
rather than the tail, paging the market table as a separate job, and keeping the
|
||||
the time your `text_content()` call returns. This page is about reading the stream,
|
||||
not the tail, paging the market table as a separate job, and keeping the
|
||||
connection alive long enough to matter.
|
||||
|
||||
## Why the DOM value is a race you lose
|
||||
|
||||
@@ -0,0 +1,306 @@
|
||||
---
|
||||
title: "How to scrape CSS pseudo-element content with Playwright"
|
||||
description: "Read text injected by ::before and ::after with Playwright: it is not in the DOM and inner_text will not return it, so query the computed style instead."
|
||||
parent: "Scraping with Playwright"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 169
|
||||
---
|
||||
|
||||
|
||||
# How to scrape CSS pseudo-element content with Playwright
|
||||
|
||||
Text injected by `::before` and `::after` is **not in the DOM**, so `inner_text` and
|
||||
`text_content` will never return it. Read it with
|
||||
[`getComputedStyle`](https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle)
|
||||
passing the pseudo-element as the second argument, and read the `content` property.
|
||||
|
||||
This catches people because the text is plainly visible on screen. You can select it in
|
||||
some browsers, you can screenshot it, and every DOM-based extraction returns an empty
|
||||
string. Nothing errors, which is the worst version of the problem: the row is written with
|
||||
a blank field and the run reports success.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com/product/1234")
|
||||
|
||||
value = page.eval_on_selector(
|
||||
".badge",
|
||||
"el => getComputedStyle(el, '::after').content",
|
||||
)
|
||||
print(value) # '"In stock"' including the quotes
|
||||
```
|
||||
|
||||
## The value comes back quoted, and sometimes as none
|
||||
|
||||
`content` is a CSS value, not a string, so it arrives with its quotation marks and needs
|
||||
unwrapping. It can also be the keyword `none` when no rule applies, and `normal` on
|
||||
elements where the pseudo-element does not generate a box:
|
||||
|
||||
```python
|
||||
def pseudo_text(page, selector, pseudo="::after"):
|
||||
raw = page.eval_on_selector(
|
||||
selector,
|
||||
"(el, p) => getComputedStyle(el, p).content",
|
||||
pseudo,
|
||||
)
|
||||
if raw in (None, "none", "normal", '""'):
|
||||
return None
|
||||
if len(raw) >= 2 and raw[0] == raw[-1] and raw[0] in "\"'":
|
||||
return raw[1:-1]
|
||||
return raw
|
||||
```
|
||||
|
||||
Returning `None` for `none` matters. An empty string and an absent pseudo-element are
|
||||
different facts, and only the second means the rule did not apply to this element.
|
||||
|
||||
## Four things `content` can hold besides text
|
||||
|
||||
The property is more expressive than a string, and each form needs different handling:
|
||||
|
||||
- **A literal string**, which is the common case above.
|
||||
- **An `attr()` reference**, such as `content: attr(data-label)`. Computed style may
|
||||
return the resolved text or the function itself depending on the engine, so read the
|
||||
attribute directly as a fallback: it is in the DOM and always available.
|
||||
- **A `url()`**, meaning the visible thing is an image, and there is no text to recover.
|
||||
- **A counter**, from `counter()` or `counters()`, which is how numbered lists and section
|
||||
numbers are often rendered. The computed value gives you the rendered number.
|
||||
|
||||
```python
|
||||
raw = pseudo_text(page, ".step")
|
||||
if raw and raw.startswith("attr("):
|
||||
attr = raw[len("attr("):-1].strip()
|
||||
raw = page.get_attribute(".step", attr)
|
||||
```
|
||||
|
||||
## Reading many elements at once
|
||||
|
||||
Doing this per element from Python costs a round trip each time. For a list, collect them
|
||||
in one evaluation:
|
||||
|
||||
```python
|
||||
ALL = """
|
||||
(sel) => Array.from(document.querySelectorAll(sel)).map(el => ({
|
||||
text: el.textContent.trim(),
|
||||
before: getComputedStyle(el, '::before').content,
|
||||
after: getComputedStyle(el, '::after').content,
|
||||
}))
|
||||
"""
|
||||
rows = page.evaluate(ALL, ".product-card .label")
|
||||
```
|
||||
|
||||
One evaluation is also one moment in time, which matters on pages where a class is toggled
|
||||
by script and the pseudo-element content changes with it.
|
||||
|
||||
## Where this actually shows up
|
||||
|
||||
Four patterns account for almost all real cases:
|
||||
|
||||
**Status badges.** "New", "Sold out", "Sale" are frequently pure CSS, driven by a class on
|
||||
the parent. The class itself is often the better field to capture, since it is stable while
|
||||
the rendered word is localised.
|
||||
|
||||
**Currency symbols and units.** A price of `19.99` in the DOM with the currency in a
|
||||
`::before` produces a dataset of bare numbers whose currency you cannot recover later. This
|
||||
is the case where the omission does the most damage, because the number looks complete.
|
||||
|
||||
**Required-field markers and icons.** Usually noise, worth recognising so you do not chase
|
||||
them.
|
||||
|
||||
**Row numbering.** Counters render an index that has no DOM representation at all, which
|
||||
matters when the number is the identifier a user would quote.
|
||||
|
||||
## Check for it deliberately, rather than discovering it
|
||||
|
||||
The reliable way to find out whether a page uses this is to ask, once, before writing
|
||||
selectors:
|
||||
|
||||
```python
|
||||
FIND = """
|
||||
() => {
|
||||
const out = [];
|
||||
document.querySelectorAll('*').forEach(el => {
|
||||
for (const p of ['::before', '::after']) {
|
||||
const c = getComputedStyle(el, p).content;
|
||||
if (c && !['none', 'normal', '""'].includes(c) && !c.startsWith('url('))
|
||||
out.push({ tag: el.tagName, cls: el.className, pseudo: p, content: c });
|
||||
}
|
||||
});
|
||||
return out.slice(0, 50);
|
||||
}
|
||||
"""
|
||||
print(page.evaluate(FIND))
|
||||
```
|
||||
|
||||
Run that on one representative page of a new site. It takes a second and tells you whether
|
||||
any visible text is missing from your extraction, which is a question that is otherwise
|
||||
answered weeks later by someone noticing a column of blanks.
|
||||
|
||||
The same class of invisibility appears in two other places worth knowing:
|
||||
[shadow DOM content](how-to-scrape-shadow-dom-playwright.md), which needs a different
|
||||
traversal, and canvas rendering, where there is no text at all and the approach is in
|
||||
[extracting data from canvas charts](how-to-extract-data-from-canvas-charts-playwright.md).
|
||||
|
||||
## A complete extractor that never loses the invisible half
|
||||
|
||||
```python
|
||||
import json, time
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
CARD = """
|
||||
(sel) => Array.from(document.querySelectorAll(sel)).map(card => {
|
||||
const read = (el) => {
|
||||
if (!el) return null;
|
||||
const before = getComputedStyle(el, '::before').content;
|
||||
const after = getComputedStyle(el, '::after').content;
|
||||
const clean = (c) => (!c || ['none', 'normal', '""'].includes(c) || c.startsWith('url('))
|
||||
? '' : c.replace(/^["']|["']$/g, '');
|
||||
return {
|
||||
dom: el.textContent.trim(),
|
||||
before: clean(before),
|
||||
after: clean(after),
|
||||
classes: el.className,
|
||||
};
|
||||
};
|
||||
return {
|
||||
price: read(card.querySelector('.price')),
|
||||
badge: read(card.querySelector('.badge')),
|
||||
href: card.querySelector('a')?.getAttribute('href') || null,
|
||||
};
|
||||
})
|
||||
"""
|
||||
|
||||
def full_text(part):
|
||||
if not part:
|
||||
return None
|
||||
return (part["before"] + part["dom"] + part["after"]).strip() or None
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser, open("cards.jsonl", "a", encoding="utf-8") as out:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com/category", wait_until="domcontentloaded")
|
||||
page.wait_for_selector(".product-card")
|
||||
|
||||
for card in page.evaluate(CARD, ".product-card"):
|
||||
out.write(json.dumps({
|
||||
"href": card["href"],
|
||||
"price_rendered": full_text(card["price"]), # "€19.99"
|
||||
"price_dom_only": (card["price"] or {}).get("dom"), # "19.99"
|
||||
"badge_rendered": full_text(card["badge"]),
|
||||
"badge_classes": (card["badge"] or {}).get("classes"),
|
||||
"observed_at": time.time(),
|
||||
}, ensure_ascii=False) + "\n")
|
||||
out.flush()
|
||||
```
|
||||
|
||||
Composing `before + dom + after` reproduces what a reader sees, which is the value you
|
||||
usually want. Keeping `price_dom_only` alongside it is the cheap insurance: when the two
|
||||
differ, you know a pseudo-element was carrying something, and when they stop differing after
|
||||
a site update you know the currency symbol moved into the DOM rather than disappearing.
|
||||
|
||||
## The failure mode is silence, not refusal
|
||||
|
||||
Nothing here is a defence, and that is worth stating because it changes how you find it.
|
||||
Pseudo-element content is a styling choice, and no site is hiding a price from you by
|
||||
putting the euro sign in a `::before`. The consequence is that no error, status code or
|
||||
challenge will ever tell you that you missed it.
|
||||
|
||||
That leaves three habits that actually catch it.
|
||||
|
||||
**Probe once per new site**, with the audit snippet above, before writing any selectors.
|
||||
Ten seconds at the start against weeks of a silently wrong column.
|
||||
|
||||
**Compare rendered text against extracted text** on a sample. If the page shows `€19.99`
|
||||
and your row says `19.99`, something is generating the difference, and pseudo-elements are
|
||||
the first suspect:
|
||||
|
||||
```python
|
||||
shown = page.eval_on_selector(".price", "e => e.getBoundingClientRect() && e.innerText")
|
||||
```
|
||||
|
||||
**Prefer the class to the rendered word** for status badges. `badge_classes` survives
|
||||
localisation and copy changes, while the rendered "Sold out" becomes "Ausverkauft" for a
|
||||
German visitor and breaks any filter built on the string.
|
||||
|
||||
If a page genuinely renders text you cannot reach by any of these routes, the remaining
|
||||
possibilities are shadow DOM, canvas, or an image, and each has its own page. What almost
|
||||
never explains it is blocking, which is why this page does not send you to
|
||||
[scraping without getting blocked](how-to-scrape-without-getting-blocked.md) first: that is
|
||||
the right guide when content is absent, not when it is visible and unreadable.
|
||||
|
||||
## The wider family, and a gap nobody has written down
|
||||
|
||||
Pseudo-element content is the easiest member of a family: text that a person can read and
|
||||
an extractor cannot. The harder member is the shadow DOM, and while researching that side
|
||||
we found something worth stating here, because it changes what you should expect from
|
||||
Playwright.
|
||||
|
||||
Two Playwright issues describe what looks like two separate problems:
|
||||
|
||||
- [#23047](https://github.com/microsoft/playwright/issues/23047) asks for locators to be
|
||||
able to enter `mode: "closed"` shadow roots. Open since May 2023, 26 comments.
|
||||
- [#30816](https://github.com/microsoft/playwright/issues/30816) asks for
|
||||
`Page.content()` to serialize shadow DOM at all, open or closed. Closed, 2 comments.
|
||||
|
||||
They are the same underlying gap seen from two directions: the page's content is not fully
|
||||
reachable through the public API surface. **As of this writing, no third issue or pull
|
||||
request in that repository cites both.** The GitHub search
|
||||
`repo:microsoft/playwright 30816 23047` returns exactly two results, which are the two
|
||||
issues themselves, and #23047 never mentions serialization, `outerHTML`, `getHTML` or
|
||||
snapshots anywhere in its 26 comments.
|
||||
|
||||
That matters practically rather than academically. It means the two symptoms get worked
|
||||
around separately, by people who do not know they are chasing one thing, and it explains
|
||||
why the advice you find for one of them never helps with the other. If your extraction is
|
||||
missing text, check both directions before concluding the page is doing something exotic:
|
||||
a pseudo-element, and a shadow root that neither the locator nor `page.content()` will show
|
||||
you. The traversal for the second is in
|
||||
[scraping shadow DOM content](how-to-scrape-shadow-dom-playwright.md).
|
||||
|
||||
## What to store, and why both forms
|
||||
|
||||
| field | example | why keep it |
|
||||
|---|---|---|
|
||||
| `price_rendered` | `€19.99` | what a person sees |
|
||||
| `price_dom_only` | `19.99` | detects the day the markup changes |
|
||||
| `badge_rendered` | `Sold out` | human readable |
|
||||
| `badge_classes` | `badge badge--soldout` | stable across languages and copy |
|
||||
|
||||
Two columns for one visible string looks redundant and costs almost nothing. It converts a
|
||||
class of silent breakage into a visible one: a diff between the two columns is a fact about
|
||||
the site's markup, and a diff that suddenly disappears across a whole crawl is the earliest
|
||||
warning you will get that the page was redesigned under you.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Why does the value come back with quotation marks?** Because `content` is a CSS
|
||||
value and not a string, so it arrives quoted and needs unwrapping. It can also come
|
||||
back as `none`, which means the pseudo-element is not generating anything at all.
|
||||
|
||||
**Can `content` hold something that is not text?** Yes, and each form needs different
|
||||
handling: a counter, an attribute reference, a URL, or a concatenation of several of
|
||||
those. A parser that assumes a plain string quietly mangles all four.
|
||||
|
||||
**Is reading this per element slow?** It costs a round trip each time. For a list,
|
||||
collect the values in a single evaluation in the page and return them together.
|
||||
|
||||
**How do I find out whether a page uses this at all?** Ask once, before writing any
|
||||
selector, instead of discovering it from a column of missing values. Nothing here is a
|
||||
defence, so it fails by silence: the text is simply absent from what an extractor
|
||||
sees.
|
||||
|
||||
**See also:** [How to scrape shadow DOM content with
|
||||
Playwright](how-to-scrape-shadow-dom-playwright.md), [Extract data from canvas charts
|
||||
with Playwright](how-to-extract-data-from-canvas-charts-playwright.md), [How to scrape
|
||||
without getting blocked](how-to-scrape-without-getting-blocked.md)
|
||||
|
||||
## Sources
|
||||
|
||||
- MDN, `Window.getComputedStyle()`,
|
||||
https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle - reading a
|
||||
pseudo-element's computed style through the second argument, which is the mechanism
|
||||
this page rests on.
|
||||
- MDN, the `content` property,
|
||||
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/content - the
|
||||
value types the property accepts, checked for the four forms this page separates.
|
||||
@@ -20,7 +20,7 @@ A date-picker looks like a form field and behaves like an application. The value
|
||||
want is not in the DOM waiting to be read: it is behind a grid that shows one month at
|
||||
a time, hides the target date until you page forward to its month, greys out the days
|
||||
you are not allowed to pick, and commits the choice only when you click a rendered day
|
||||
cell rather than typing into the box.
|
||||
cell instead of typing into the box.
|
||||
|
||||
This page is the mechanics of driving one of those with stock Playwright: how to page
|
||||
between months without losing the grid, how to tell an available cell from a disabled
|
||||
@@ -66,7 +66,7 @@ The calendar shows one month. The date you want is some number of months ahead o
|
||||
is currently displayed, so the first job is to read the visible month, compare it to the
|
||||
target, and click the forward control the right number of times.
|
||||
|
||||
Read the header rather than counting clicks blindly, because the picker may open on the
|
||||
Read the header instead of counting clicks blindly, because the picker may open on the
|
||||
current month or on the last month the user touched, and you cannot assume a starting
|
||||
point.
|
||||
|
||||
@@ -134,7 +134,7 @@ def available_day(page, day):
|
||||
|
||||
If `available_day` returns `None`, that is data, not a failure: for an availability
|
||||
scrape, an unpickable day IS the answer for that date. Record it and move to the next
|
||||
one rather than retrying.
|
||||
one instead of retrying.
|
||||
|
||||
## Click to commit, and re-query after every render
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ nav_order: 52
|
||||
To scrape deals and coupon codes with Playwright, drive a real browser that fires a trusted
|
||||
click on each card's reveal button, then capture the code from wherever the click sends it
|
||||
(a new tab, the clipboard, or an XHR response) and read expiry from the card's data
|
||||
attribute rather than the ticking countdown text. A scripted `dispatchEvent` click is
|
||||
attribute instead of the ticking countdown text. A scripted `dispatchEvent` click is
|
||||
untrusted and a reveal guarded by a bot check returns nothing.
|
||||
|
||||
Deal and coupon pages look like the easiest scrape on the web: a grid of cards, each with
|
||||
@@ -69,7 +69,7 @@ with InvisiblePlaywright(seed=42) as browser:
|
||||
|
||||
`page.click()` here drives Firefox through its native input path, so the reveal receives
|
||||
an event with `isTrusted` set to true and the correct pointer sequence in front of it. The
|
||||
mouse also arcs to the button on a curve rather than teleporting, which is the difference
|
||||
mouse also arcs to the button on a curve instead of teleporting, which is the difference
|
||||
between a reveal that fires and one that silently no-ops. Nothing about the code below is
|
||||
wrapper-specific API: it is ordinary Playwright, which is the point.
|
||||
|
||||
@@ -173,13 +173,13 @@ def read_expiry(card):
|
||||
return None # only fall back to parsing text if no attribute exists
|
||||
```
|
||||
|
||||
Reading the attribute rather than the rendered text gives you the same value on every run
|
||||
Reading the attribute instead of the rendered text gives you the same value on every run
|
||||
of the same seed, which is what makes a scrape you can diff against yesterday's.
|
||||
|
||||
## Page the grid without a mechanical scroll
|
||||
|
||||
Deal grids scroll infinitely: more cards load as you reach the bottom, and there is no page
|
||||
2 to request. Scroll, wait for the card count to actually grow rather than sleeping a fixed
|
||||
2 to request. Scroll, wait for the card count to actually grow instead of sleeping a fixed
|
||||
interval, and stop when it stops growing.
|
||||
|
||||
```python
|
||||
|
||||
@@ -51,7 +51,7 @@ row = {
|
||||
```
|
||||
|
||||
Those first three fields are part of what the row asserts. Without them, two readings
|
||||
taken an hour apart describe two different questions rather than a change in
|
||||
taken an hour apart describe two different questions instead of a change in
|
||||
availability, and the series you build on top of them measures your own inputs.
|
||||
|
||||
## Read the grid response, not the rendered cells
|
||||
@@ -194,9 +194,10 @@ changes rather than by how fast the machine can ask:
|
||||
```python
|
||||
import time
|
||||
|
||||
with sync_playwright() as p:
|
||||
browser = p.firefox.launch()
|
||||
page = browser.new_context().new_page()
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=7) as browser:
|
||||
page = browser.new_page()
|
||||
for postcode in POSTCODES:
|
||||
set_postcode(page, postcode)
|
||||
rows.extend(read_all_weeks(page))
|
||||
|
||||
Loaded 100 of 239 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user