Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
57f50f8b80 | ||
|
|
932d8b33b0 | ||
|
|
65b72741a9 | ||
|
|
835d6d2904 | ||
|
|
35688cab0f | ||
|
|
2073975413 | ||
|
|
d5d92e8689 | ||
|
|
25d7b73659 | ||
|
|
353df4faac | ||
|
|
d599a95a92 | ||
|
|
b16b9c9438 | ||
|
|
5aa8c68b4e | ||
|
|
049476ad43 | ||
|
|
9e650968f6 | ||
|
|
f3814b6bb1 | ||
|
|
0dd6dd2a38 | ||
|
|
429798f70e | ||
|
|
d486660604 | ||
|
|
b9f35c0bcb | ||
|
|
5fef7cc316 | ||
|
|
7278427aa8 | ||
|
|
f777798a7c | ||
|
|
63752e12ec | ||
|
|
88e955afe5 | ||
|
|
bd6a5f7960 | ||
|
|
c651f8e286 | ||
|
|
1d841b295c | ||
|
|
7b912f6729 | ||
|
|
61a15f9d69 | ||
|
|
2770891acd | ||
|
|
707720b691 | ||
|
|
33cebafd84 | ||
|
|
93a2df7612 | ||
|
|
01d692be2a | ||
|
|
8180b624f1 | ||
|
|
22b53847f0 | ||
|
|
5e5d0f516d | ||
|
|
5ed8dd6ba2 | ||
|
|
7ca67819c6 | ||
|
|
28b6a2ccd7 | ||
|
|
5c1e5fdb88 | ||
|
|
98788cbf4a | ||
|
|
46c4e43e54 | ||
|
|
2f5f6c7869 | ||
|
|
d3b514cf4b | ||
|
|
d784dbbfba | ||
|
|
c813380366 | ||
|
|
72fb16d728 | ||
|
|
7361ed08a2 | ||
|
|
c6c45cd8ff | ||
|
|
06096159b0 | ||
|
|
b6c74fca67 | ||
|
|
14050be60b | ||
|
|
a5f3356f94 | ||
|
|
07a931c3e3 | ||
|
|
e3219d9271 | ||
|
|
d55bc06e68 | ||
|
|
062fea1d0a | ||
|
|
0e026eb7f5 | ||
|
|
0fea48789e | ||
|
|
e61a60d9ee | ||
|
|
6d21f5ffe8 | ||
|
|
532dd36a79 | ||
|
|
5499a17fcf | ||
|
|
d1c2a0fc56 | ||
|
|
f2cd7e5424 | ||
|
|
dcf56a9b41 | ||
|
|
62c5649f99 | ||
|
|
489d4f44b3 | ||
|
|
3fcea64f9f | ||
|
|
b70947992f | ||
|
|
c53f15d9ec | ||
|
|
682983f393 | ||
|
|
fa6cd61648 | ||
|
|
48c47a1083 | ||
|
|
115666fb0b | ||
|
|
39a5b4c55d | ||
|
|
f3b300b43a | ||
|
|
bfc8144bf9 | ||
|
|
e2deaa5059 | ||
|
|
713d501b3a | ||
|
|
75f407b124 | ||
|
|
f3e54a6bbe | ||
|
|
5a8ef19726 | ||
|
|
60b3111340 | ||
|
|
3193b819ae | ||
|
|
9d9b584324 | ||
|
|
20210fddec | ||
|
|
b64f800095 | ||
|
|
00441aba97 | ||
|
|
8ad766a1a3 | ||
|
|
097671495e | ||
|
|
b096a9db6b | ||
|
|
b61f82ef52 | ||
|
|
8357ed7077 | ||
|
|
9ed0e035b3 | ||
|
|
9facf961f5 | ||
|
|
6c4d431ce9 | ||
|
|
e4ca2b5027 | ||
|
|
d7bcb56af3 | ||
|
|
0bba55987d | ||
|
|
a8cbe9be6c | ||
|
|
01c2512771 | ||
|
|
eee4bd9fed | ||
|
|
08cc7a90c6 | ||
|
|
c735a975b3 | ||
|
|
060914971d | ||
|
|
d737cf7d68 | ||
|
|
6d6b45c112 | ||
|
|
3bfeb9535f | ||
|
|
9e7be64592 | ||
|
|
0477dcdf3c | ||
|
|
c407928dd2 | ||
|
|
2942dc4ac4 | ||
|
|
ff5afb86ba | ||
|
|
29e3dadb11 | ||
|
|
22f86499a6 | ||
|
|
b6bf924edc | ||
|
|
f505113151 | ||
|
|
b324b27723 | ||
|
|
af895b9b25 | ||
|
|
07c3e85ad9 | ||
|
|
e57be7b945 | ||
|
|
e53308b67d | ||
|
|
50e9d92be7 | ||
|
|
bfe801fede | ||
|
|
476e2f9816 | ||
|
|
e3d7bf87b0 | ||
|
|
ec7ab894f5 | ||
|
|
2d9ae0ea5b | ||
|
|
94faa93cba | ||
|
|
5736c9769b | ||
|
|
f773022a6f | ||
|
|
8c6652bb7a | ||
|
|
0d1236b244 | ||
|
|
e6a2215544 | ||
|
|
f69f26a45e | ||
|
|
ad8827f397 | ||
|
|
82f148c9d3 | ||
|
|
f082f46b0f | ||
|
|
496be20fe9 | ||
|
|
4bd2d02668 | ||
|
|
f27e2fb81b | ||
|
|
951863b94b | ||
|
|
9493764cb3 | ||
|
|
dedc60e411 | ||
|
|
bb6fc67b91 | ||
|
|
9e7b9fc1e2 | ||
|
|
f77e2d5873 | ||
|
|
9fade94c7a | ||
|
|
d0e8e3b64a | ||
|
|
64f00d94ea | ||
|
|
cd904bcdfb | ||
|
|
5ba890bcc6 | ||
|
|
52591e5524 | ||
|
|
9d21ce019b | ||
|
|
f93163d1ef | ||
|
|
4fc723ae36 | ||
|
|
a483b73e3d | ||
|
|
c464c11260 | ||
|
|
895ea47176 | ||
|
|
a33fc26f03 | ||
|
|
6370041c09 | ||
|
|
8497a980c4 | ||
|
|
d33361c862 | ||
|
|
297e10d641 | ||
|
|
b2ffb14564 | ||
|
|
db1422fe41 | ||
|
|
4b44acb49b | ||
|
|
70c8028214 | ||
|
|
e860f8ff8c | ||
|
|
c18d5cf4f1 | ||
|
|
2e9feb1f86 | ||
|
|
23ca48db4c | ||
|
|
4314909230 | ||
|
|
283a959ab0 | ||
|
|
91a16d2fbd | ||
|
|
45c4e44a7b | ||
|
|
3d33d6edaf | ||
|
|
c68c21896a | ||
|
|
80b790995b | ||
|
|
642707c785 | ||
|
|
5e0830f3a3 | ||
|
|
0a21a8857a | ||
|
|
a630a23173 | ||
|
|
3a79606701 | ||
|
|
ed942ac5ef | ||
|
|
f7963bbb5f | ||
|
|
a4dd630790 | ||
|
|
e4bef53d1a | ||
|
|
26acc297a4 | ||
|
|
15d68ffe44 | ||
|
|
4414a4fb48 | ||
|
|
caa263fbf1 | ||
|
|
c341ada26a | ||
|
|
e840df51cc | ||
|
|
5a6cd97c9f | ||
|
|
93a89b1cba | ||
|
|
514445ba03 | ||
|
|
be3c6e90e3 | ||
|
|
195c962dde | ||
|
|
b7bfb36452 | ||
|
|
763d74aba6 | ||
|
|
c1911ac28f | ||
|
|
e490078927 | ||
|
|
5f78593e53 | ||
|
|
42a7af8750 | ||
|
|
42467ddb57 | ||
|
|
e5d7ac01a2 | ||
|
|
0993509fe3 | ||
|
|
d10452a8ad | ||
|
|
725a99f56f | ||
|
|
40ff6526a3 | ||
|
|
1734797148 | ||
|
|
f3102de8fd | ||
|
|
f6450a98cd | ||
|
|
869a987d4a | ||
|
|
591c9eb10c | ||
|
|
2edefa2e24 | ||
|
|
b9b4fbf1d1 | ||
|
|
dacdb8b0c6 | ||
|
|
219f4246a0 | ||
|
|
54c68fa3c4 | ||
|
|
15b1ec3741 | ||
|
|
41dd303f08 | ||
|
|
ebc0325448 | ||
|
|
3d66b6d216 | ||
|
|
5248f32f83 | ||
|
|
79640281c8 | ||
|
|
d78897e63a | ||
|
|
8d4e817f19 | ||
|
|
1c29b311f3 | ||
|
|
ca181c4a18 | ||
|
|
c6b189cfd9 | ||
|
|
e708df2946 | ||
|
|
2ac8524024 | ||
|
|
9a923016d4 | ||
|
|
5a3249cfe2 | ||
|
|
0ef2eed9fe | ||
|
|
7eb68f7e34 | ||
|
|
0749935746 | ||
|
|
afd145385a | ||
|
|
da5af3a289 | ||
|
|
c164a91b4b | ||
|
|
468343cd2b | ||
|
|
58e8321bcb | ||
|
|
623a542951 | ||
|
|
cee33ba695 | ||
|
|
3b49449efa | ||
|
|
da3bf64615 | ||
|
|
1d990408c3 | ||
|
|
a9a13bf5e6 | ||
|
|
6cb631beca | ||
|
|
dcdbf200ff | ||
|
|
4c2d17a475 | ||
|
|
ffbb94adb0 | ||
|
|
8c5ae81873 | ||
|
|
83e43cb7bd | ||
|
|
d0903dec60 | ||
|
|
20e4ca010e |
No files matched your search
@@ -0,0 +1,15 @@
|
||||
# The pre-push hook is a shell script, and git must never hand it to a POSIX
|
||||
# shell with CRLF line endings: `/bin/sh^M: bad interpreter` is how a gate stops
|
||||
# running on a machine where nothing else looks wrong. This repo is developed on
|
||||
# Windows with core.autocrlf=true, so without this line a fresh Windows clone
|
||||
# gets CRLF in the working tree - and Git-for-Windows' sh is the one that runs it.
|
||||
#
|
||||
# The index has always stored LF, so a Linux clone was never affected. That is
|
||||
# exactly why this was worth pinning rather than leaving to a default that
|
||||
# happens to be right today.
|
||||
.githooks/** text eol=lf
|
||||
|
||||
# The publish ledger is compared byte for byte across an autocrlf checkout and a
|
||||
# Linux one. The gate folds CRLF vs LF deliberately, but there is no reason to
|
||||
# make it do that work.
|
||||
PUBLISHED.json text eol=lf
|
||||
@@ -1,163 +1,55 @@
|
||||
#!/bin/sh
|
||||
# Pre-push hook: blocks push if the test suite isn't fully green.
|
||||
# Pre-push gate. THE POLICY IS NOT IN THIS FILE - it is `invisible_core.hooks`,
|
||||
# and this stub exists only to find an interpreter and hand over stdin.
|
||||
#
|
||||
# Enable once with:
|
||||
# It used to be here, in three repositories, as 743 lines of shell that were 207
|
||||
# identical lines out of 211 between two of them. Nine of the eleven differences
|
||||
# were accidental: the core ran no pytest, the core set a variable three times
|
||||
# that only the other two ever read, the core resolved an interpreter and then
|
||||
# called bare `python` anyway. Every fix landed in whichever copy was open.
|
||||
#
|
||||
# What this repository wants gated is declared in its own pyproject, under
|
||||
# [tool.invisible.hooks]. That is the only per-repo part, and it is data.
|
||||
#
|
||||
# Install once with:
|
||||
# git config core.hooksPath .githooks
|
||||
#
|
||||
# Bypass for a known-broken WIP push (NOT for releases):
|
||||
# git push --no-verify
|
||||
# The --no-verify flag is the only escape hatch. Use it sparingly and never
|
||||
# for branches that feed into a release.
|
||||
# A test in this repo fails in an uninstalled checkout, so nobody has to
|
||||
# remember. Bypass a known-broken WIP push with `git push --no-verify`; that is
|
||||
# the only escape hatch, and never for a branch that feeds a release.
|
||||
|
||||
set -e
|
||||
# No `set -e`: exit codes here have to be READ and explained, not turned into a
|
||||
# silent abort. A gate that dies without a message is the worst shape of all.
|
||||
|
||||
echo "[pre-push] running unit + integration tests before push..."
|
||||
# Run from the repository root regardless of where `git push` was invoked.
|
||||
cd "$(dirname "$0")/.." || exit 1
|
||||
|
||||
# Run from this script's directory so it works regardless of where the user
|
||||
# invoked git push from.
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
# Default pyproject addopts skip slow/e2e. That's the gate we want for every
|
||||
# push, fast feedback. e2e is reserved for explicit release runs.
|
||||
if ! python -m pytest -q --tb=short; then
|
||||
echo ""
|
||||
echo "[pre-push] TESTS FAILED - push aborted."
|
||||
echo "[pre-push] Either fix the failure or use 'git push --no-verify' if"
|
||||
echo "[pre-push] you really know what you're doing (NOT for release branches)."
|
||||
python_bin=""
|
||||
for candidate in "$INVISIBLE_GATE_PYTHON" python3 python py; do
|
||||
[ -n "$candidate" ] || continue
|
||||
if command -v "$candidate" >/dev/null 2>&1; then
|
||||
python_bin="$candidate"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -z "$python_bin" ]; then
|
||||
echo "[pre-push] REFUSED - no python on PATH, so no gate can run." >&2
|
||||
echo "[pre-push] Nothing must be pushed past a hook that could not check it." >&2
|
||||
echo "[pre-push] Set INVISIBLE_GATE_PYTHON to an interpreter and push again." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# The invisible-core== specifier in pyproject.toml must name the version the
|
||||
# core checkout actually builds. The core's version is derived from its release
|
||||
# seal, so it moves on its own when a new engine is rolled in; this pin does
|
||||
# not. Checked here because a wrong pin is not visible to the test suite: it
|
||||
# only shows up at install time, on someone else's machine.
|
||||
#
|
||||
# The checker lives in the local workbench, one level above this checkout, and
|
||||
# is not part of this repository. It used to be wrapped in a bare
|
||||
# `if [ -f "$PIN_CHECK" ]`, which skipped with NO output and then fell through
|
||||
# to a line reading "all tests green - push proceeding". Renaming or moving the
|
||||
# workbench, or pushing from a worktree at a different depth, disarmed the gate
|
||||
# and printed something that looks exactly like success. A gate that cannot run
|
||||
# is now a refusal, and the only way past it is to say so out loud.
|
||||
PIN_CHECK="${INVISIBLE_PIN_CHECK:-../../scripts/sync_core_pin.py}"
|
||||
PIN_SKIPPED=""
|
||||
|
||||
if [ "$INVISIBLE_PIN_CHECK" = "skip" ]; then
|
||||
echo ""
|
||||
echo "[pre-push] ###################################################################"
|
||||
echo "[pre-push] # WARNING: INVISIBLE_PIN_CHECK=skip #"
|
||||
echo "[pre-push] # The invisible-core pin was NOT compared against the core. If it #"
|
||||
echo "[pre-push] # is stale, every install of this package resolves a core it was #"
|
||||
echo "[pre-push] # never tested against, and no test downstream can see it. #"
|
||||
echo "[pre-push] ###################################################################"
|
||||
echo ""
|
||||
PIN_SKIPPED=yes
|
||||
elif [ ! -f "$PIN_CHECK" ]; then
|
||||
echo "" >&2
|
||||
echo "[pre-push] REFUSED - the invisible-core pin gate is not reachable." >&2
|
||||
echo "[pre-push] looked for: $PIN_CHECK" >&2
|
||||
echo "[pre-push] from: $(pwd)" >&2
|
||||
echo "[pre-push] The workbench moved, or this is a clone/worktree at another" >&2
|
||||
echo "[pre-push] depth. Point INVISIBLE_PIN_CHECK at sync_core_pin.py, or push" >&2
|
||||
echo "[pre-push] with INVISIBLE_PIN_CHECK=skip to state on the record that the" >&2
|
||||
echo "[pre-push] pin is going out unchecked." >&2
|
||||
exit 1
|
||||
else
|
||||
# The gate's own known-bad cases, before the gate's verdict is trusted. They
|
||||
# live next to it and take about a second. Nothing else in either repo runs
|
||||
# them, so without this they are 18 cases that execute when a human
|
||||
# remembers - which is a runbook note wearing a gate's clothes, the same
|
||||
# shape as the silent skip above.
|
||||
PIN_TESTS="$(dirname "$PIN_CHECK")/test_sync_core_pin.py"
|
||||
if [ ! -f "$PIN_TESTS" ]; then
|
||||
echo "" >&2
|
||||
echo "[pre-push] REFUSED - $PIN_TESTS is missing, so the pin gate is" >&2
|
||||
echo "[pre-push] unverified. A gate that has only ever printed PASS is not a" >&2
|
||||
echo "[pre-push] gate; do not trust this one until its own cases run." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "[pre-push] running the pin gate's own known-bad cases..."
|
||||
if ! PIN_TEST_OUT="$(python "$PIN_TESTS" 2>&1)"; then
|
||||
echo "$PIN_TEST_OUT" >&2
|
||||
echo "" >&2
|
||||
echo "[pre-push] REFUSED - the pin gate's own test suite is RED, so its" >&2
|
||||
echo "[pre-push] verdict on the pin means nothing. Fix $PIN_TESTS first." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "[pre-push] $(echo "$PIN_TEST_OUT" | tail -n 1)"
|
||||
|
||||
echo "[pre-push] checking the invisible-core pin..."
|
||||
if ! python "$PIN_CHECK" --check; then
|
||||
echo ""
|
||||
echo "[pre-push] the invisible-core pin does not match the core - push aborted."
|
||||
echo "[pre-push] Fix it with: python $PIN_CHECK"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# ── forbidden names ────────────────────────────────────────────────────
|
||||
# Naming a protection vendor or a target site in a public repo is a legal and
|
||||
# credibility problem, and no test in this package covers it. It cannot be a
|
||||
# test here either: the scanner needs a word list that deliberately lives
|
||||
# outside every public repo.
|
||||
#
|
||||
# THREE cases, kept apart on purpose. The first cut of this had only two and
|
||||
# refused whenever the script was not at the default path - which meant every
|
||||
# clone of the PUBLIC repo was blocked on every push with no way to comply
|
||||
# except switching the gate off. That is the same "red by default, so people
|
||||
# route around it" failure the guard was moved out of the test suite to avoid.
|
||||
#
|
||||
# configured (INVISIBLE_NAME_CHECK set) but unreachable -> REFUSE. Somebody
|
||||
# meant this to run and it did not.
|
||||
# present at the default path -> RUN, refuse on any
|
||||
# non-zero: the script exits 2 rather than 0 when it could not scan.
|
||||
# neither -> this is not the
|
||||
# workbench; there is no word list here and nothing to enforce. Say so in
|
||||
# one line and carry on. Silence would be the actual failure.
|
||||
NAME_CHECK="${INVISIBLE_NAME_CHECK:-../../scripts/check_forbidden_names.py}"
|
||||
NAME_SKIPPED=""
|
||||
|
||||
if [ "$INVISIBLE_NAME_CHECK" = "skip" ]; then
|
||||
echo ""
|
||||
echo "[pre-push] ###################################################################"
|
||||
echo "[pre-push] # WARNING: INVISIBLE_NAME_CHECK=skip #"
|
||||
echo "[pre-push] # Nothing checked this push for vendor or target-site names. If #"
|
||||
echo "[pre-push] # one is in the diff it is public the moment this lands, and a #"
|
||||
echo "[pre-push] # force-push does not remove it - GitHub keeps the object. #"
|
||||
echo "[pre-push] ###################################################################"
|
||||
echo ""
|
||||
NAME_SKIPPED=yes
|
||||
elif [ -n "$INVISIBLE_NAME_CHECK" ] && [ ! -f "$NAME_CHECK" ]; then
|
||||
echo "" >&2
|
||||
echo "[pre-push] REFUSED - INVISIBLE_NAME_CHECK is set but points at nothing." >&2
|
||||
echo "[pre-push] looked for: $NAME_CHECK" >&2
|
||||
echo "[pre-push] from: $(pwd)" >&2
|
||||
echo "[pre-push] Fix the path, or set INVISIBLE_NAME_CHECK=skip to state on the" >&2
|
||||
echo "[pre-push] record that this push is going out unscanned." >&2
|
||||
exit 1
|
||||
elif [ ! -f "$NAME_CHECK" ]; then
|
||||
echo "[pre-push] no forbidden-name word list here, so nothing scanned this push."
|
||||
echo "[pre-push] (that scan is a maintainer gate; it lives outside this repo.)"
|
||||
NAME_SKIPPED=yes
|
||||
else
|
||||
echo "[pre-push] scanning shipped files for names we do not publish..."
|
||||
if ! python "$NAME_CHECK" .; then
|
||||
echo "" >&2
|
||||
echo "[pre-push] REFUSED - see above. The offending files are named; the" >&2
|
||||
echo "[pre-push] tokens are not, so this log is safe to paste." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# The closing line never claims more than what actually ran.
|
||||
if [ -n "$PIN_SKIPPED" ]; then
|
||||
echo "[pre-push] tests green, PIN GATE SKIPPED - push proceeding (see the warning above)."
|
||||
else
|
||||
if [ -n "$NAME_SKIPPED" ]; then
|
||||
echo "[pre-push] tests green, pin matches, NAME SCAN SKIPPED - push proceeding."
|
||||
else
|
||||
echo "[pre-push] all tests green, pin matches, no forbidden names - push proceeding."
|
||||
fi
|
||||
fi
|
||||
exit 0
|
||||
# `src` first so a checkout gates itself with the policy in the tree being
|
||||
# pushed. os.getcwd() rather than $PWD on purpose: under git-bash on Windows
|
||||
# $PWD is /c/... and Python does not resolve that mount.
|
||||
# exec, so stdin (the refs git is pushing) reaches the policy untouched.
|
||||
exec "$python_bin" -c 'import os, sys
|
||||
sys.path.insert(0, os.path.join(os.getcwd(), "src"))
|
||||
try:
|
||||
from invisible_core.hooks import main
|
||||
except ImportError as exc:
|
||||
sys.exit("[pre-push] REFUSED - cannot import invisible_core.hooks (%s).\n"
|
||||
"[pre-push] The pre-push policy lives in invisible-core. This repo is\n"
|
||||
"[pre-push] either that package (so src/ is not where it should be) or\n"
|
||||
"[pre-push] pins it exactly (so install it). Either way, nothing is\n"
|
||||
"[pre-push] pushed past a hook that could not check it." % exc)
|
||||
sys.exit(main())'
|
||||
@@ -13,7 +13,8 @@
|
||||
# this repo now has to RESOLVE that dependency from the index.
|
||||
#
|
||||
# The publish order is fixed and non-negotiable: invisible-core is uploaded
|
||||
# FIRST, the two consumers after it. So there is a window - from the first push
|
||||
# FIRST, its consumers after it - two until invisible_firefox was deleted on
|
||||
# 2026-08-18, this package since. So there is a window - from the first push
|
||||
# of this repo to GitHub until the core's first upload - in which every install
|
||||
# step here cannot possibly succeed, for a reason nobody can fix from inside
|
||||
# this repository.
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
# e2e-hunt.yml - gira la suite e2e in CICLO finche' non cattura un impiccamento.
|
||||
#
|
||||
# Perche' esiste. Il job e2e si impicca nel 12% delle corse (4 su 33 fra il
|
||||
# 2026-08-01 e il 08-13) e uccide il job al tetto dei 40 minuti. Al 12% una corsa
|
||||
# verde non dimostra niente e servono ~18 giri per avere il 90% di probabilita' di
|
||||
# vederne uno: aspettare che succeda da solo su una PR significa aspettare giorni
|
||||
# e bruciare il tempo di qualcun altro ogni volta.
|
||||
#
|
||||
# E perche' QUI e non in locale, per DUE ragioni diverse a seconda dell'input `os`.
|
||||
#
|
||||
# ubuntu-24.04 - l'impiccamento del job viveva li'. CHIUSO il 2026-08-13 con 36
|
||||
# giri (due cacce da 18): zero impiccamenti, zero ritentativi. Resta come
|
||||
# controllo di non-regressione.
|
||||
#
|
||||
# windows-latest - una domanda diversa e ancora aperta: sulla macchina di
|
||||
# sviluppo i test di interazione producono ritentativi (41 su 17 giri) e su
|
||||
# Linux nemmeno uno in 36. Ma quella macchina non era ferma - chi misurava ci
|
||||
# girava sopra, e piu' tardi ci e' tornato il proprietario - quindi il confronto
|
||||
# e' CONFUSO fra piattaforma e contesa. Un runner Windows dedicato separa le due
|
||||
# cose senza chiedere a nessuno di stare fermo sei ore.
|
||||
#
|
||||
# Non parte da solo: solo `workflow_dispatch`. Non e' un cancello, e' uno
|
||||
# strumento di indagine, e non deve entrare fra i contesti richiesti.
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
name: e2e hunt
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
giri:
|
||||
description: "Quanti giri al massimo (al 12% ne servono ~18 per il 90%)"
|
||||
required: false
|
||||
default: "18"
|
||||
os:
|
||||
description: "Dove cacciare. windows-latest risponde a una domanda DIVERSA: i ritentativi dell'interazione visti sulla macchina di sviluppo sono il prodotto o la contesa?"
|
||||
required: false
|
||||
default: "ubuntu-24.04"
|
||||
type: choice
|
||||
options:
|
||||
- ubuntu-24.04
|
||||
- windows-latest
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
hunt:
|
||||
name: caccia (${{ inputs.os }})
|
||||
runs-on: ${{ inputs.os }}
|
||||
# 18 giri da ~6 minuti piu' l'installazione. Generoso di proposito: il tetto
|
||||
# qui non deve MAI essere la cosa che ferma la caccia, altrimenti torniamo a
|
||||
# un job ucciso che non spiega niente, che e' il difetto di partenza.
|
||||
timeout-minutes: 300
|
||||
# Su Windows GitHub esegue i blocchi `run:` con POWERSHELL, non con bash, e
|
||||
# il primo lancio su windows-latest e' morto in 5 minuti con un ParserError
|
||||
# sulla riga `if [ "$RUNNER_OS" = "Linux" ]`. Il blocco era stato eseguito
|
||||
# prima di spedirlo, come vuole la regola - ma in bash, sulla macchina di chi
|
||||
# scriveva, cioe' con un interprete diverso da quello del bersaglio.
|
||||
# Eseguire il blocco non basta: va eseguito con la SHELL del runner.
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
steps:
|
||||
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
with: { fetch-depth: 1 }
|
||||
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
|
||||
with: { python-version: '3.11' }
|
||||
- name: Install wrapper + test deps (+ pinned Playwright)
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install ".[dev]"
|
||||
python -m pip install "playwright==$(cat scripts/playwright_pin.txt)"
|
||||
# Solo Linux: su Windows il browser si lancia sul desktop del runner, e
|
||||
# `firefox-launch-matrix.yml` dimostra da mesi che li' parte davvero.
|
||||
- name: System deps (xvfb + Firefox runtime libs)
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y xvfb
|
||||
sudo "$(which python)" -m playwright install-deps firefox
|
||||
- name: Fetch the published firefox binary
|
||||
run: echo "FF=$(python -m invisible_playwright fetch | tail -1)" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Ciclo finche' non cattura
|
||||
env:
|
||||
PYTHONUNBUFFERED: "1"
|
||||
INVPW_TEST_WATCHDOG_FILE: prove/e2e-watchdog.log
|
||||
run: |
|
||||
set -u
|
||||
giri="${{ inputs.giri }}"
|
||||
mkdir -p prove/giri
|
||||
# `prove/` dentro lo spazio di lavoro, non RUNNER_TEMP: su Windows quella
|
||||
# variabile contiene backslash e non attraversa bash in modo affidabile.
|
||||
# xvfb solo dove esiste; su Windows il browser va sul desktop del runner.
|
||||
if [ "$RUNNER_OS" = "Linux" ]; then PRE="xvfb-run -a"; else PRE=""; fi
|
||||
catturato=0
|
||||
for n in $(seq 1 "$giri"); do
|
||||
log="prove/giri/giro_$(printf '%02d' "$n").log"
|
||||
t0=$(date +%s)
|
||||
set +e
|
||||
$PRE python -u scripts/run_e2e.py "$FF" > "$log" 2>&1
|
||||
code=$?
|
||||
set -e
|
||||
dur=$(( $(date +%s) - t0 ))
|
||||
# Un impiccamento adesso NON e' piu' un job ucciso: la scadenza per
|
||||
# test lo trasforma in un fallimento, e il banner lo nomina.
|
||||
if grep -aq "Timeout" "$log" && grep -aq "Stack of" "$log"; then
|
||||
echo "::error::giro $n: IMPICCAMENTO CATTURATO dopo ${dur}s"
|
||||
echo "--- l'ultimo test che ha parlato ---"
|
||||
grep -aE "::.*(PASSED|SKIPPED|FAILED)" "$log" | tail -3
|
||||
echo "--- lo stack ---"
|
||||
sed -n '/Timeout/,$p' "$log" | head -60
|
||||
catturato=1
|
||||
break
|
||||
fi
|
||||
echo "giro $n/$giri: exit=$code, ${dur}s"
|
||||
done
|
||||
if [ "$catturato" = "0" ]; then
|
||||
echo "::warning::$giri giri, nessun impiccamento catturato."
|
||||
echo "Se il tasso qui e' lo stesso del 12%, la probabilita' di questo"
|
||||
echo "esito e' $(python -c "print(round(100*0.88**$giri))")%, quindi non e' una prova"
|
||||
echo "che il difetto non ci sia: e' una misura del tasso con questo campione."
|
||||
fi
|
||||
# Il passo fallisce SOLO se ha catturato: cosi' il rosso significa
|
||||
# "trovato", non "rotto", ed e' il rosso che si va a leggere.
|
||||
exit "$catturato"
|
||||
|
||||
- name: Portare fuori tutte le prove
|
||||
if: always()
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
||||
with:
|
||||
name: e2e-hunt-${{ inputs.os }}-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
path: |
|
||||
prove/giri
|
||||
prove/e2e-watchdog.log
|
||||
if-no-files-found: warn
|
||||
retention-days: 14
|
||||
@@ -25,11 +25,28 @@ on:
|
||||
- 'LICENSE'
|
||||
pull_request:
|
||||
branches: [main]
|
||||
# The same filter as `push` above, which had it and this one did not. A
|
||||
# docs-only PR (#54, deleting the Pages site) therefore spun up the full
|
||||
# browser bench, hung, and burned the whole 40-minute timeout on a change no
|
||||
# test can observe. The filter belongs on BOTH triggers or it is not a filter.
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- 'docs/**'
|
||||
- 'LICENSE'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
# One run of this workflow per branch at a time. A newer push cancels the older
|
||||
# in-flight run as a whole, cleanly, instead of leaving its queued jobs to be
|
||||
# cancelled one by one - which left the run marked failed even though nothing
|
||||
# had actually failed. Keyed by workflow + ref so tests and e2e never cancel
|
||||
# each other; only an older run of THIS workflow on the same branch is replaced.
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
# The install below resolves `invisible-core==N.M.0` from the package index,
|
||||
# and the core is published BEFORE this package. This gate answers whether it
|
||||
@@ -63,4 +80,57 @@ jobs:
|
||||
- name: Fetch the published firefox binary
|
||||
run: echo "FF=$(python -m invisible_playwright fetch | tail -1)" >> "$GITHUB_ENV"
|
||||
- name: Run the full e2e suite under a virtual display
|
||||
run: xvfb-run -a python scripts/run_e2e.py "$FF"
|
||||
# PYTHONUNBUFFERED, and it is not a nicety. Without it Python block-buffers
|
||||
# stdout when it is a pipe, and this step printed NOTHING for 39 minutes
|
||||
# before the 40-minute timeout killed it on 2026-08-04: a run with no
|
||||
# verdict and no way to tell where it went. The variable is inherited by
|
||||
# the pytest subprocess run_e2e.py spawns, which is where the output
|
||||
# actually comes from.
|
||||
env:
|
||||
PYTHONUNBUFFERED: "1"
|
||||
# Il cane da guardia di tests/conftest.py: a 150s dentro UN test scrive
|
||||
# QUI lo stack di ogni thread, e lo ripete. Due stack identici dicono
|
||||
# bloccato, due diversi dicono lento - diagnosi opposte che nessun altro
|
||||
# strumento distingue. Su FILE e non su stderr perche' pytest redirige i
|
||||
# descrittori a livello di sistema: cio' che e' catturato si perde
|
||||
# quando il processo viene ucciso, cioe' nel caso per cui esiste.
|
||||
INVPW_TEST_WATCHDOG_FILE: ${{ runner.temp }}/e2e-watchdog.log
|
||||
run: xvfb-run -a python -u scripts/run_e2e.py "$FF"
|
||||
|
||||
# Gira SOLO se il passo sopra fallisce, e prima del 2026-08-13 non poteva
|
||||
# esistere: l'impiccamento veniva ucciso dal tetto dei 40 minuti, quindi il
|
||||
# job risultava `cancelled` e i passi successivi non partivano affatto. Con
|
||||
# `--timeout 420 --timeout-method thread` il processo muore a 7 minuti e il
|
||||
# passo fallisce NORMALMENTE, quindi da qui le prove escono.
|
||||
# Uno strumento che non si vede e' indistinguibile da uno che non c'e'.
|
||||
# L'annuncio che il cane da guardia stampa all'apertura del file finisce
|
||||
# dentro `pytest_runtest_setup`, che pytest CATTURA: nel log del job non
|
||||
# compare, quindi da qui non si poteva distinguere "armato" da "inerte".
|
||||
# Questo passo glielo chiede al file, che e' l'unica prova che esista.
|
||||
- name: Il cane da guardia era armato?
|
||||
if: always()
|
||||
run: |
|
||||
f="${RUNNER_TEMP}/e2e-watchdog.log"
|
||||
if [ -s "$f" ]; then
|
||||
# `|| true` e non e' cosmetico: `grep -c` che conta ZERO esce 1, e
|
||||
# GitHub lancia i blocchi `run:` con `bash -e`. Senza, questo passo
|
||||
# moriva esattamente sulle corse SANE - quelle con zero stack - cioe'
|
||||
# avrebbe fatto fallire ogni e2e verde. Trovato eseguendo il blocco
|
||||
# estratto dallo YAML nei quattro stati, non rileggendolo.
|
||||
sorvegliati=$(grep -ac '^---' "$f" || true)
|
||||
stack=$(grep -ac 'Timeout' "$f" || true)
|
||||
echo "armato: ${sorvegliati} test sorvegliati, ${stack} stack scritti"
|
||||
else
|
||||
echo "::warning::il file del cane da guardia e' assente o vuoto: lo strumento NON era armato, e un impiccamento non lascerebbe niente"
|
||||
fi
|
||||
|
||||
# `always()` e non `failure()`: il file serve anche quando la corsa e'
|
||||
# verde, perche' e' l'unica prova che lo strumento funzioni.
|
||||
- name: Portare fuori le prove dell'impiccamento
|
||||
if: always()
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
||||
with:
|
||||
name: e2e-watchdog-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
path: ${{ runner.temp }}/e2e-watchdog.log
|
||||
if-no-files-found: warn
|
||||
retention-days: 14
|
||||
@@ -22,6 +22,12 @@ on:
|
||||
paths:
|
||||
- '.github/workflows/firefox-launch-matrix.yml'
|
||||
|
||||
# Least privilege: this smoke matrix only checks out the repo and launches
|
||||
# firefox.exe, so it needs nothing but read access to the contents. Without an
|
||||
# explicit block the token would default to the repo's broader permissions.
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
# `pip install .` below resolves `invisible-core==N.M.0` from the package
|
||||
# index, and the core is published BEFORE this package. This gate answers
|
||||
@@ -40,7 +46,10 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [windows-2022, windows-2025, windows-latest]
|
||||
python: ["3.11", "3.12", "3.13"]
|
||||
# This is a "does firefox.exe launch" smoke test across Windows versions;
|
||||
# the Python version does not change the answer, so one is enough. That
|
||||
# takes this all-Windows (2x-cost) matrix from 9 jobs to 3.
|
||||
python: ["3.12"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
# publish-wiki.yml - mirror the docs/ site into the GitHub wiki on every release.
|
||||
#
|
||||
# The wiki is a SEPARATE git repo (<repo>.wiki.git) with no Jekyll front matter
|
||||
# and its own _Sidebar.md navigation, so this is a render, not a copy:
|
||||
# scripts/build_wiki.py strips the front matter, rewrites [x](slug.md) internal
|
||||
# links to the wiki's extensionless form, names each page by its slug (index.md
|
||||
# becomes Home.md), and regenerates _Sidebar.md from the parent/nav_order tree.
|
||||
#
|
||||
# It runs on a published release (the docs the release ships are what the wiki
|
||||
# should show) and on manual dispatch. The wiki checkout is wiped and rebuilt
|
||||
# each run so a page deleted from docs/ also disappears from the wiki; nothing
|
||||
# but generated output is ever committed.
|
||||
#
|
||||
# AUTH. Pushing to <repo>.wiki.git needs contents:write. The built-in
|
||||
# GITHUB_TOKEN carries it here; if a run ever gets a 403 pushing the wiki
|
||||
# (some org policies withhold wiki write from GITHUB_TOKEN), set a PAT with
|
||||
# `repo` scope as the secret WIKI_TOKEN and it is used instead. No long-lived
|
||||
# credential is committed either way.
|
||||
name: publish-wiki
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch: {}
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
concurrency:
|
||||
group: publish-wiki
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
publish-wiki:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the repo (docs + the converter)
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
- name: Render docs/ into a wiki build directory
|
||||
run: python scripts/build_wiki.py docs wiki_build
|
||||
|
||||
- name: Publish to the wiki
|
||||
env:
|
||||
WIKI_PUSH_TOKEN: ${{ secrets.WIKI_TOKEN != '' && secrets.WIKI_TOKEN || github.token }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
repo="${{ github.repository }}"
|
||||
git clone "https://x-access-token:${WIKI_PUSH_TOKEN}@github.com/${repo}.wiki.git" wiki
|
||||
# wipe old generated pages (keep .git) so deletions propagate
|
||||
find wiki -maxdepth 1 -name '*.md' -delete
|
||||
cp wiki_build/*.md wiki/
|
||||
cd wiki
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git add -A
|
||||
if git diff --cached --quiet; then
|
||||
echo "wiki already up to date"
|
||||
else
|
||||
git commit -m "docs: sync wiki from docs/ (${{ github.ref_name }})"
|
||||
git push origin HEAD:master
|
||||
fi
|
||||
@@ -0,0 +1,299 @@
|
||||
name: publish
|
||||
|
||||
# Publishing invisible-playwright from a tag, with no long-lived credential anywhere.
|
||||
#
|
||||
# WHAT REPLACED WHAT. This package was uploaded by hand, from one machine, with a
|
||||
# long-lived PyPI token sitting on it. Two things follow from that and neither is
|
||||
# hypothetical: the token is a standing credential whose blast radius is the whole
|
||||
# project, and a hand-run twine has no gate in front of it - the ordering rules
|
||||
# live in a person's memory.
|
||||
#
|
||||
# The credential here is the `pypi` GitHub Environment's OIDC trust relationship,
|
||||
# minted per run and valid for minutes. Only the `upload` job names that
|
||||
# environment, and `upload` declares `needs: gate`, so a red gate means the only
|
||||
# job that can authenticate never starts. The ordering is a dependency, not a
|
||||
# convention.
|
||||
#
|
||||
# BEFORE THE FIRST RUN, on PyPI: Manage project -> Publishing -> add a GitHub
|
||||
# publisher with owner `feder-cr`, repository `invisible_playwright`, workflow
|
||||
# `publish.yml`, environment `pypi`. Until that exists the upload fails with
|
||||
# `invalid-publisher`, which is the correct failure: nothing has said this
|
||||
# workflow may speak for this project. Revoke the long-lived token AFTER the
|
||||
# first successful OIDC publish, not before.
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
# Asked of the INDEX, first, because a tag can legitimately name a version that
|
||||
# is already published: a tag backfilled for a hand-published release, a tag
|
||||
# re-pushed, a re-run of this workflow. In all of those there is nothing to do
|
||||
# and nothing wrong, and reaching twine would fail on a filename the index has
|
||||
# already served - a red run for a situation that is fine.
|
||||
already-published:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
present: ${{ steps.probe.outputs.present }}
|
||||
version: ${{ steps.probe.outputs.version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- id: probe
|
||||
shell: bash
|
||||
run: |
|
||||
VERSION="$(grep -m1 '^version = ' pyproject.toml | cut -d'"' -f2)"
|
||||
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
||||
CODE=$(curl -s -o /dev/null -w '%{http_code}' "https://pypi.org/pypi/invisible-playwright/$VERSION/json")
|
||||
case "$CODE" in
|
||||
200) echo "present=yes" >> "$GITHUB_OUTPUT"
|
||||
echo "::notice::invisible-playwright $VERSION is already on the index. No-op, not a failure." ;;
|
||||
404) echo "present=no" >> "$GITHUB_OUTPUT" ;;
|
||||
*) echo "the index answered $CODE for $VERSION, which is neither present" >&2
|
||||
echo "nor absent. Refusing rather than guessing." >&2
|
||||
exit 1 ;;
|
||||
esac
|
||||
|
||||
gate:
|
||||
needs: already-published
|
||||
if: needs.already-published.outputs.present != 'yes'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
- name: the tag names the version being built
|
||||
# A tag pointing at a different version publishes something nobody asked
|
||||
# for, under a name that says otherwise. Skipped on workflow_dispatch,
|
||||
# where there is no tag to compare against.
|
||||
if: github.event_name == 'push'
|
||||
shell: bash
|
||||
run: |
|
||||
TAG="${GITHUB_REF_NAME#v}"
|
||||
HAVE="${{ needs.already-published.outputs.version }}"
|
||||
if [ "$TAG" != "$HAVE" ]; then
|
||||
echo "tag v$TAG does not name the version in pyproject.toml ($HAVE)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: the pinned invisible-core is ON THE INDEX
|
||||
# THE ordering rule, as a gate instead of a sentence in a runbook. This
|
||||
# package declares `invisible-core==X.Y.Z`, so pip resolves the PUBLISHED
|
||||
# core - and a consumer released against a core that is not there yet is
|
||||
# red on every runner and broken for every user while passing locally,
|
||||
# because the workbench core is an editable install and cannot see this
|
||||
# class of failure at all. Measured 2026-07-28: both consumers moved to a
|
||||
# name a new core had, neither release could resolve it.
|
||||
shell: bash
|
||||
run: |
|
||||
# BOTH spellings. PEP 503 normalises `invisible_core` and
|
||||
# `invisible-core` to the same project, and the dependency here is
|
||||
# written with the UNDERSCORE while every comment about it uses the
|
||||
# hyphen. Written against the prose first, this grep matched nothing
|
||||
# and the step exited 1 on a correct pyproject - caught by running it
|
||||
# by hand before the first release rather than during one.
|
||||
WANT=$(grep -oE 'invisible[-_]core==[0-9]+\.[0-9]+\.[0-9]+' pyproject.toml | head -1 | cut -d= -f3)
|
||||
if [ -z "$WANT" ]; then
|
||||
echo "no exact invisible-core== pin found in pyproject.toml" >&2
|
||||
echo "(looked for invisible-core== and invisible_core==)" >&2
|
||||
exit 1
|
||||
fi
|
||||
CODE=$(curl -s -o /dev/null -w '%{http_code}' "https://pypi.org/pypi/invisible-core/$WANT/json")
|
||||
if [ "$CODE" != "200" ]; then
|
||||
echo "invisible-core $WANT is not on the index (HTTP $CODE)." >&2
|
||||
echo "Publish the core FIRST, then this package. In this order every" >&2
|
||||
echo "install resolves; in the other one none of them do." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "::notice::invisible-core $WANT is on the index"
|
||||
|
||||
- name: install the package and its dev extras
|
||||
# Its own step, BEFORE the arming below: install_hooks.py imports
|
||||
# invisible_core, and the first version of this file installed inside the
|
||||
# suite step, so the arming ran against a runner that had nothing
|
||||
# installed and died on ModuleNotFoundError. ci.yml has had this order
|
||||
# all along; this workflow had simply never run.
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -e ".[dev]"
|
||||
|
||||
- name: arm the pre-push gates
|
||||
# The suite asserts core.hooksPath is set and a fresh checkout has none.
|
||||
run: python scripts/install_hooks.py
|
||||
|
||||
- name: the suite
|
||||
# A tag push does not trigger the ordinary test workflow, which runs on
|
||||
# branches and pull requests. Without this, tagging is a way to publish
|
||||
# code no job has run.
|
||||
run: python -m pytest -q
|
||||
|
||||
upload:
|
||||
needs: [already-published, gate]
|
||||
if: needs.already-published.outputs.present != 'yes'
|
||||
runs-on: ubuntu-latest
|
||||
environment: pypi # the trust relationship lives HERE, behind the gate
|
||||
permissions:
|
||||
id-token: write # trusted publishing; no token in a secret anywhere
|
||||
contents: write # to commit the ledger entry back
|
||||
pull-requests: write # and to open one when protection declines the push
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- run: python -m pip install --upgrade pip build
|
||||
- run: python -m build
|
||||
- name: twine check
|
||||
run: |
|
||||
pip install twine
|
||||
twine check dist/*
|
||||
- uses: pypa/gh-action-pypi-publish@release/v1
|
||||
- name: record what was published, and commit it back
|
||||
# The action above holds the OIDC credential and does the upload; the
|
||||
# thing that writes PUBLISHED.json is invisible_core.release. So the
|
||||
# first successful run of this workflow published 0.3.1 and recorded
|
||||
# nothing - re-creating, on its first green run, the exact gap that had
|
||||
# been back-filled by hand an hour earlier for 0.6.0 and 0.3.0.
|
||||
#
|
||||
# Recording the TREE is correct here and only here: this job is checked
|
||||
# out at the tag, so the tree is what was built and uploaded. A backfill
|
||||
# of a version published elsewhere must come from the artifacts the index
|
||||
# serves instead, because the tree has moved on.
|
||||
run: |
|
||||
# `-e .` and not `.[dev]`: this is the job holding the OIDC
|
||||
# credential and `contents: write`, and `record` needs the package
|
||||
# importable plus a build backend, nothing else. The dev extra
|
||||
# pulls pytest, ruff and - in the wrapper - the whole of
|
||||
# Playwright into the one job that can push to main.
|
||||
python -m pip install --quiet -e . build hatchling
|
||||
python -m invisible_core.release record
|
||||
if git diff --quiet -- PUBLISHED.json; then
|
||||
echo "::warning::nothing recorded - the ledger did not change"
|
||||
exit 0
|
||||
fi
|
||||
# The direct push CANNOT succeed while the branch requires status
|
||||
# checks: a required check cannot have passed on a commit that does
|
||||
# not exist yet, and since 2026-08-13 `enforce_admins` is TRUE, so
|
||||
# not even a maintainer push has a bypass. Measured 2026-08-05 -
|
||||
# every publish run on all three repos ended in failure with GH006,
|
||||
# on releases that had shipped. So the push is tried, and when
|
||||
# declined the entry goes to a branch and a pull request rather than
|
||||
# nowhere. Green when it is preserved, red only when it is LOST.
|
||||
#
|
||||
# THE FALLBACK HAD NEVER RUN ONCE - repaired 2026-08-14, the same fix
|
||||
# in all three repos. Two defects, and the first hid the second:
|
||||
#
|
||||
# 1. `HEAD:$LEDGER_BRANCH` cannot work from the detached HEAD a tag
|
||||
# build checks out: the destination branch does not exist yet and
|
||||
# the source is a commit object, so git cannot tell a branch from
|
||||
# a tag and refuses with "The destination you provided is not a
|
||||
# full refname". Under `bash -e` that aborts the step, so the
|
||||
# pull request below was never even attempted and neither
|
||||
# `::error::` was ever printed - which is why no `ledger/*`
|
||||
# branch and no pull request has ever existed on any of the three
|
||||
# repos, across four red runs on releases that had shipped.
|
||||
# 2. Creating the pull request also needs "Allow GitHub Actions to
|
||||
# create and approve pull requests" ON THE REPOSITORY, which is
|
||||
# off on all three. The job's own `pull-requests: write` is
|
||||
# necessary and not sufficient. So the pull request is BEST
|
||||
# EFFORT: once the branch push lands the entry is safe, and the
|
||||
# run does not go red over a convenience that a repository
|
||||
# setting can withdraw.
|
||||
VERSION=$(python -c "import json;print(json.load(open('PUBLISHED.json'))['released'][-1]['version'])")
|
||||
git config user.name "feder-cr"
|
||||
git config user.email "85809106+feder-cr@users.noreply.github.com"
|
||||
git add PUBLISHED.json
|
||||
git commit -m "record $VERSION as published"
|
||||
BRANCH="${{ github.event.repository.default_branch }}"
|
||||
if git push origin "HEAD:refs/heads/$BRANCH"; then
|
||||
echo "::notice::ledger entry for $VERSION committed to $BRANCH"
|
||||
exit 0
|
||||
fi
|
||||
echo "the direct push was declined; falling back to a branch and a pull request"
|
||||
LEDGER_BRANCH="ledger/$VERSION"
|
||||
if ! git push -f origin "HEAD:refs/heads/$LEDGER_BRANCH"; then
|
||||
echo "::error::the ledger entry for $VERSION reached NEITHER $BRANCH NOR a branch of its own. It exists only in this run. Back-fill it by hand from the artifacts the index serves, or the next release is refused over a missing entry."
|
||||
exit 1
|
||||
fi
|
||||
echo "::notice::the ledger entry for $VERSION is preserved on branch $LEDGER_BRANCH"
|
||||
CODE=$(curl -s -o /tmp/pr.json -w '%{http_code}' -X POST \
|
||||
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
"https://api.github.com/repos/${{ github.repository }}/pulls" \
|
||||
-d "{\"title\":\"record $VERSION as published\",\"head\":\"$LEDGER_BRANCH\",\"base\":\"$BRANCH\",\"body\":\"The upload succeeded and the ledger could not be pushed to $BRANCH directly: branch protection declines this token, which has no bypass. Merging this keeps the next release from being refused over a missing entry.\"}")
|
||||
if [ "$CODE" = "201" ] || [ "$CODE" = "422" ]; then
|
||||
echo "::error::the ledger for $VERSION is NOT on $BRANCH. Branch $LEDGER_BRANCH carries it and a pull request is open (HTTP $CODE; 422 means one already exists). Merge it before the next release."
|
||||
else
|
||||
echo "::error::the ledger for $VERSION is NOT on $BRANCH. Branch $LEDGER_BRANCH carries it and the pull request could NOT be created (HTTP $CODE - 403 means the repository forbids Actions from creating pull requests). Open and merge it by hand before the next release."
|
||||
fi
|
||||
exit 0
|
||||
- name: create the release page for this tag
|
||||
# Measured 2026-08-11: after pushing three tags, FOUR versions out of four
|
||||
# had no release page, and it was this repo's own gate
|
||||
# (`test_the_published_version_has_a_github_release`, in
|
||||
# `test_release_e2e.py`) that found them AFTER publication. A tag with no
|
||||
# release page is not cosmetic: that gate walks EVERY version on the
|
||||
# index, so one omission refuses a later run for a version nobody is
|
||||
# releasing that day.
|
||||
#
|
||||
# Runs only on the tag path - `workflow_dispatch` has no tag to describe.
|
||||
# Idempotent on purpose: a re-pushed tag, a re-run, or a page created by
|
||||
# hand must all be a no-op rather than a failure, which is the same rule
|
||||
# `already-published` follows one job up.
|
||||
#
|
||||
# The body comes from CHANGELOG.md when the repo keeps one (only this one
|
||||
# does) and is generated otherwise. One step, both cases, so the three
|
||||
# repos carry the same text instead of three variants that drift.
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
TAG="${GITHUB_REF#refs/tags/}"
|
||||
VERSION="${TAG#v}"
|
||||
if gh release view "$TAG" > /dev/null 2>&1; then
|
||||
echo "::notice::the release page for $TAG already exists - nothing to do"
|
||||
exit 0
|
||||
fi
|
||||
if [ -f CHANGELOG.md ]; then
|
||||
awk -v v="$VERSION" '
|
||||
$0 ~ ("^## \\[" v "\\]") { p = 1; next }
|
||||
p && /^## \[/ { exit }
|
||||
p { print }
|
||||
' CHANGELOG.md > /tmp/notes.md
|
||||
else
|
||||
: > /tmp/notes.md
|
||||
fi
|
||||
# A body that is only whitespace reads as a page nobody wrote. Say what
|
||||
# is true instead: the version, and where the artifacts actually are.
|
||||
#
|
||||
# The PyPI name is the repository name with hyphens: the repo is
|
||||
# `invisible_playwright` and the project is `invisible-playwright`.
|
||||
# PyPI redirects the underscore form, so getting this wrong would have
|
||||
# produced a link that works and is still wrong to read. And no
|
||||
# backticks in the body - they would be command substitution inside a
|
||||
# double-quoted shell string, which is how fourteen quoted terms once
|
||||
# became empty strings.
|
||||
PKG=$(printf '%s' "${{ github.event.repository.name }}" | tr '_' '-')
|
||||
if [ -z "$(tr -d '[:space:]' < /tmp/notes.md)" ]; then
|
||||
printf '%s\n' \
|
||||
"$PKG $VERSION is on PyPI." \
|
||||
"" \
|
||||
"Artifacts and checksums: https://pypi.org/project/$PKG/$VERSION/" \
|
||||
> /tmp/notes.md
|
||||
fi
|
||||
if gh release create "$TAG" --title "$TAG" --notes-file /tmp/notes.md; then
|
||||
echo "::notice::release page created for $TAG"
|
||||
exit 0
|
||||
fi
|
||||
echo "::error::the release page for $TAG could not be created. The package IS published; create the page by hand or a later run of the release gate will refuse over it."
|
||||
exit 1
|
||||
@@ -10,6 +10,15 @@ on:
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
# One run of this workflow per branch at a time. A newer push cancels the older
|
||||
# in-flight run as a whole, cleanly, instead of leaving its queued jobs to be
|
||||
# cancelled one by one - which left the run marked failed even though nothing
|
||||
# had actually failed. Keyed by workflow + ref so tests and e2e never cancel
|
||||
# each other; only an older run of THIS workflow on the same branch is replaced.
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
# `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
|
||||
@@ -32,7 +41,19 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
python: ["3.11", "3.12"]
|
||||
# Every version `requires-python = ">=3.11"` promises. Two of them were
|
||||
# untested until 2026-08-01, and the user who opened issue #51 was on
|
||||
# 3.14. test_marker_vocabulary.py compares this list to the floor.
|
||||
python: ["3.11", "3.12", "3.13", "3.14"]
|
||||
# Windows runners are the scarce, 2x-cost, slow-to-schedule ones, and a
|
||||
# burst of pushes queues them for a long time. Run the FULL Python range
|
||||
# on ubuntu (cheap, fast) and cover Windows on 3.12 only - this is a
|
||||
# pure-Python package, the OS-specific surface is tiny. The python LIST
|
||||
# above stays complete so test_marker_vocabulary still sees every version.
|
||||
exclude:
|
||||
- { os: windows-latest, python: "3.11" }
|
||||
- { os: windows-latest, python: "3.13" }
|
||||
- { os: windows-latest, python: "3.14" }
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -48,5 +69,100 @@ jobs:
|
||||
python -m pip install --upgrade pip
|
||||
pip install -e ".[dev]"
|
||||
|
||||
- name: arm the pre-push gates
|
||||
# A fresh clone has no core.hooksPath, and the suite says so - the
|
||||
# reminder moved into `invisible_core.testing` on 2026-07-28 and all
|
||||
# three repos that existed then made the assertion (two now, since
|
||||
# invisible_firefox was deleted on 2026-08-18), but only the core's CI
|
||||
# had this step, so both consumers went red on it. Do here what a
|
||||
# developer does once. It also means install_hooks.py is exercised on
|
||||
# every runner instead of only on the one machine that ever ran it by
|
||||
# hand.
|
||||
run: python scripts/install_hooks.py
|
||||
|
||||
- name: undefined names and duplicate definitions
|
||||
# F821 (undefined name) and F811 (redefinition) only. Not a style pass:
|
||||
# these two are the rules that catch a name that cannot resolve, which
|
||||
# `from __future__ import annotations` hides in an annotation and which
|
||||
# a suite only finds if it happens to execute that line. Both bit on
|
||||
# 2026-07-28 - a `throwaway_venv` used and imported nowhere took a
|
||||
# user-install job red at RUNTIME, and six annotations named a type that
|
||||
# was defined in no module at all.
|
||||
#
|
||||
# Zero violations in all three repos when this was added, so it is a
|
||||
# gate rather than a cleanup backlog. Keep it that way.
|
||||
run: |
|
||||
python -m ruff check --select F821,F811,F601 --no-cache --output-format concise .
|
||||
|
||||
- name: Run pytest
|
||||
run: pytest tests/ -v --tb=short
|
||||
shell: bash
|
||||
run: |
|
||||
set -o pipefail # or tee would swallow pytest's exit code
|
||||
pytest tests/ -v --tb=short -rs | tee tests-report.txt
|
||||
|
||||
# This repo has the largest suite of the three and was the only one with
|
||||
# no floor. pytest's exit code cannot distinguish "everything passed"
|
||||
# from "the marker expression deselected everything", and `addopts`
|
||||
# already filters on two markers - one more, or a typo in one, silently
|
||||
# turns 726 tests into 0 and reports success.
|
||||
- name: Refuse a run in which the suite deselected itself
|
||||
shell: bash
|
||||
run: |
|
||||
python - <<'PY'
|
||||
import pathlib, re, sys
|
||||
text = pathlib.Path("tests-report.txt").read_text(encoding="utf-8", errors="ignore")
|
||||
m = re.search(r"(\d+) passed", text)
|
||||
passed = int(m.group(1)) if m else 0
|
||||
# FLOOR, not a target. It exists because a mis-wired selection runs
|
||||
# almost nothing and still exits 0 - the exit code cannot see it.
|
||||
#
|
||||
# Was 600 until 2026-07-27, when 322 tests MOVED to invisible_core:
|
||||
# they covered core modules and reached them through this package's
|
||||
# four-line back-compat shims, so six real breaks in core code were
|
||||
# surviving the core's own suite. Nothing shrank; the tests are in the
|
||||
# package they test. This suite runs ~420 now.
|
||||
#
|
||||
# Keep it a little under the real count. It is a tripwire for "the
|
||||
# selection collapsed", not an assertion about how many tests exist.
|
||||
if passed < 380:
|
||||
print(f"only {passed} test(s) ran (expected 380+) - the selection "
|
||||
f"dropped most of the suite and the exit code cannot see it",
|
||||
file=sys.stderr)
|
||||
sys.exit(1)
|
||||
print(f"{passed} tests ran")
|
||||
PY
|
||||
|
||||
# UN SOLO CONTESTO PER LA BRANCH PROTECTION. Misurato 2026-08-13: la
|
||||
# protezione di questo repo richiedeva `pytest (windows-latest, py3.11)`,
|
||||
# che la matrice ESCLUDE esplicitamente qualche riga piu' su - un contesto
|
||||
# che nessun job puo' produrre, quindi una protezione che non poteva mai
|
||||
# essere soddisfatta. Con `enforce_admins` a false ogni push passava lo
|
||||
# stesso e nessuno se ne accorgeva. Stessa forma nel core e nel manager.
|
||||
#
|
||||
# Un elenco di nomi di matrice va alla deriva ogni volta che la matrice
|
||||
# cambia, ed e' esattamente cosi' che ci si e' arrivati. Questo job dipende
|
||||
# dalla matrice intera e il suo nome non cambia mai.
|
||||
#
|
||||
# SKIPPED NON E' FAILED, ed e' la parte specifica di questo repo. `unit` e'
|
||||
# saltato di proposito quando `core-on-index` dice che il pin non e' ancora
|
||||
# sull'indice: durante quella finestra nessun install puo' riuscire, e il
|
||||
# workflow ha scelto di SALTARE invece di fingere verde. Un gate che
|
||||
# pretendesse `success` trasformerebbe quella scelta in un rosso e
|
||||
# spingerebbe a togliere la protezione proprio nel giorno del rilascio.
|
||||
# Quindi si rifiuta su `failure` e `cancelled`, non su `skipped`.
|
||||
gate:
|
||||
needs: [core-on-index, unit]
|
||||
if: always()
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: refuse unless nothing failed
|
||||
run: |
|
||||
echo "core-on-index: ${{ needs.core-on-index.result }}"
|
||||
echo "unit: ${{ needs.unit.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
|
||||
echo "ok"
|
||||
@@ -0,0 +1,183 @@
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
# user-install.yml - can a person who has never seen this repo install it and
|
||||
# drive a browser, on the two operating systems we claim to support?
|
||||
#
|
||||
# WHY THIS EXISTS, SEPARATELY FROM e2e.yml.
|
||||
# e2e.yml installs the wrapper FROM THE CHECKOUT and then pins Playwright by
|
||||
# hand. That is the right shape for testing a change: it exercises the code in
|
||||
# the PR. It is the wrong shape for answering "does the published thing work",
|
||||
# and the difference is not academic:
|
||||
#
|
||||
# * a checkout install never resolves `invisible-core==X.Y.Z` from the index,
|
||||
# so the entire pin mechanism - the part most likely to break a release,
|
||||
# and the reason a binary bump is now a three-package release - is outside
|
||||
# what that job can see;
|
||||
# * installing a blessed `playwright==<pin>` afterwards REPAIRS the venv. If
|
||||
# the declared range resolves to a client the shipped Juggler cannot speak,
|
||||
# that manual line turns the job green while every fresh install is broken.
|
||||
# What a user gets is what pip resolves from the declaration, and that is
|
||||
# what has to be under test.
|
||||
#
|
||||
# So this workflow installs nothing from the checkout except the test files. It
|
||||
# takes `pip install invisible-playwright` from the index, in an empty venv, and
|
||||
# runs it the way somebody's first script would.
|
||||
#
|
||||
# WHY IT MUST NOT BE MADE TOLERANT.
|
||||
# There is a real window in which this cannot pass: between publishing the core
|
||||
# and publishing the consumers. The tempting fixes - `|| true`, `--no-deps`, a
|
||||
# git fallback - all produce a GREEN job that installed nothing, and that lie
|
||||
# outlives the window by months. A red run during a publish is correct and
|
||||
# readable. See core-on-index.yml, which makes the same argument at length.
|
||||
#
|
||||
# WHY BOTH OPERATING SYSTEMS.
|
||||
# Windows is the primary target, and the two most recent defects were
|
||||
# Windows-only by construction: firefox.exe is a launcher stub that spawns the
|
||||
# real browser and exits, so a killed runner used to leave the tree behind, and
|
||||
# the job-object fix for it has no counterpart on Linux. A Linux-only matrix
|
||||
# would have seen neither.
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
name: user-install
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
source:
|
||||
description: "index (what users get) or git (an unpublished commit)"
|
||||
required: false
|
||||
default: index
|
||||
type: choice
|
||||
options: [index, git]
|
||||
schedule:
|
||||
# Weekly (Monday). The published artifacts do not change on their own, but
|
||||
# everything around them does: pip resolves a new Playwright, GitHub moves a
|
||||
# release asset, an index mirror lags. Those break users without any commit
|
||||
# here, so a run triggered only by pushes would never see them. Weekly is
|
||||
# enough to catch that drift without adding a Windows job to the queue daily.
|
||||
- cron: "17 6 * * 1"
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: user-install-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
install:
|
||||
name: ${{ matrix.os }} - install from ${{ github.event.inputs.source || 'index' }} and launch
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 45
|
||||
strategy:
|
||||
fail-fast: false # one OS failing must not hide the other's result
|
||||
matrix:
|
||||
os: [ubuntu-24.04, windows-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with: { python-version: '3.11' }
|
||||
|
||||
# Only what the TEST needs. The package under test is installed by the
|
||||
# test itself, into a venv it creates, from the index - installing it
|
||||
# here as well would put a second copy on the path and the assertions
|
||||
# would be reading the wrong one.
|
||||
- name: Test harness only
|
||||
run: python -m pip install --upgrade pip pytest packaging
|
||||
|
||||
# PyPI does not serve a new version to pip the instant twine finishes, and
|
||||
# this workflow runs on `release:` - which fires seconds after the upload.
|
||||
# MEASURED 2026-07-28: invisible-firefox 0.2.6 was uploaded, the release was
|
||||
# created about forty seconds later, and the pip install below still resolved
|
||||
# 0.2.5. The job reported a forgotten publish that had happened two minutes
|
||||
# earlier, which is the most expensive kind of red: it looks exactly like the
|
||||
# real defect this workflow exists to catch.
|
||||
#
|
||||
# Bounded at five minutes, so a genuinely forgotten publish still fails. The
|
||||
# PER-VERSION endpoint is the authority; the aggregate `info.version` lags it
|
||||
# by minutes and has its own trap, so this asks for the exact URL.
|
||||
#
|
||||
# Only on `release:`. A scheduled or dispatched run is not racing anything,
|
||||
# and a wait there would hide a real absence behind five minutes of polling.
|
||||
- name: wait for the index to serve this version
|
||||
if: github.event_name == 'release'
|
||||
shell: bash
|
||||
run: |
|
||||
python - <<'PY'
|
||||
import json, os, sys, time, tomllib, urllib.error, urllib.request
|
||||
dist = tomllib.load(open("pyproject.toml", "rb"))["project"]["name"]
|
||||
version = tomllib.load(open("pyproject.toml", "rb"))["project"]["version"]
|
||||
url = f"https://pypi.org/pypi/{dist}/{version}/json"
|
||||
deadline = time.monotonic() + 300
|
||||
n = 0
|
||||
while True:
|
||||
n += 1
|
||||
try:
|
||||
with urllib.request.urlopen(url, timeout=30) as r:
|
||||
if json.load(r).get("urls"):
|
||||
print(f"::notice::{dist} {version} is on the index (attempt {n})")
|
||||
sys.exit(0)
|
||||
except urllib.error.HTTPError as e:
|
||||
if e.code != 404:
|
||||
print(f"::warning::index returned HTTP {e.code}; not waiting further")
|
||||
sys.exit(0)
|
||||
except OSError as e:
|
||||
print(f"index unreachable ({e}); retrying")
|
||||
if time.monotonic() >= deadline:
|
||||
print(f"::warning::{dist} {version} still not on the index after 300s; "
|
||||
f"running the checks anyway so a real absence is reported")
|
||||
sys.exit(0)
|
||||
time.sleep(10)
|
||||
PY
|
||||
|
||||
- name: Linux runtime libraries for the browser
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y xvfb libgtk-3-0 libdbus-glib-1-2 libasound2t64
|
||||
|
||||
- name: The user path, end to end
|
||||
env:
|
||||
# The release walk asks the GitHub API once per published version.
|
||||
# Unauthenticated that is 60 calls an hour PER RUNNER IP, and the
|
||||
# walk hit 403 on its eleventh call when measured by hand. A
|
||||
# rate-limited walk SKIPS, and a skip is not a check.
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
INVPW_E2E_SOURCE: ${{ github.event.inputs.source || 'index' }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -o pipefail # or the tee below would swallow pytest's exit code
|
||||
if [ "${{ runner.os }}" = "Linux" ]; then
|
||||
xvfb-run -a python -m pytest tests/test_release_e2e.py tests/test_upgrade_e2e.py -m e2e \
|
||||
-o addopts="" -v -rs | tee e2e-report.txt
|
||||
else
|
||||
python -m pytest tests/test_release_e2e.py tests/test_upgrade_e2e.py -m e2e \
|
||||
-o addopts="" -v -rs | tee e2e-report.txt
|
||||
fi
|
||||
|
||||
# A run whose tests all SKIPPED is not a pass, and it is the failure this
|
||||
# suite is most exposed to: every test here is gated on `-m e2e` and
|
||||
# several on a platform. `-rs` above prints the skips; this turns "nothing
|
||||
# ran" into a refusal rather than a green tick.
|
||||
- name: Refuse a run in which nothing actually ran
|
||||
shell: bash
|
||||
run: |
|
||||
python - <<'PY'
|
||||
import pathlib, re, sys
|
||||
# pytest's own exit code cannot distinguish "all passed" from "all
|
||||
# skipped", so the count is read back from the report it wrote.
|
||||
report = pathlib.Path("e2e-report.txt")
|
||||
if not report.is_file():
|
||||
print("no report written; the step above did not run", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
text = report.read_text(encoding="utf-8", errors="ignore")
|
||||
m = re.search(r"(\d+) passed", text)
|
||||
passed = int(m.group(1)) if m else 0
|
||||
if passed < 6:
|
||||
print(f"only {passed} test(s) actually ran (expected at least 6) - a suite that skipped "
|
||||
f"itself is not a pass", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
print(f"{passed} tests ran")
|
||||
PY
|
||||
@@ -53,9 +53,50 @@ jobs:
|
||||
run: python -m invisible_playwright fetch
|
||||
|
||||
- name: Resolve binary path
|
||||
run: echo "STEALTHFOX_E2E_BINARY=$(python -m invisible_playwright path)" >> "$GITHUB_ENV"
|
||||
shell: bash
|
||||
run: |
|
||||
# NOT `echo "VAR=$(cmd)" >> $GITHUB_ENV`. echo exits 0 whatever the
|
||||
# substitution did, so `set -e` never sees a failure and an EMPTY
|
||||
# value lands in the environment. Both tests below then hit
|
||||
# `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)"
|
||||
if [ -z "$BIN" ] || [ ! -e "$BIN" ]; then
|
||||
echo "invisible_playwright path returned '$BIN', which is not a" >&2
|
||||
echo "file. Refusing to run a suite that would skip itself green." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "STEALTHFOX_E2E_BINARY=$BIN" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Run WebRTC realness e2e (xvfb for the headless Firefox)
|
||||
run: |
|
||||
set -o pipefail
|
||||
sudo apt-get update && sudo apt-get install -y xvfb
|
||||
xvfb-run -a pytest tests/test_webrtc_realness.py -m e2e -o addopts="" -v -rs
|
||||
xvfb-run -a pytest tests/test_webrtc_realness.py -m e2e -o addopts="" -v -rs | tee webrtc-report.txt
|
||||
|
||||
# Run #1 was GREEN with the headline assertion skipped: "1 passed, 1
|
||||
# skipped", and the skipped one is the test this workflow's own header
|
||||
# calls the point of the gate. pytest's exit code cannot tell that from a
|
||||
# pass, and this file was the only one of four without a floor.
|
||||
- name: Refuse a run whose main assertion did not execute
|
||||
shell: bash
|
||||
run: |
|
||||
python - <<'PY'
|
||||
import pathlib, re, sys
|
||||
text = pathlib.Path("webrtc-report.txt").read_text(encoding="utf-8", errors="ignore")
|
||||
passed = int((re.search(r"(\d+) passed", text) or [0, 0])[1] or 0)
|
||||
skipped = int((re.search(r"(\d+) skipped", text) or [0, 0])[1] or 0)
|
||||
if skipped:
|
||||
print("these tests SKIPPED, so the gate verified less than it "
|
||||
"claims:", file=sys.stderr)
|
||||
for line in text.splitlines():
|
||||
if line.startswith("SKIPPED"):
|
||||
print(" " + line, file=sys.stderr)
|
||||
if passed < 2 or skipped:
|
||||
print(f"{passed} passed / {skipped} skipped - this gate exists for "
|
||||
f"the synthetic-srflx assertion; a run that skips it is not "
|
||||
f"a pass.", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
print(f"{passed} tests ran, none skipped")
|
||||
PY
|
||||
@@ -4,33 +4,225 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.7.2] - 2026-08-18
|
||||
|
||||
### Fixed
|
||||
|
||||
- Pins `invisible-core` 20.15.0, which carries a fix for a defect that lived in
|
||||
17 published core versions. An `http://` or `https://` proxy handed to
|
||||
`build_launch_plan` produced NO proxy preference at all: `configure_proxy`
|
||||
returns a non-SOCKS endpoint to its caller, because only Playwright can answer
|
||||
a proxy's 407, and that path launches the binary with `subprocess` and had
|
||||
nowhere to put it. The browser then went out on the machine's own address
|
||||
while the geo layer had already resolved timezone, locale and egress THROUGH
|
||||
the proxy, so the session announced one country and connected from another.
|
||||
|
||||
**This wrapper was never affected and needs no change on your side.** It hands
|
||||
the endpoint to Playwright, and that was measured: the same exit IP as curl
|
||||
through the same proxy, in http and in socks5. The fix matters if you also use
|
||||
`invisible_core.launch.build_launch_plan` directly.
|
||||
|
||||
### Removed
|
||||
|
||||
- The `browser launches` badge. The counter behind it was a release asset hosted
|
||||
on a repository that was deleted on 2026-08-18, so the series is frozen on its
|
||||
last real value and the renderer would have redrawn that number every morning.
|
||||
A frozen figure presented as current is worse than no figure. The history is
|
||||
untouched and the SVG on the `badges` branch stays, because already-published
|
||||
PyPI pages are serving it.
|
||||
|
||||
## [0.7.1] - 2026-08-17
|
||||
|
||||
### Changed
|
||||
|
||||
- Pins `invisible-core` 20.14.0, which seals firefox-20. The engine release is
|
||||
the memory one: the same fingerprint at the same seed, the same detector
|
||||
verdicts, less RAM and less CPU. The font faces stopped being copied twice on
|
||||
their way into the shadow list, the bundle is opened by path instead of being
|
||||
held in the heap, and the `.ttc` accounting now counts the faces we DECLARE
|
||||
rather than every face the file happens to carry.
|
||||
|
||||
### Fixed
|
||||
|
||||
- This entry itself was missing until 2026-08-18. 0.7.1 shipped to the index on
|
||||
2026-08-17 and the changelog stopped at 0.7.0, so for a day the released
|
||||
version was undocumented. It was not caught by the release: the guard that
|
||||
compares the index against this file, `test_the_changelog_documents_every_
|
||||
version_it_claims_to_cover` in `tests/test_release_e2e.py`, is marked `e2e`
|
||||
and the default selection deselects it. It fired on the first full e2e run
|
||||
after the release, which is the run that happens for a reason unrelated to
|
||||
releasing.
|
||||
|
||||
## [0.7.0] - 2026-08-11
|
||||
|
||||
### Changed
|
||||
|
||||
- Pins `invisible-core` 19.14.0, which seals firefox-19. The engine release
|
||||
carries a `seal.json` asset for the first time, so the seal a client verifies
|
||||
and the seal the build produced are the same bytes rather than two things
|
||||
that agree.
|
||||
- `session_kwargs` in the test bench no longer pins the proxy exit. It used a
|
||||
literal session id, and the providers are sticky on it, so every realness
|
||||
measurement this project made left through the same address: one distinct IP
|
||||
in twenty-four hours, eleven events on it in one hour, and the detector had
|
||||
classified it as a datacenter. The same binary on fresh exits scores 0, 3 and
|
||||
0 where it scored 14. Consistency runs still pin one exit for their pair,
|
||||
because that comparison is about our own determinism and a rotating exit puts
|
||||
the network inside it.
|
||||
|
||||
### Fixed
|
||||
|
||||
- `scripts/ci_font_gate.py` asked a question whose answer could not mean
|
||||
anything. It launched the engine raw, which since the generic-family map
|
||||
became a declaration means launching it without one - and the engine does not
|
||||
invent declarations. And it inferred "did this face load" from a line height
|
||||
that we declare: it worked while the fallback measured 91 and the families 95,
|
||||
and stopped the day the metrics became declared and the fallback landed on 95.
|
||||
It now hands in the one declaration it needs and asserts which families SHARE
|
||||
a face, measured from the ink box. Green on this build, on the previous
|
||||
release, and on both platforms.
|
||||
|
||||
### Added
|
||||
|
||||
- Two e2e tests for failures the suite could not see: a session that dies under
|
||||
heavy text shaping, and a frame reporting its parent's screen origin instead
|
||||
of its own. Both validated by reintroducing the real defect in the engine and
|
||||
rebuilding, not by reasoning about them.
|
||||
|
||||
## [0.6.1] - 2026-08-05
|
||||
|
||||
### Changed
|
||||
|
||||
- Pins `invisible-core` 18.13.0, which puts an upper bound in wall-clock time on the engine download. A `requests` timeout is per socket operation, so a connection delivering a byte every 59 seconds satisfied it forever and the transfer had no total limit; `INVISIBLE_DOWNLOAD_DEADLINE` (default 1800s) bounds it, and the refusal names the deadline, the elapsed time and the bytes received. Set it to 0 on a genuinely slow link.
|
||||
- README: the Telegram invitation moved to the top and the status badges to the bottom.
|
||||
|
||||
## [0.6.0] - 2026-08-01
|
||||
|
||||
### Fixed
|
||||
- `browser.new_page()` now gives the page the same context `browser.new_context()` does: the profile's viewport, screen, DPR, colour scheme, locale and timezone. It did not, because Playwright's `Browser.new_page` forwards to the IMPLEMENTATION object, whose own `new_page` calls `new_context` on itself, so a wrapper installed on the api object was never consulted. Measured in a real browser with the seed the e2e uses: `new_page` gave `innerWidth` 1280, Playwright's stock viewport, against a fingerprint reporting `screenWidth` 1920, while `new_context` gave 1906; a dark-pinned profile came back light on the same path. `new_page` is the call in this package's README, in the class docstring and in every example it ships, which is why this is a minor bump and not a patch.
|
||||
- The engine-mismatch message told you to run `fetch --force`, three days after that flag was removed with four of the six subcommands. A test pinned the old string, so both were wrong together.
|
||||
- Four tests marked `unit` drove `__enter__` with Playwright mocked and made two real network calls each, then sat out the lifetime guard's full 10s deadline waiting for a browser tree a mock never produces. 45.6s to 0.34s for that file. CI-only.
|
||||
|
||||
### Changed
|
||||
- Requires `invisible-core==18.12.0`, which carries one prefs composition for all three entry points (`compose_session_prefs`), a `proxy=` argument on `get_default_stealth_prefs` that had no way to reach `configure_proxy` before, a proxy endpoint with no port refused rather than dropped silently, and a process scan that no longer asks psutil for the parent of every process on the machine.
|
||||
- `build_prefs` delegates to that composition, so the three entry points that used to stack layers on top of `translate_profile_to_prefs` in their own order now agree, with the difference asserted as an exact set. What stays here is this path's delivery and its two decisions: the cloak, which only Windows and macOS need, and which generator draws the pointer path. `max_seconds_for` is applied here rather than passing `humanize` through, because `humanize=0` with the binary engine selected is a cap of nothing, not a request to disable motion, and passing it straight to the core would make it falsy and switch the generator off.
|
||||
- Eight imports in `launcher.py` and `async_api.py` were unused and are gone. The ninth, `IANA_TO_POSIX_TZ` in `_session.py`, is not dead: the import IS the probe that turns an old core into a message about a version instead of a message about a symbol, so it keeps a `noqa` carrying the reason.
|
||||
- `datetime.utcfromtimestamp` is replaced in `_recaptcha_seed.py`. It returns a naive datetime and has been deprecated since 3.12, which matters now that the matrix reaches 3.14.
|
||||
- CI runs 3.11, 3.12, 3.13 and 3.14 on Ubuntu and Windows, every version `requires-python` promises; two of them had never run here. ruff selects F601 beside F821 and F811, because a dict literal with a repeated key silently keeps only the last one and Python does not warn.
|
||||
- ruff is declared in the dev extra instead of being pip-installed unpinned on every run, so the tool that gates every push cannot change under us between two pushes. `pytest-mock` and `responses` were declared and used by no test in this package, and are dropped.
|
||||
- Publishing is a workflow on a tag push using PyPI trusted publishing (OIDC, environment `pypi`), so there is no long-lived token on a machine or in a secret. The upload sits behind a gate that checks three things a person had to remember: the tag names the version being built, the `invisible-core==` pin is already on the index, and the suite passes, since a tag push does not trigger the ordinary test workflow. It needs a GitHub publisher registered on PyPI before its first run; until that exists the upload fails with `invalid-publisher`, which is the correct failure.
|
||||
|
||||
## [0.5.0] - 2026-08-01
|
||||
|
||||
### Changed
|
||||
- The CLI is two commands, `fetch` and `version`. `path`, `clear-cache`, `doctor` and `fetch --force` are gone, and so is the tag argument. **Breaking for anybody scripting the four that were removed** - they fail loudly rather than being ignored, and a test asserts that. None of the behaviour is gone.
|
||||
- `doctor` runs inside `fetch` now, on every run and before the download rather than after. That ordering is the point: a cached tree that no longer matches the seal is the case worth catching, and it is invisible to a "download if missing" that only looks at whether a file exists. It was the thing most worth doing and the thing least likely to be typed.
|
||||
- `--force` is unnecessary once every run verifies: a tree is replaced because it does not match the seal, not because a flag was passed.
|
||||
- `path` is the last line of `fetch`'s stdout, so `$(invisible-playwright fetch)` is the scripting form, and unlike `path` it guarantees the thing it names exists and matches. The mismatch report goes to stderr so it can never end up inside a captured path.
|
||||
- `clear-cache` is deliberately NOT folded in. The cache root is shared with `invisible_firefox`, so pruning trees no seal points at would delete the other product's engine on a machine running both. `version` prints the location instead.
|
||||
- The tag argument went with them: the seal decides which engine a build runs and `verify_engine` refuses anything else, so a tag on the command line could only ever name something that would then be rejected.
|
||||
- The surface is asserted as an EXACT set, not a subset. A subset check passes while the CLI grows back one convenience at a time, which is how it reached six.
|
||||
|
||||
## [0.4.9] - 2026-08-01
|
||||
|
||||
### Changed
|
||||
- Requires `invisible-core==18.11.0`. 18.10.0 classifies a 404 on the engine archive instead of raising a bare `HTTPError`, which is issue #51, and 18.11.0 removed the part of it that ran `pip install --upgrade` on the caller's environment: a library that installs things while it is running mutates an environment nobody asked it to touch, ignores whatever lockfile chose that version, and inside a container rewrites an image layer at runtime. What reaches a user of this package is that a 404 on the engine now says whether the release was retired on purpose, in which case no retry will find it and the message carries the upgrade command, or whether the tag is current and the fault is ours. Nothing in this package's behaviour changed.
|
||||
|
||||
### Fixed
|
||||
- The README said the sampler draws "~400 fields". Measured against a real profile: 197 leaves on the most generous count, which treats every bundled font name as a field, and 155 prefs emitted. Corrected to ~200. `tests/test_readme_claims.py` now gates the engine version, the platform list, the download size, the documented subcommands in both directions, and every fenced Python example on the page - four claims that had nothing checking them.
|
||||
- A publish was racing its own verification: the install e2e runs on `release:`, which fires seconds after the upload, and the index does not serve a new version to pip immediately, so the job reported a forgotten publish that had happened two minutes earlier. A bounded five-minute poll on the per-version endpoint, scoped to the release event. CI-only.
|
||||
|
||||
## [0.4.8] - 2026-07-28
|
||||
|
||||
### Changed
|
||||
- Requires `invisible-core==18.9.0`, which carries a clearer engine refusal (it used to locate a missing juggler inside an `omni.ja` the tree does not have) and a publish gate that no longer reports a mistyped command with the same exit code as a broken gate. An exact pin means those reach a user only when this package's pin moves, so this release is what delivers them.
|
||||
- CI runs ruff with F821 and F811 selected, those two only: they catch a name that cannot resolve, which is not a style question and not findable by running tests. Nothing here had ever run a linter, and there are zero violations once the three below are fixed.
|
||||
|
||||
### Fixed
|
||||
- `Renderer` was used as an annotation six times in `_behaviour.py` and defined in no module in the repository. It survives only because `from __future__ import annotations` never evaluates an annotation, so the six were strings that looked like a type and a reader had no way to learn what the parameter accepts. It is a real alias now.
|
||||
- `prof: Any` in `_motion.py`, with `Any` itself unimported. Importing it would have widened that module's deliberately tiny allowlist, which one of its own tests enforces, and there was no need: `prof` is the cumulative distance table `_profile_table` returns and `_profile_at` consumes, both annotated `list[float]` a few lines away.
|
||||
- The install e2e imported the venv helpers from `invisible_core.testing`, which the runner does not have on purpose, so the job went red at collection having tested nothing. The helpers are local to those two files again, with the reason above them, and the core's suite now parses every file the user-install workflows name and refuses the import. CI-only.
|
||||
- CI arms the hooks, because the suite asserts they are armed. The assertion moved into `invisible_core.testing` and all three repos started making it, but only the core's workflow ran `install_hooks.py`, so this repo went red on every push with a message about an unset config that reads like a developer's mistake rather than a missing CI step. CI-only.
|
||||
|
||||
## [0.4.7] - 2026-07-28
|
||||
|
||||
### Changed
|
||||
- Requires `invisible-core==18.8.0`, which carries the work of the last two days: the prefs builder split into fourteen named steps with its output hash-identical across 400 profiles, the GeoIP fetch moved out of `download`, `invisible_core.pin` as a public module, and a publish gate whose index cross-check finally asks about the package it is gating.
|
||||
- Nothing in this package's behaviour changed. The imports moved: it asks `invisible_core` for what that package exports instead of reaching into its private modules, and its own back-compat shims are for users again rather than for its own source.
|
||||
|
||||
### Fixed
|
||||
- The suite could not tell a collapsed selection from a pass in one place and the install e2e imported the package it tests the install of in another; both are CI-only and neither reached a user.
|
||||
|
||||
## [0.4.6] - 2026-07-27
|
||||
|
||||
### Changed
|
||||
- This package can no longer be published without a gate. A release used to be a bare `twine upload` of whatever happened to be in a directory - which is how 0.4.4 reached the index built from a tree that predated the fix it was meant to carry. The gate is `invisible_core.release`, one implementation for all three packages, and the pre-push hook runs it on a release tag. What makes it work is that `publish` builds and uploads *what it just built*, so a stale directory cannot be what ships.
|
||||
- `PUBLISHED.json` records what actually reached the index, back-filled from the artifacts themselves.
|
||||
- Requires `invisible-core==18.6.0`.
|
||||
|
||||
## [0.4.5] - 2026-07-27
|
||||
|
||||
### Fixed
|
||||
- An environment holding an older `invisible-core` failed on the browser launch path with `ImportError: cannot import name 'IANA_TO_POSIX_TZ' from 'invisible_core'` - a symbol name, from a package whose version the reader did not choose. It now states which core version this build needs, keeps the original error inside the message for whoever is debugging, and ends with the command that fixes it. **0.4.4 has this bug and cannot be corrected in place; a PyPI filename is never re-uploaded. Use 0.4.5.**
|
||||
|
||||
## [0.4.4] - 2026-07-27
|
||||
|
||||
### Changed
|
||||
- The process-lifetime machinery moved into `invisible-core`, shared with the profile manager. Both packages launch the same browser and both had the same leak; the manager had it a day longer because the fix lived here. `invisible_playwright._reaper` stays as a re-export, so nothing you import changes.
|
||||
- The IANA-to-POSIX timezone table is the core's now. This package carried a byte-identical copy of all ten entries, including the Arizona row that exists because mapping it to `MST7MDT` made libc apply DST and an identification service deduce a Denver origin - and the core's own copy carried a comment admitting it had been copied from here. Two copies with a documented keep-in-sync obligation and nothing enforcing it.
|
||||
|
||||
### Fixed
|
||||
- The lifetime guard counted an attempted job assignment as a successful one, so a process it had failed to adopt was never retried and the count it reported was a number of tries. Measured on the sibling package, that reported eight processes held while eight survived the kill. This package shipped the same accounting.
|
||||
|
||||
## [0.4.3] - 2026-07-27
|
||||
|
||||
### Fixed
|
||||
- `async with InvisiblePlaywright(...)` no longer leaves browsers behind when the runner is killed. The lifetime guard added in 0.4.0 reached the sync entry point only, so every async user kept the entire leak while this file said it was closed. If you drive this package with `async with` on Windows, upgrading is the fix.
|
||||
- The guard itself stopped adopting the process tree after the first process it found, so part of the tree stayed outside the kernel job even on the sync path. Found by killing the runner mid-session and counting the browsers still carrying that session's token: sync 0/0/0/0, async 2/0/0/2 - the same code on both, differing only in timing, which is what made an intermittent race look like a working feature. After the fix: ten sessions, zero survivors on both.
|
||||
- `INVPW_TRUE_HEADLESS` now works on both entry points. It was read in the async class alone, so a documented environment variable applied or did not depending on whether you wrote `with` or `async with`.
|
||||
|
||||
### Changed
|
||||
- The two entry points share their session logic instead of restating it: prefs, the launch environment and the IANA-to-POSIX timezone table live in one module both call. 80.6% of the async class was the sync class retyped, which is how a fix reaches one of them and a release note describes both.
|
||||
- Requires `invisible-core==18.3.0`.
|
||||
|
||||
## [0.4.2] - 2026-07-26
|
||||
|
||||
### Changed
|
||||
- The lifetime guard is a strategy object instead of a module of flags. `SessionToken` (a value object), `find_processes` (the only place psutil appears) and `LifetimeGuard` with a `JobObjectGuard` / `NullGuard` pair: `os.name` is tested in exactly one place, so no launcher code branches on the platform, and the Null implementation reports that it guarantees nothing rather than doing nothing while looking successful. Behaviour unchanged.
|
||||
- The stroke planner is six named stages instead of one 203-line function, and the idle planner is a table of episodes instead of an if/elif chain with the weights written as bare literals in the branch conditions. Both verified byte-identical against recorded output, which caught two float-associativity regressions that no other test could see - `a * b * c` and `a * (b * c)` differ in the last bit, and that is enough to change a rounded pixel and every draw after it. A permanent fingerprint test now covers 576 cases and 16135 waypoints.
|
||||
|
||||
## [0.4.1] - 2026-07-26
|
||||
|
||||
### Changed
|
||||
- Three long functions became named stages, with their output pinned before and after so the refactor could not change it in silence.
|
||||
- The lifetime guard became a strategy rather than a module of flags.
|
||||
- The forbidden-name scan no longer blocks a clone that has no word list.
|
||||
|
||||
## [0.4.0] - 2026-07-26
|
||||
|
||||
### Added
|
||||
- Pointer movement is generated in this package, from the session seed, instead of by the engine. Existing code gets it with no edit: the six internal funnels every pointer action already goes through are wrapped, so a `page.click` written a year ago moves through the new generator. A plain `sync_playwright()` browser in the same process is untouched.
|
||||
- Movement between actions: drift while reading, motion while the wheel turns, overshoot and correction, and movements that end on nothing. If every movement ends on something clickable, the set of endpoints is itself a signature however good each path is.
|
||||
- `INVPW_CURSOR_ENGINE` selects the generator: `python` (default), `binary` (the previous behaviour) or `off`.
|
||||
- The browser process tree is tied to this process's lifetime on Windows, so it cannot outlive a runner that was killed. Measured: eight survivors on the first attempt and twelve on the second before, zero after. `psutil` becomes a dependency for this - an optional reaper is absent exactly on the machines that need it, and silently.
|
||||
- The browser process tree is tied to this process's lifetime on Windows, so it cannot outlive a runner that was killed. Measured: eight survivors on the first attempt and twelve on the second before, zero after. `psutil` becomes a dependency for this - an optional reaper is absent exactly on the machines that need it, and silently. **This reached the SYNC entry point only. `async with` kept the whole leak through 0.4.2 - see 0.4.3.**
|
||||
|
||||
### Changed
|
||||
- Install is now `pip install invisible-playwright`, from the index. The git URL is gone from the README, the CLI docs and the generated release notes. Nothing about the package changes for someone who was already installing it from git, except that pip can now see what it is holding.
|
||||
- `invisible-core` is declared as an exact version specifier (`invisible-core== an exact version`) instead of a `git+https://...` direct reference. A direct reference carries no version, so there is nothing for `pip check` to compare and a broken environment reports clean; a real specifier is reported, exit 1, and a plain reinstall of this package repairs it. The cost is that a binary bump is now a release of every package that pins the core, which is deliberate.
|
||||
- Requires `invisible-core>=18.2.0`, which bounds the timezone lookup as a step rather than only per request.
|
||||
|
||||
### Fixed
|
||||
- `hover()` no longer fails intermittently on Windows. The approach now completes before the automation layer's hit-target check is installed, so the only event inside its window is that layer's own move, on target. Measured on a page whose target needs a scroll: 3 failures out of 3 before, 0 out of 3 after.
|
||||
|
||||
## [Unreleased]
|
||||
## [0.3.6] - 2026-07-25
|
||||
|
||||
### Fixed
|
||||
- The browser tree now dies with this process even when the process is KILLED. An exception out of the `with` block was never the leak - `__exit__` runs and Playwright cleans up, measured over an interleaved A/B with zero survivors. The leak is the killed-runner path, where `__exit__` never executes at all: launch, kill the runner, and eight processes were still alive, twelve on the second attempt.
|
||||
|
||||
### Changed
|
||||
- Install is now `pip install invisible-playwright`, from the index. The git URL is gone from the README, the CLI docs and the generated release notes. Nothing about the package changes for someone who was already installing it from git, except that pip can now see what it is holding.
|
||||
- `invisible-core` is declared as an exact version specifier (`invisible-core==18.0.0`) instead of a `git+https://...` direct reference. A direct reference carries no version, so there is nothing for `pip check` to compare and a broken environment reports clean; a real specifier is reported, exit 1, and a plain reinstall of this package repairs it. The cost is that a binary bump is now a release of every package that pins the core, which is deliberate.
|
||||
- Declared as `invisible_playwright` on the index, pinning `invisible-core==18.1.0`.
|
||||
|
||||
## [0.3.5] - 2026-07-24
|
||||
## [0.3.5] - 2026-07-25
|
||||
|
||||
### Changed
|
||||
- Playwright pin is back to `>=1.55,<=1.61.0`: the floor drop to `1.40` shipped in 0.3.4 is reverted. The conservative CI-tested floor (1.55) is kept together with the tested upper cap (1.61.0).
|
||||
@@ -208,6 +400,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
- SOCKS5 / SOCKS4 / HTTP / HTTPS proxy support with auth.
|
||||
- Linux x86_64 and Windows x86_64 binary support.
|
||||
|
||||
[Unreleased]: https://github.com/feder-cr/invisible_playwright/compare/v0.1.1...HEAD
|
||||
[0.1.1]: https://github.com/feder-cr/invisible_playwright/compare/v0.1.0...v0.1.1
|
||||
[0.1.0]: https://github.com/feder-cr/invisible_playwright/releases/tag/v0.1.0
|
||||
[0.4.3]: https://github.com/feder-cr/invisible_playwright/releases/tag/v0.4.3
|
||||
> Le due voci piu' vecchie puntano a COMMIT e non a tag: 0.1.0 e 0.1.1
|
||||
> precedono l'arrivo su PyPI (l'indice parte da 0.3.5) e non hanno mai
|
||||
> avuto un tag. Crearne uno oggi non e' innocuo: `publish.yml` si innesca
|
||||
> su `v*`, e per una versione che l'indice non serve `already-published`
|
||||
> non corto-circuita, quindi un tag nuovo puo' far partire un tentativo di
|
||||
> pubblicazione. Il commit e' la stessa informazione senza quel rischio.
|
||||
|
||||
[0.1.1]: https://github.com/feder-cr/invisible_playwright/compare/7a983e99c53fa1ec1a443651a4dd9de42258dc61...589c848e07a67c459969a2ddfb79851f48b10eff
|
||||
[0.1.0]: https://github.com/feder-cr/invisible_playwright/commit/7a983e99c53fa1ec1a443651a4dd9de42258dc61
|
||||
[0.4.4]: https://github.com/feder-cr/invisible_playwright/releases/tag/v0.4.4
|
||||
[0.4.5]: https://github.com/feder-cr/invisible_playwright/releases/tag/v0.4.5
|
||||
[0.4.6]: https://github.com/feder-cr/invisible_playwright/releases/tag/v0.4.6
|
||||
@@ -1,30 +1,21 @@
|
||||
<p>
|
||||
<a href="https://github.com/feder-cr/invisible_playwright/actions/workflows/tests.yml"><img src="https://github.com/feder-cr/invisible_playwright/actions/workflows/tests.yml/badge.svg" alt="tests"></a>
|
||||
<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>
|
||||
<a href="https://github.com/feder-cr/invisible_playwright/stargazers"><img src="https://raw.githubusercontent.com/feder-cr/invisible_playwright/main/docs/badges/stars.svg" alt="GitHub stars"></a>
|
||||
<a href="https://github.com/feder-cr/firefox_antidetect_patch/releases/tag/usage-counter"><img src="https://raw.githubusercontent.com/feder-cr/invisible_playwright/main/docs/badges/launches.svg" alt="browser launches"></a>
|
||||
</p>
|
||||
|
||||
<div align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/feder-cr/invisible_playwright/7a8693c6b4386e9a84dd93bedc479ca8654482e1/docs/banner-dark.png">
|
||||
<img src="https://raw.githubusercontent.com/feder-cr/invisible_playwright/7a8693c6b4386e9a84dd93bedc479ca8654482e1/docs/banner-light.png" alt="invisible_playwright" width="620">
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/feder-cr/invisible_playwright/main/docs/banner-dark.png">
|
||||
<img src="https://raw.githubusercontent.com/feder-cr/invisible_playwright/main/docs/banner-light.png" alt="invisible_playwright" width="720">
|
||||
</picture>
|
||||
<h3 align="center">Free antidetect browser stealth for Playwright: undetected Firefox fingerprint, headless or headed.<br>
|
||||
Python web scraping and captcha bypass. Open source, and it passes every bot detection test.</h3>
|
||||
</div>
|
||||
|
||||
<h3 align="center">A modified Firefox that passes every bot detection test.</h3>
|
||||
|
||||

|
||||
|
||||
## How it works
|
||||
|
||||
Anti-bots ask two questions. invisible_playwright answers yes to both.
|
||||
Anti-bots ask two questions, and reCAPTCHA, hCaptcha and Cloudflare Turnstile score the answers. invisible_playwright answers yes to both.
|
||||
|
||||
**1. Is this a real browser?** Yes. It is Firefox, patched at the C++ source level.
|
||||
|
||||
- Fingerprint set inside the engine, not injected into the page: Navigator, screen, GPU/WebGL, Canvas, fonts, audio, WebRTC, timezone, network.
|
||||
- The browser fingerprint is set inside the engine, not injected into the page: navigator, screen, GPU/WebGL, canvas, fonts, audio, WebRTC, timezone, network. Headless or headed, the same values either way.
|
||||
- No JS shim, no override, no seam to read.
|
||||
|
||||
**2. Is a real person using it?** Yes. The actions are humanized in the driver.
|
||||
@@ -39,15 +30,13 @@ Driven by the standard Playwright API. Full breakdown: [feder-cr/firefox_antidet
|
||||
## Still seeing captchas or anti-bot? It's the proxy.
|
||||
Once the browser is handled it stops being the variable. If you are still getting challenged, the tell is no longer the browser, it is the IP you come from. Around 90% of proxies are public: anyone can rent the same address, so it is already known and sits on the blocked-IP lists sites check. A perfect browser on a known IP still loses.
|
||||
|
||||
> The fix is the clean 10%, residential IPs that aren't already known. For those we recommend [sx.org](https://sx.org/?c=invisible_playwright), who filter for and serve only IPs that aren't already on those lists.
|
||||
|
||||
---
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
pip install invisible-playwright
|
||||
python -m invisible_playwright fetch # one-time ~100 MB download, SHA256-verified
|
||||
python -m invisible_playwright fetch # one-time ~238 MB download (~544 MB unpacked), sha256-verified
|
||||
```
|
||||
|
||||
Supported platforms: **Windows x86_64**, **Linux x86_64 / arm64**, **macOS arm64 / x86_64**. On macOS the app is ad-hoc signed (not notarized): if Gatekeeper complains, clear the quarantine flag once with `xattr -dr com.apple.quarantine` on the cached `Firefox.app`.
|
||||
@@ -66,7 +55,7 @@ Supported platforms: **Windows x86_64**, **Linux x86_64 / arm64**, **macOS arm64
|
||||
+ with InvisiblePlaywright() as browser:
|
||||
```
|
||||
|
||||
Every session gets a distinct fingerprint (GPU, audio, fonts, screen, ~400 fields) and Bezier-curve mouse motion.
|
||||
Every session gets a distinct fingerprint (GPU, audio, fonts, screen, ~200 fields) and Bezier-curve mouse motion.
|
||||
|
||||
**Sync**
|
||||
```python
|
||||
@@ -120,8 +109,6 @@ with InvisiblePlaywright(proxy=proxy) as browser:
|
||||
|
||||
Schemes supported: `socks5`, `socks4`, `http`, `https`. DNS is routed through the proxy by default, no local leak.
|
||||
|
||||
Around 90% of proxies are public, so their IPs are already known and blocked. For the clean 10%, residential IPs that aren't already known, we recommend [sx.org](https://sx.org/?c=invisible_playwright), who filter for and serve only IPs that aren't already on those lists.
|
||||
|
||||
### Timezone
|
||||
|
||||
The browser timezone follows `timezone=`:
|
||||
@@ -155,27 +142,84 @@ with InvisiblePlaywright(
|
||||
...
|
||||
```
|
||||
|
||||
Full list of pinnable keys, how pinning interacts with the Bayesian sampler, and common patterns are in **[docs/pinning.md](https://github.com/feder-cr/invisible_playwright/blob/main/docs/pinning.md)**.
|
||||
Full list of pinnable keys, how pinning interacts with the Bayesian sampler, and common patterns are in **[docs/pinning.md](docs/pinning.md)**.
|
||||
|
||||
---
|
||||
|
||||
## CLI
|
||||
|
||||
The installed command is `invisible-playwright`, with a hyphen. `python -m
|
||||
invisible_playwright` works identically and needs nothing on PATH.
|
||||
|
||||
```bash
|
||||
invisible_playwright fetch # download the binary if missing
|
||||
invisible_playwright fetch --force # re-download even if cached
|
||||
invisible_playwright path # print the absolute path to the cached binary
|
||||
invisible_playwright version # wrapper and binary versions
|
||||
invisible_playwright clear-cache # remove all cached binaries
|
||||
invisible-playwright fetch # download the engine if missing, check every cached
|
||||
# one against the seal, print the path
|
||||
invisible-playwright version # wrapper, core and engine versions, and where the
|
||||
# engine is cached
|
||||
```
|
||||
|
||||
## Documentation, guides and comparisons
|
||||
|
||||
All of it reads better, and is searchable, in
|
||||
**[the wiki](https://github.com/feder-cr/invisible_playwright/wiki)**,
|
||||
organised into four sections instead of one flat list:
|
||||
|
||||
- **[Documentation](docs/documentation.md)** -
|
||||
installation, the two-line switch from plain Playwright, proxy/timezone
|
||||
configuration, pinning specific fields, the CLI.
|
||||
- **[Guides](docs/guides.md)** - how
|
||||
detection actually works, in seven groups: browser identity, canvas/WebGL/fonts/
|
||||
audio, network and WebRTC, the automation layer, AI agents, the detectors themselves
|
||||
explained from source, and testing.
|
||||
- **[Comparisons](docs/comparisons.md)** -
|
||||
against Camoufox, Patchright, nodriver and playwright-stealth, and the case for
|
||||
Firefox over Chromium generally.
|
||||
- **[Integrations](docs/integrations/)** -
|
||||
Scrapy, Crawlee, Robot Framework, CodeceptJS, test runners, Playwright MCP, and the
|
||||
frameworks it does not fit, by name.
|
||||
|
||||
If you don't know where to start: [Three ways to make Playwright undetected](docs/playwright-stealth-levels.md)
|
||||
is the map most other pages link back to, [Playwright detected as a bot on one site](docs/playwright-detected-as-bot.md)
|
||||
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.
|
||||
- [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
|
||||
- [measureText and TextMetrics as a fingerprinting surface](docs/measuretext-textmetrics-fingerprinting.md) - ten-plus numbers from one call needing no permission prompt, and the two mistakes we made fixing it
|
||||
- [What privacy.resistFingerprinting really does](docs/resist-fingerprinting.md) - and why this project sets it to false on purpose
|
||||
- [The ChromeDriver cdc_ variable](docs/cdc-variable-explained.md) - why renaming it is not removing it, and what that generalises to
|
||||
- [What bot.sannysoft.com actually checks](docs/sannysoft-explained.md) - row by row, and the canvas-in-iframe test nobody reads
|
||||
- [How CreepJS decides you are lying](docs/creepjs-explained.md) - four detection techniques, and why blocking the probe is itself recorded
|
||||
- [Firefox preferences that silently do nothing](docs/firefox-prefs-not-applying.md) - five reasons, starting with the one that cost us a real bug
|
||||
- [What BotD actually detects](docs/botd-explained.md) - twenty detectors, and why most are not about bots at all
|
||||
- [Why a FingerprintJS visitor ID changes](docs/fingerprintjs-visitor-id.md) - it is a hash of 41 components, so one moving moves all of it
|
||||
|
||||
## Related projects
|
||||
|
||||
Related projects that cover similar ground:
|
||||
The open-source neighbours, and what each one is for.
|
||||
|
||||
- **[arkenfox/user.js](https://github.com/arkenfox/user.js)** - Firefox privacy hardening via prefs. invisible_playwright patches C++ where prefs are insufficient.
|
||||
- **[LibreWolf](https://librewolf.net)** - Firefox fork with privacy defaults. LibreWolf ships a configured binary; invisible_playwright ships source patches + automation wrapper.
|
||||
- **[Camoufox](https://github.com/daijro/camoufox)** - open-source anti-detect Firefox. Patches a wider surface and ships its own fingerprint database; invisible_playwright uses a Bayesian sampler.
|
||||
**On the Firefox side**
|
||||
|
||||
- **[Camoufox](https://github.com/daijro/camoufox)** - an anti-detect Firefox that also patches at the C++ level. It covers a wider surface and ships its own fingerprint database; this project derives a fingerprint from a seed with a Bayesian sampler, so one number reproduces one machine. [Full comparison](docs/vs-camoufox.md).
|
||||
- **[LibreWolf](https://librewolf.net)** - a Firefox fork with privacy defaults. It ships a configured binary for people to browse with; this ships source patches plus an automation wrapper.
|
||||
- **[arkenfox/user.js](https://github.com/arkenfox/user.js)** - Firefox hardening through preferences. Where a preference is enough, use it; this project patches C++ where one is not.
|
||||
|
||||
**On the Chromium side**
|
||||
|
||||
- **[Patchright](https://github.com/Kaliiiiiiiiii-Vinyzu/patchright)** - a patched Playwright fork, so the stealth work lands in the driver rather than in the browser binary. [Full comparison](docs/vs-patchright.md).
|
||||
- **[nodriver](https://github.com/ultrafunkamsterdam/nodriver)** - the successor to `undetected-chromedriver`, driving Chrome over CDP directly and removing the WebDriver-flavoured tells. [Full comparison](docs/vs-nodriver.md).
|
||||
- **[playwright-stealth](https://github.com/Mattwmaster58/playwright_stealth)** - an init-script patch applied before the page loads. Its own maintainer calls it a proof-of-concept; [full comparison](docs/vs-playwright-stealth.md).
|
||||
- **[puppeteer-extra-plugin-stealth](https://github.com/berstend/puppeteer-extra)** - the original of this init-script lineage, still widely recommended. Its repository's last substantive commit is from mid-2024; [what that means in practice](docs/puppeteer-extra-stealth-unmaintained.md).
|
||||
- **[selenium-stealth](https://github.com/diprajpatra/selenium-stealth)** - the same approach on Selenium/CDP. Its repository's last commit is from December 2021; [what that means in practice](docs/selenium-stealth-unmaintained.md).
|
||||
- **[pyppeteer](https://github.com/pyppeteer/pyppeteer)** - the unofficial Python port of Puppeteer. Its own README says it's unmaintained and points to `playwright-python` instead; [what that recommendation is actually about](docs/pyppeteer-unmaintained-playwright.md).
|
||||
- **[rebrowser-patches](https://github.com/rebrowser/rebrowser-patches)** - fixes the `Runtime.enable` CDP leak on Chromium, independently converging on close to the same fix Patchright uses. [Full comparison](docs/vs-rebrowser-patches.md).
|
||||
- **[fingerprint-suite](https://github.com/apify/fingerprint-suite)** - generates a coherent fingerprint with a Bayesian network, close to this project's own generation approach, then injects it into a Playwright or Puppeteer page on either Chromium or Firefox. [Full comparison](docs/vs-fingerprint-suite.md).
|
||||
- **[playwright-with-fingerprints](https://github.com/bablosoft/playwright-with-fingerprints)** - injects fingerprint values sourced from a remote paid service, Windows-only, pinned to a specific Chromium build. [Full comparison](docs/vs-playwright-with-fingerprints.md).
|
||||
|
||||
Which of these fits depends on the layer your problem is at, and on whether you need Firefox or Chromium. [Three ways to make Playwright undetected](docs/playwright-stealth-levels.md) works through what each layer can and cannot reach, including what this one costs.
|
||||
|
||||
If you are picking between engines rather than tools, note that a large share of AI agent frameworks drive Chromium over CDP, which decides the question for you: [AI browser agents and stealth](docs/ai-browser-agents-stealth.md).
|
||||
|
||||
---
|
||||
|
||||
@@ -189,10 +233,17 @@ MIT - see [LICENSE](https://github.com/feder-cr/invisible_playwright/blob/main/L
|
||||
|
||||
This project is for educational purposes only. It is provided as-is, with no warranties. I take no responsibility for how it is used. Use it at your own risk and in compliance with the laws of your jurisdiction.
|
||||
|
||||
|
||||
---
|
||||
|
||||
<p align="center">
|
||||
Built by <a href="https://it.linkedin.com/in/federico-elia-5199951b6">Federico Elia</a>
|
||||
<a href="https://it.linkedin.com/in/federico-elia-5199951b6"><img src="https://raw.githubusercontent.com/feder-cr/invisible_playwright/main/docs/badges/linkedin.svg" alt="LinkedIn"></a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/feder-cr/invisible_playwright/actions/workflows/tests.yml"><img src="https://github.com/feder-cr/invisible_playwright/actions/workflows/tests.yml/badge.svg" alt="tests"></a>
|
||||
<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>
|
||||
<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>
|
||||
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: "docs/ source folder"
|
||||
description: "This folder is the Jekyll source for the published documentation site. Read it there, with search and proper navigation, not as raw files."
|
||||
nav_exclude: true
|
||||
search_exclude: true
|
||||
sitemap: false
|
||||
---
|
||||
|
||||
# docs/ source folder
|
||||
|
||||
This folder is the source the wiki is rendered from. Read it with search and
|
||||
navigation in **[the wiki](https://github.com/feder-cr/invisible_playwright/wiki)**.
|
||||
|
||||
`index.md` is what the site root actually serves. This file exists so the folder
|
||||
still shows something sensible when browsed directly on github.com.
|
||||
@@ -0,0 +1,270 @@
|
||||
---
|
||||
title: "about:webrtc: read your real ICE candidates"
|
||||
description: "Read your live ICE candidates in Firefox's built-in about:webrtc: tell a real LAN-IP leak from a masked .local host and a proxy-egress srflx line."
|
||||
parent: "Network, Proxy and WebRTC"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 17
|
||||
---
|
||||
|
||||
|
||||
# about:webrtc: read your real ICE candidates
|
||||
|
||||
A public leak site gives you a verdict and a couple of IP strings. Firefox ships a
|
||||
page that gives you the raw material behind that verdict: every
|
||||
[ICE candidate](https://datatracker.ietf.org/doc/html/rfc8445) the
|
||||
browser gathered, its type, its address, its priority, and the timeline of when each
|
||||
one arrived. It is `about:webrtc`, it is built in, it needs no extension, and it is
|
||||
the first place to look after any change to a WebRTC or proxy setting.
|
||||
|
||||
This page is how to read it, what the three interesting candidate states look like
|
||||
line by line, how to pair it with `about:config`, and how to reproduce the same read
|
||||
from a Playwright script so a bad candidate fails a test instead of a real session.
|
||||
|
||||
## Why a leak site is not enough
|
||||
|
||||
A leak site aggregates. It runs the gathering for you, picks the addresses it thinks
|
||||
matter, and prints something like "Local IP" and "Public IP" with a green or red
|
||||
badge. That summary hides exactly the distinctions you need while debugging, because
|
||||
three very different underlying states can round to the same badge:
|
||||
|
||||
- A host candidate carrying a raw `192.168.x.x` LAN address. This is a real leak, and
|
||||
it is *worse* than a stock browser, which hides that address by default.
|
||||
- A host candidate carrying an obfuscated `<uuid>.local` name. This is the correct
|
||||
state, and it is what a stock Firefox produces.
|
||||
- A server-reflexive (`srflx`) candidate whose address is your proxy egress, with a
|
||||
plausible NAT port and a priority in the range a real candidate uses.
|
||||
|
||||
A "No Leak" badge can be produced by the second and third states working correctly,
|
||||
and it can also be produced by WebRTC being suppressed to the point that nothing is
|
||||
gathered at all, which is [its own detectable signal](webrtc-leak-proxy.md). The
|
||||
badge does not tell you which. The candidate list does.
|
||||
|
||||
## Opening about:webrtc and reading a session
|
||||
|
||||
Type `about:webrtc` into the address bar. The page is empty until a peer connection
|
||||
exists, so open a page that creates one first, then come back to it. Each connection
|
||||
gets a collapsible block; expand it and the two things worth reading are:
|
||||
|
||||
- **ICE Stats / the candidate table.** Every gathered candidate with its type
|
||||
(`host`, `srflx`, `relay`), its address, its port, its protocol and its priority.
|
||||
- **The ICE gathering log / timeline.** Timestamped lines showing when gathering
|
||||
started, when each candidate was added, and when it finished. A candidate that
|
||||
arrives suspiciously early (time zero, no round trip) is as much a tell as a wrong
|
||||
address, and the timeline is the only view that shows arrival time.
|
||||
|
||||
You are reading for three things: that a host candidate exists and is masked, that a
|
||||
server-reflexive candidate exists and points at the exit you expect, and that the
|
||||
timeline looks like a browser talking to a STUN server rather than fabricating an
|
||||
answer instantly.
|
||||
|
||||
## The three states a leak site collapses into one
|
||||
|
||||
Three candidate states, plus a suppressed section that gathers nothing, all round to
|
||||
the same one-word leak-site badge. The table below is how each reads in the candidate
|
||||
list; the lines underneath show the exact shape of each one.
|
||||
|
||||
| State | Candidate line | Leak-site badge | Verdict |
|
||||
|---|---|---|---|
|
||||
| Leak | `typ host` with a raw `192.168.x.x` LAN address | "Local IP" / red warning | Real leak, worse than stock |
|
||||
| Correct host | `typ host` with a `<uuid>.local` name | "No Leak", local IP shown as "-" | Shipped, correct |
|
||||
| Correct srflx | `typ srflx` with your proxy egress address | contributes to "No Leak" | Correct exit |
|
||||
| Suppressed | nothing gathered at all | "No Leak" | Detectable tell, a FAIL |
|
||||
|
||||
Here is what each state looks like as a candidate line, so you can recognise it on
|
||||
sight in the table.
|
||||
|
||||
**Leak (worst case).** The host candidate carries the machine's real LAN address:
|
||||
|
||||
```text
|
||||
candidate:0 1 UDP 2122252543 192.168.1.24 51894 typ host
|
||||
```
|
||||
|
||||
If you see a private `192.168.x.x`, `10.x.x.x` or `172.16-31.x.x` address on a `typ
|
||||
host` line, WebRTC is handing out your internal network address. A stock browser does
|
||||
not do this; it masks it. Seeing it means a masking setting is off, and you are now
|
||||
more identifiable than a default install.
|
||||
|
||||
**Correct host.** The same candidate with the address replaced by a per-session mDNS
|
||||
name:
|
||||
|
||||
```text
|
||||
candidate:0 1 UDP 2122252543 3f1c9a7e-....local 51894 typ host
|
||||
```
|
||||
|
||||
The `.local` name is what a stock Firefox emits by default, and a leak site reads it
|
||||
as "No Leak" with the local IP shown as "-". This is the shipped state here: the
|
||||
patched engine keeps host-address obfuscation on, so the host line is a `.local` name
|
||||
and never a raw LAN IP.
|
||||
|
||||
**Correct srflx.** The server-reflexive candidate carries your public exit and a NAT
|
||||
port:
|
||||
|
||||
```text
|
||||
candidate:1 1 UDP 1686052863 203.0.113.45 49731 typ srflx raddr 0.0.0.0 rport 0
|
||||
```
|
||||
|
||||
Behind a proxy, that address must be the proxy egress, not your real public IP and not
|
||||
a private address. The port should sit in the ephemeral NAT range and the priority
|
||||
should look like a real `srflx` priority rather than a round, hand-picked number.
|
||||
Getting the [priority and foundation right, not just the address](webrtc-ice-candidate-spoofing.md),
|
||||
is what separates a candidate that survives inspection from one that only survives a
|
||||
leak badge.
|
||||
|
||||
## Pairing it with about:config
|
||||
|
||||
`about:webrtc` shows you the result; `about:config` shows you the switches that
|
||||
produced it. Open a second tab on `about:config` and filter on two prefixes.
|
||||
|
||||
- **`media.peerconnection.*`** are the standard Firefox WebRTC prefs. The one that
|
||||
governs the host state above is `media.peerconnection.ice.obfuscate_host_addresses`:
|
||||
`true` gives you the `.local` name, `false` gives you the raw LAN IP. If
|
||||
`about:webrtc` shows a `192.168.x.x` host, this is the first pref to check.
|
||||
- **`zoom.stealth.webrtc.*`** is where the product exposes its own WebRTC controls,
|
||||
including the egress the synthetic `srflx` is built from and the IPv6 host
|
||||
suppression. These are set per session by the launcher from the proxy you pass, so
|
||||
in normal use you read them here to confirm the wrapper resolved the right exit,
|
||||
rather than editing them by hand.
|
||||
|
||||
The workflow is: change one pref, reload the page that builds the connection, refresh
|
||||
`about:webrtc`, and read the candidate that changed. One switch at a time keeps cause
|
||||
and effect legible, which is the same discipline that makes a bisect a bisect.
|
||||
|
||||
## Driving the same session from Playwright
|
||||
|
||||
The manual read is for exploring. Once you know which candidate line matters, you want
|
||||
it as an assertion that runs every session, and `InvisiblePlaywright` returns a real
|
||||
Playwright `Browser`, so the same code that opens `about:webrtc` can also gather
|
||||
candidates programmatically.
|
||||
|
||||
First, opening the built-in page under a seeded, proxied session so you can eyeball it:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
PROXY = {"server": "socks5://gate.example.com:1080", "username": "u", "password": "p"}
|
||||
|
||||
with InvisiblePlaywright(seed=42, proxy=PROXY) as browser:
|
||||
page = browser.new_page()
|
||||
# A peer connection has to exist before about:webrtc has anything to show.
|
||||
page.goto("https://example.com")
|
||||
page.evaluate("new RTCPeerConnection().createDataChannel('x')")
|
||||
|
||||
inspector = browser.new_page()
|
||||
inspector.goto("about:webrtc")
|
||||
print("Expand the session to read candidates + the gathering timeline")
|
||||
inspector.wait_for_timeout(3000)
|
||||
```
|
||||
|
||||
Then the same read as data, so a wrong candidate fails a check instead of a session.
|
||||
This gathers the candidate strings the page itself would list and prints them:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
PROXY = {"server": "socks5://gate.example.com:1080", "username": "u", "password": "p"}
|
||||
|
||||
GATHER = """
|
||||
async () => {
|
||||
const pc = new RTCPeerConnection();
|
||||
pc.createDataChannel("probe");
|
||||
const lines = [];
|
||||
pc.onicecandidate = (e) => { if (e.candidate) lines.push(e.candidate.candidate); };
|
||||
await pc.setLocalDescription(await pc.createOffer());
|
||||
await new Promise((r) => setTimeout(r, 3000));
|
||||
pc.close();
|
||||
return lines;
|
||||
}
|
||||
"""
|
||||
|
||||
with InvisiblePlaywright(seed=42, proxy=PROXY) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
candidates = page.evaluate(GATHER)
|
||||
|
||||
host = [c for c in candidates if "typ host" in c]
|
||||
srflx = [c for c in candidates if "typ srflx" in c]
|
||||
|
||||
for c in candidates:
|
||||
print(c)
|
||||
|
||||
# Assert the positive shape, not the absence of a leak.
|
||||
assert host and all(".local" in c for c in host), "host must be an mDNS .local name"
|
||||
assert srflx, "a proxied session must still produce a server-reflexive candidate"
|
||||
assert not any(
|
||||
p in c for c in host for p in ("192.168.", "10.", "172.16.")
|
||||
), "no raw LAN address on a host line"
|
||||
```
|
||||
|
||||
Because the identity is seed-derived, `seed=42` gives the same session every run, so a
|
||||
candidate that fails this on one run fails it on the next, and you can [replay the
|
||||
exact browser that produced it](quickstart.md) instead of chasing a random draw.
|
||||
|
||||
## A before-and-after you can measure
|
||||
|
||||
The distinction is not theoretical. With host obfuscation off, a leak page reports the
|
||||
host candidate as the real LAN address and shows the red "WebRTC exposes your Local IP"
|
||||
warning; the same page on the shipped baseline reports "No Leak" with the local IP as
|
||||
"-", because the host line is now a `<uuid>.local` name and the only routable address
|
||||
on the page is the proxy egress on the `srflx` line. Same session, one pref, and the
|
||||
difference is the whole point of reading candidates instead of badges.
|
||||
|
||||
Assert the presence of the right candidate, not the absence of a wrong one. A WebRTC
|
||||
section that comes back empty passes every "no leak" test and is itself a signal, which
|
||||
is the same false pass that a [verdict-based test hides and a field comparison
|
||||
catches](how-to-test-bot-detection.md).
|
||||
|
||||
## Conclusion
|
||||
|
||||
`about:webrtc` turns WebRTC from a badge into a list you can read. It shows the host
|
||||
candidate so you can confirm it is a `.local` name and not a raw LAN IP, the
|
||||
server-reflexive candidate so you can confirm it is your proxy egress with a plausible
|
||||
port and priority, and the gathering timeline so you can confirm the answers arrived
|
||||
the way a browser produces them rather than instantly. Pair it with `about:config` to
|
||||
see the switches behind each line, drive the same read from Playwright to make it a
|
||||
test, and change one pref at a time so every difference has a cause.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What is about:webrtc for?** It is Firefox's built-in inspector for live peer
|
||||
connections: the full ICE candidate list, each candidate's type and address and
|
||||
priority, and the gathering timeline. It shows the detail a leak site summarises away.
|
||||
|
||||
**Why is my host candidate a 192.168 address?** Host-address obfuscation is off. A
|
||||
stock Firefox emits a `<uuid>.local` name instead, and a raw LAN address is a real
|
||||
leak. Check `media.peerconnection.ice.obfuscate_host_addresses` in `about:config`.
|
||||
|
||||
**What should the srflx candidate show behind a proxy?** Your proxy egress address,
|
||||
with a NAT-range port and a realistic priority. Not your real public IP, not a private
|
||||
address, and not a suspiciously round priority value.
|
||||
|
||||
**A leak site says "No Leak" but I still get flagged. Why?** "No Leak" can mean the
|
||||
candidates are correct, or it can mean WebRTC was suppressed and gathered nothing,
|
||||
which is itself detectable. The candidate list tells you which; the badge does not.
|
||||
|
||||
**Can I read about:webrtc from Playwright?** You can navigate to it with `page.goto`,
|
||||
and you can gather the same candidate strings programmatically with `page.evaluate`
|
||||
over a real [`RTCPeerConnection`](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection),
|
||||
which turns the manual read into an assertion.
|
||||
|
||||
**Why does an empty WebRTC section count as a failure?** Because a real browser behind
|
||||
NAT always emits at least a host and a server-reflexive candidate. Emitting nothing is
|
||||
not neutral; it is a shape no ordinary browser has, so assert presence, not absence.
|
||||
|
||||
## Sources
|
||||
|
||||
- Firefox's built-in `about:webrtc` and `about:config` pages, read directly rather
|
||||
than through a third-party summary.
|
||||
- This project's WebRTC release gates and their per-event diagnostics, including the
|
||||
incident where a negative-only check passed a fully blocked WebRTC section behind a
|
||||
proxy, and the host-obfuscation fix that moved the host line from a raw LAN IP to a
|
||||
`.local` name.
|
||||
|
||||
**See also:** [what actually leaks through a proxy](webrtc-leak-proxy.md),
|
||||
[the srflx fields beyond the address](webrtc-ice-candidate-spoofing.md), and
|
||||
[everything that has to agree with your exit IP](timezone-proxy-mismatch.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. Every candidate line in
|
||||
this page is one I have read off about:webrtc while chasing a leak that a badge missed.*
|
||||
@@ -0,0 +1,233 @@
|
||||
---
|
||||
title: "Do accelerometer and gyroscope APIs leak on desktop?"
|
||||
description: "Desktop Firefox doesn't leak sensor data. Why a spoofed desktop must never invent motion events, and how to verify the sensor surface matches your platform claim."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 32
|
||||
---
|
||||
|
||||
|
||||
# Do accelerometer and gyroscope APIs leak on desktop?
|
||||
|
||||
Short version: on a real desktop Firefox they do not leak, because there is
|
||||
nothing to leak. The generic Sensor APIs that expose an accelerometer or a
|
||||
gyroscope reading are a Chromium feature, and the older DeviceOrientation and
|
||||
DeviceMotion events stay silent on a machine with no motion hardware. So the
|
||||
interesting question is not "how do I hide my sensors" - it is "am I sure my
|
||||
automated desktop is not inventing motion data a real desktop would never
|
||||
produce". A desktop that emits accelerometer or gyroscope readings is a
|
||||
mobile-or-fake tell, and it contradicts the platform string sitting right next
|
||||
to it.
|
||||
|
||||
This page walks through what a genuine desktop exposes, why faking motion is a
|
||||
consistency failure rather than a clever disguise, what the patched build
|
||||
reports, and how to check the surface yourself.
|
||||
|
||||
## What desktop Firefox actually exposes
|
||||
|
||||
Desktop Firefox exposes almost nothing on this surface: the generic Sensor
|
||||
API is absent entirely, and the older DeviceMotion/DeviceOrientation events
|
||||
exist as properties but never fire without motion hardware. Those are the two
|
||||
separate families of device-motion API, and they behave very differently
|
||||
across engines.
|
||||
|
||||
The **generic Sensor APIs** - [`Accelerometer`](https://developer.mozilla.org/en-US/docs/Web/API/Accelerometer),
|
||||
[`Gyroscope`](https://developer.mozilla.org/en-US/docs/Web/API/Gyroscope),
|
||||
`LinearAccelerationSensor`, `AbsoluteOrientationSensor` and the rest of that
|
||||
family - are implemented in Chromium and, at time of writing, not in Firefox at
|
||||
all. On a real Firefox, `typeof Accelerometer` is `"undefined"`. A page that
|
||||
tries `new Gyroscope()` gets a `ReferenceError`. This is not a stealth trick;
|
||||
it is simply what the engine ships.
|
||||
|
||||
The **[DeviceOrientation and DeviceMotion](https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent) events** - `window.ondeviceorientation`,
|
||||
`window.ondevicemotion` - do exist as properties in Firefox, because they are
|
||||
part of an older, more widely shipped spec. But existing as a property is not
|
||||
the same as firing. On a desktop with no accelerometer and no gyroscope, you can
|
||||
add a `devicemotion` listener and it will never be called. The event surface is
|
||||
present; the data behind it is silent.
|
||||
|
||||
So a truthful desktop Firefox answers the sensor question three ways at once:
|
||||
the generic Sensor constructors are absent, the motion event handlers exist but
|
||||
never fire, and `DeviceMotionEvent.requestPermission` (the iOS gesture gate) is
|
||||
also absent because it is a mobile Safari construct. All three of those agree
|
||||
with each other and with a `navigator.platform` of `Win32`.
|
||||
|
||||
## Why a desktop that emits motion is a tell
|
||||
|
||||
The failure mode here is not "a detector reads your accelerometer". It is a
|
||||
detector noticing that your accelerometer exists at all when your platform says
|
||||
it should not.
|
||||
|
||||
Detection on this surface is a cross-check, the same shape as every other
|
||||
consistency check. A page reads `navigator.platform`, `navigator.userAgent` and
|
||||
`navigator.oscpu`, decides you are claiming a Windows desktop, and then asks a
|
||||
question a Windows desktop has a known answer to: does `window.DeviceMotionEvent`
|
||||
ever produce a non-null reading? A desktop says no. If yours says yes - if some
|
||||
well-meaning spoof layer decided to synthesize plausible-looking motion so the
|
||||
sensor "would not look dead" - you have just told the page you are a phone
|
||||
wearing a desktop user agent, which is a contradiction no real device produces.
|
||||
|
||||
This is why the honest move is silence, not simulation. The instinct to fill
|
||||
every surface with realistic data is exactly wrong here: on a desktop the
|
||||
realistic data is no data. The values that have to agree are your platform, your
|
||||
oscpu, your touch surface and your motion surface, and they agree by all
|
||||
pointing at the same kind of machine. If you want the platform side of that
|
||||
in depth, see
|
||||
[keeping navigator.platform and oscpu consistent](navigator-platform-oscpu-consistency.md);
|
||||
the closely related touch side, where a desktop must report zero touch points,
|
||||
is in [maxTouchPoints and pointer type](navigator-maxtouchpoints-pointer.md).
|
||||
|
||||
The general rule, which shows up on every fingerprint surface: a suppressed or
|
||||
absent signal is not automatically a red flag. It is a red flag only when it
|
||||
disagrees with what you claim to be. A desktop with no motion sensor is
|
||||
correct. A mobile user agent with no motion sensor is the tell.
|
||||
|
||||
## What the patched build reports
|
||||
|
||||
invisible_playwright is a real Firefox patched at the C++ level and driven by
|
||||
stock Playwright. On the sensor surface its job is the easy kind: report exactly
|
||||
what a real Windows Firefox reports, which is silence. The generic Sensor
|
||||
constructors stay absent, the DeviceMotion and DeviceOrientation handlers exist
|
||||
but never fire, and nothing invents a reading to fill the gap. Because the whole
|
||||
identity is seed-derived, the platform string, the oscpu string, the touch
|
||||
surface and this motion surface all come from one coherent machine rather than
|
||||
from four independent guesses, so they agree by construction.
|
||||
|
||||
That is the point of the demonstration below. There is nothing to configure and
|
||||
no sensor flag to set - the correct desktop behaviour is the default, and the
|
||||
launch is the ordinary two lines.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
|
||||
report = page.evaluate("""() => {
|
||||
const motionFired = [];
|
||||
window.addEventListener('devicemotion', e => motionFired.push(e), { once: true });
|
||||
return {
|
||||
platform: navigator.platform,
|
||||
hasAccelerometerCtor: typeof Accelerometer !== 'undefined',
|
||||
hasGyroscopeCtor: typeof Gyroscope !== 'undefined',
|
||||
hasDeviceMotionEvent: 'DeviceMotionEvent' in window,
|
||||
hasRequestPermission:
|
||||
typeof (window.DeviceMotionEvent || {}).requestPermission === 'function',
|
||||
motionEventsSeen: motionFired.length,
|
||||
};
|
||||
}""")
|
||||
|
||||
print(report)
|
||||
# platform: 'Win32'
|
||||
# hasAccelerometerCtor: False <- generic Sensor API is Chromium-only
|
||||
# hasGyroscopeCtor: False
|
||||
# hasDeviceMotionEvent: True <- handler exists...
|
||||
# hasRequestPermission: False <- iOS-only, correctly absent
|
||||
# motionEventsSeen: 0 <- ...but never fires: no motion hardware
|
||||
```
|
||||
|
||||
Pass the same `seed` and the surrounding identity comes back identical every
|
||||
run, so if you are bisecting a block you are changing one thing at a time rather
|
||||
than chasing a fresh random machine on each attempt.
|
||||
|
||||
## Verify it yourself against a stock browser
|
||||
|
||||
Do not take the output above on faith - the useful test is a diff, not a
|
||||
verdict. Open the same probe in a stock desktop Firefox on the same machine and
|
||||
compare field by field. The two should agree on every line: same absent
|
||||
constructors, same present-but-silent event handlers, same zero motion events.
|
||||
Anything that differs between the automated browser and the stock one, other
|
||||
than the exit address, is a candidate worth explaining.
|
||||
|
||||
Then extend the same probe to the neighbouring surfaces that have to tell the
|
||||
same story - platform, oscpu, `maxTouchpoints`, screen. A detector reads them
|
||||
together, so you should too. The method for turning that comparison into
|
||||
something trustworthy, including why one green run is not a pass and why an empty
|
||||
result is a failure rather than a clean sheet, is in
|
||||
[how to test bot detection without a false pass](how-to-test-bot-detection.md).
|
||||
For the wider point that a missing signal counts as a signal, the
|
||||
[screen-size and headless tells](screen-size-headless-tells.md) page covers the
|
||||
same idea on a different surface.
|
||||
|
||||
## What this fixes and what it does not
|
||||
|
||||
Matching the sensor surface makes invisible_playwright look like a genuine
|
||||
desktop Firefox on one more axis, and that is real: the fingerprint, the TLS
|
||||
handshake and the driver layer read as an ordinary Firefox, which is why a
|
||||
consistent identity passes most in-page detection. But the sensor surface is a
|
||||
narrow win, and it is worth being blunt about the boundary.
|
||||
|
||||
Reporting the correct silence does nothing for the parts of a session that are
|
||||
not browser properties at all. It does not clean your **IP reputation** - a
|
||||
perfectly consistent desktop on a datacenter or already-flagged address still
|
||||
loses on the address. It does not manage **per-account quotas or rate limits** -
|
||||
those are counted server-side regardless of how real the browser looks. And it
|
||||
does not shape your **behaviour or timing** - a pointer that teleports, a form
|
||||
filled in eighty milliseconds, or an agent that pauses in a shape that looks
|
||||
like model latency will be flagged no matter how honest the sensor readings are.
|
||||
Those are yours to supply: a clean residential exit and human pacing. If your
|
||||
fingerprint is clean and you are still blocked, that separation is the whole
|
||||
subject of [why you can be blocked with a clean fingerprint](why-blocked-with-a-clean-fingerprint.md).
|
||||
|
||||
So the honest framing: device-sensor consistency is one correct answer among
|
||||
many, it costs you nothing here because the default is already right, and it is
|
||||
necessary but nowhere near sufficient on its own.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Accelerometer and gyroscope do not leak on desktop Firefox because desktop
|
||||
Firefox has nothing to report: the generic Sensor APIs are Chromium-only, and
|
||||
the motion events exist as handlers that never fire. The mistake to avoid is
|
||||
over-correction - synthesizing motion data so the surface "does not look dead"
|
||||
turns a correct silence into a contradiction with your platform string. The
|
||||
patched build reports the same silence a real Windows Firefox does, keeps it
|
||||
coherent with platform, oscpu and the touch surface because they all derive from
|
||||
one seed, and leaves the parts it cannot touch - address, quotas, behaviour -
|
||||
clearly labelled as yours.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does desktop Firefox expose accelerometer or gyroscope data?** No. The generic
|
||||
Sensor API constructors are Chromium-only and absent in Firefox, and the older
|
||||
DeviceMotion and DeviceOrientation events stay silent with no motion hardware.
|
||||
|
||||
**Is a silent sensor surface a red flag?** Only if it disagrees with what you
|
||||
claim. A desktop with no motion sensor is correct; a mobile user agent with no
|
||||
motion sensor is the tell.
|
||||
|
||||
**Should I fake motion events to look more real on a desktop?** No. That is the
|
||||
one thing that breaks it - a desktop emitting accelerometer or gyroscope
|
||||
readings contradicts its own platform string.
|
||||
|
||||
**Do the DeviceMotion event handlers exist at all in Firefox?** Yes, the
|
||||
`ondevicemotion` and `ondeviceorientation` properties are present, but they never
|
||||
fire without hardware, so a listener is simply never called.
|
||||
|
||||
**Does invisible_playwright need a sensor flag set for this?** No. Reporting the
|
||||
correct desktop silence is the default; there is nothing to configure.
|
||||
|
||||
**Does getting the sensor surface right mean I will not be detected?** No. It
|
||||
helps with fingerprint consistency, not with IP reputation, account quotas, rate
|
||||
limits, or behaviour and timing, which you still have to supply.
|
||||
|
||||
## Sources
|
||||
|
||||
- The generic Sensor APIs (`Accelerometer`, `Gyroscope` and family) as an
|
||||
engine feature present in Chromium and not in Firefox, read from each engine's
|
||||
own behaviour rather than from a summary.
|
||||
- The DeviceOrientation and DeviceMotion event model, and its behaviour on
|
||||
hardware with no motion sensor.
|
||||
- This project's release gates, which compare the patched build's surfaces field
|
||||
by field against a stock desktop Firefox on the same machine.
|
||||
|
||||
**See also:** [navigator.platform and oscpu consistency](navigator-platform-oscpu-consistency.md),
|
||||
[maxTouchpoints and pointer type](navigator-maxtouchpoints-pointer.md), and
|
||||
[why you can be blocked with a clean fingerprint](why-blocked-with-a-clean-fingerprint.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 sensor surface
|
||||
is the easy kind of honest: the correct answer is to report nothing, and the only
|
||||
way to fail is to invent data a real desktop would never send.*
|
||||
@@ -0,0 +1,223 @@
|
||||
---
|
||||
title: "Accept-Language header vs navigator.languages"
|
||||
description: "Accept-Language and navigator.languages must agree: one Firefox pref feeds both, so an injection-only spoof that moves one and not the other is a clear tell."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 21
|
||||
---
|
||||
|
||||
|
||||
# Accept-Language header vs navigator.languages
|
||||
|
||||
A real browser reports its preferred languages in two completely separate places. It
|
||||
sends an `Accept-Language` header on every HTTP request, decided by the network stack
|
||||
before any page runs. And it exposes `navigator.language` and `navigator.languages` to
|
||||
JavaScript, read from the page after it loads. Two surfaces, two code paths, and a
|
||||
detector that reads both expects them to tell the same story.
|
||||
|
||||
They do, in a stock browser, because both come from one setting. The interesting failure
|
||||
is what happens when a stealth layer touches only one of them.
|
||||
|
||||
## One preference feeds both surfaces
|
||||
|
||||
In Firefox the language preference lives in a single about:config string,
|
||||
`intl.accept_languages`, with a value like `en-US,en`. That one string is the source for
|
||||
two different consumers:
|
||||
|
||||
- The **network stack** formats it into the `Accept-Language` request header, adding the
|
||||
quality values (`en-US,en;q=0.5`) a browser normally attaches.
|
||||
- The **JavaScript engine** parses the same string into the `navigator.languages` array
|
||||
and its first element into `navigator.language`.
|
||||
|
||||
Because both read the same preference, they cannot disagree. Change the preference and
|
||||
the header changes and the array changes, together, in the same load. There is no way,
|
||||
inside a genuine browser, to make the header say one thing and the property say another,
|
||||
because there is only one value and both surfaces quote it.
|
||||
|
||||
That single-source property is worth stating plainly, because it is exactly the invariant
|
||||
a naive spoof breaks.
|
||||
|
||||
## Why an injection-only spoof splits the two
|
||||
|
||||
A large class of stealth tooling works by running JavaScript in the page before the
|
||||
site's own code: it redefines `navigator.languages` with `Object.defineProperty`, or it
|
||||
patches the getter. That reaches exactly one of the two surfaces. It can make
|
||||
`navigator.languages` return `["en-US", "en"]` to any script that asks.
|
||||
|
||||
It never touches the header. The `Accept-Language` header was formatted and sent by the
|
||||
network layer, which is compiled C++ and does not read the JavaScript you injected. So
|
||||
the request that fetched the page carried whatever the underlying browser's real
|
||||
preference was, while the property in the page now claims something else.
|
||||
|
||||
The split lines up field by field like this:
|
||||
|
||||
| Surface | Real browser | Injection-only spoof |
|
||||
|---|---|---|
|
||||
| `Accept-Language` header | formatted from the language preference | unchanged real value (sent by the network layer) |
|
||||
| `navigator.languages` | parsed from the same preference | overridden in the page |
|
||||
| Do the two agree? | yes, one shared source | no, they diverge |
|
||||
|
||||
A detector does not need to be clever to catch this. It reads the `Accept-Language` it
|
||||
received on the request, reads `navigator.languages` from a script it served, and
|
||||
compares the two strings. When the header says one language set and the property says
|
||||
another, that contradiction is the tell. It is the same shape of mistake as
|
||||
[running two spoofers that answer the same question differently](playwright-detected-as-bot.md):
|
||||
one value moves, its twin does not, and the gap between them is louder than either value
|
||||
alone.
|
||||
|
||||
The same reasoning extends to the request headers a browser sends about itself, which is
|
||||
why [the Sec-Fetch and client-hint headers](client-hints-sec-fetch.md) have to line up
|
||||
with the rest of the identity for the same structural reason: a header the page cannot
|
||||
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
|
||||
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
|
||||
always are.
|
||||
|
||||
The code that drives it is stock Playwright. Switching a normal Playwright script over is
|
||||
the launch line and nothing else:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
langs = page.evaluate("navigator.languages")
|
||||
print("navigator.languages =", langs)
|
||||
```
|
||||
|
||||
The `browser` returned is a real Playwright `Browser`, so every method you already use
|
||||
works unchanged. The seed makes the whole identity reproducible: the same seed yields the
|
||||
same language set, the same GPU, the same screen, run after run, which is what lets a
|
||||
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
|
||||
`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
|
||||
particular server:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
|
||||
sent_header = {}
|
||||
def capture(request):
|
||||
if "accept-language" in request.headers:
|
||||
sent_header["value"] = request.headers["accept-language"]
|
||||
page.on("request", capture)
|
||||
|
||||
page.goto("https://example.com")
|
||||
|
||||
header = sent_header.get("value", "")
|
||||
array = page.evaluate("navigator.languages")
|
||||
|
||||
print("Accept-Language header :", header)
|
||||
print("navigator.languages :", array)
|
||||
|
||||
# The header's primary tag and the array's first entry must be the same language.
|
||||
header_primary = header.split(",")[0].split(";")[0].strip()
|
||||
assert header_primary == array[0], (header_primary, array[0])
|
||||
print("header and property agree")
|
||||
```
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
## Match the language to the exit, the same way you match the timezone
|
||||
|
||||
Header and property agreeing with each other is necessary but not sufficient. Both of
|
||||
them also have to agree with where the request appears to come from.
|
||||
|
||||
A session whose exit address resolves to one country while the browser advertises the
|
||||
language of another is a contradiction of the same family as
|
||||
[a timezone that does not match the proxy](timezone-proxy-mismatch.md). The two values
|
||||
are individually plausible and jointly wrong, which is precisely what field-by-field
|
||||
comparison catches and a single-value check does not. If you
|
||||
[rotate through several exits](how-to-rotate-proxies-playwright.md), the language set is
|
||||
one more field that should track the exit rather than staying pinned to whatever the host
|
||||
machine happens to prefer. Pass the proxy at launch and let the identity be built to fit
|
||||
it, rather than setting the language by hand and hoping it lines up:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
proxy = {"server": "socks5://gate.example.com:1080", "username": "u", "password": "p"}
|
||||
|
||||
with InvisiblePlaywright(seed=42, proxy=proxy) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
print("languages =", page.evaluate("navigator.languages"))
|
||||
```
|
||||
|
||||
## Conclusion
|
||||
|
||||
The `Accept-Language` header and `navigator.languages` are read from one browser
|
||||
preference, so in a genuine browser they cannot diverge. That is the whole reason the
|
||||
pair is worth checking: a stealth layer that lives in the page can move the property and
|
||||
never the header, and the gap it opens is a cleaner signal than any single value. Set the
|
||||
language where the browser itself reads it, keep it consistent with the exit, and verify
|
||||
by comparison rather than assumption.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Do Accept-Language and navigator.languages have to match?** Yes. In a real browser both
|
||||
are formatted from one preference, so a mismatch is a contradiction that only a spoof
|
||||
produces.
|
||||
|
||||
**Why does setting navigator.languages in JavaScript not work?** Because it reaches only
|
||||
the page-facing property. The `Accept-Language` header was already sent by the network
|
||||
layer, which does not read your injected script, so the header still carries the old
|
||||
value.
|
||||
|
||||
**How do I set the browser language in Playwright?** Let the fingerprint layer set the
|
||||
native preference so both surfaces read from it, rather than overriding the property in
|
||||
the page. Here the language comes with the seeded identity.
|
||||
|
||||
**Should the language match the proxy country?** It should be consistent with the exit,
|
||||
the same way the timezone has to be. A language from one continent on an exit in another
|
||||
is a mismatch a detector can pair up.
|
||||
|
||||
**How do I check the two agree?** Capture the `Accept-Language` header the browser sent,
|
||||
read `navigator.languages` from the loaded page, and compare the primary language tag of
|
||||
each. Do it against a stock browser as well.
|
||||
|
||||
**Does the q-value in the header matter?** It should be present. A real browser attaches
|
||||
quality values like `;q=0.5`; a header that is a bare comma list with none is itself
|
||||
slightly unusual.
|
||||
|
||||
## Sources
|
||||
|
||||
- Firefox's `intl.accept_languages` preference, which is the single value both the request
|
||||
header and the `navigator.languages` array are formatted from.
|
||||
- [MDN: `Navigator.languages`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/languages)
|
||||
and [MDN: `navigator.language`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/language),
|
||||
the page-facing properties an injection redefines.
|
||||
- [MDN: the `Accept-Language` request header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Accept-Language),
|
||||
including the quality (`q`) values a browser attaches, sent by the network stack before any page script runs.
|
||||
- This project's own realness gates, which compare request headers against in-page
|
||||
properties field by field rather than reading either in isolation.
|
||||
|
||||
**See also:** [when the timezone does not match the proxy](timezone-proxy-mismatch.md),
|
||||
[when the TLS fingerprint and the user agent disagree](tls-fingerprint-user-agent-mismatch.md),
|
||||
[the checklist for being detected on one site](playwright-detected-as-bot.md), and
|
||||
[how to test whether your browser is detected](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 header and the array
|
||||
come from one preference, which is exactly what an injection-only spoof gets wrong.*
|
||||
@@ -0,0 +1,221 @@
|
||||
---
|
||||
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."
|
||||
parent: "AI Agents and Frameworks"
|
||||
grand_parent: "Guides"
|
||||
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 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.
|
||||
|
||||
## Why an agent makes more traffic than a scraper
|
||||
|
||||
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.*
|
||||
@@ -0,0 +1,229 @@
|
||||
---
|
||||
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."
|
||||
parent: "AI Agents and Frameworks"
|
||||
grand_parent: "Guides"
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
## 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.*
|
||||
@@ -0,0 +1,230 @@
|
||||
---
|
||||
title: "AI browser agents and stealth: what fits and what does not"
|
||||
description: "Most AI browser agents drive Chromium over CDP, so a stealth Firefox does not drop in. What each tool exposes, checked from source, and what applies regardless."
|
||||
parent: "AI Agents and Frameworks"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 1
|
||||
---
|
||||
|
||||
|
||||
# AI browser agents and stealth: what fits and what does not
|
||||
|
||||
Most AI browser agents cannot run a stealth Firefox, because they speak the Chrome
|
||||
DevTools Protocol (CDP) and Firefox does not answer it. The few built on Playwright can
|
||||
select Firefox in principle, but rarely expose a custom binary. And on a server the engine
|
||||
is usually not what gets the agent blocked in the first place.
|
||||
|
||||
If your agent works on your laptop and gets challenge pages on a server, there are two
|
||||
separate questions and they get answered as one. The first is whether you can swap the
|
||||
browser underneath. The second is whether swapping it would fix your problem.
|
||||
|
||||
For most of these tools the first answer is no, for a reason that is structural rather
|
||||
than accidental. The second answer is often no as well, and for a different reason.
|
||||
|
||||
This page is what each project actually exposes, checked by reading its source, the split
|
||||
that decides all of it, what applies no matter which engine you run, the signal specific
|
||||
to agent-driven sessions, and the one route that does accept a different engine.
|
||||
|
||||
## The split that decides everything: CDP or Playwright
|
||||
|
||||
Browser automation divides into two families and the boundary matters more than any
|
||||
configuration option.
|
||||
|
||||
**Tools that speak the Chrome DevTools Protocol** talk directly to a Chromium-family
|
||||
browser. CDP is Chromium's own protocol. Firefox does not implement it in the way these
|
||||
drivers expect, so an `executablePath` pointing at a Firefox build does not produce a
|
||||
working session: the driver would be speaking a language the browser does not answer.
|
||||
|
||||
**Tools built on Playwright** go through an abstraction that already supports
|
||||
[three engines](https://playwright.dev/docs/browsers) - Chromium, Firefox and WebKit.
|
||||
Swapping the binary is then a question of whether the tool exposes the launch option,
|
||||
not of whether the protocol matches.
|
||||
|
||||
Almost every AI browser agent is in the first family. That is a reasonable engineering
|
||||
choice, since CDP gives fine-grained control that agent loops want, and it is also why
|
||||
"can I use a stealth Firefox with my agent" usually has a short answer.
|
||||
|
||||
## What each project actually exposes
|
||||
|
||||
Only two of these five projects expose a custom-binary option, and both expect a Chromium
|
||||
build. The table below is read from each repository on 2026-07-27 and 2026-07-28, with
|
||||
star counts from the same check.
|
||||
|
||||
| Project | Stars | Family | Custom binary | Firefox |
|
||||
|---|---|---|---|---|
|
||||
| browser-use | 107k | CDP, Chrome | `executable_path` on `BrowserProfile` | no |
|
||||
| Stagehand | 24k | CDP, Chromium | `executablePath`, documented | no |
|
||||
| Skyvern | 23k | CDP | not exposed | no |
|
||||
| crawl4ai | 75k | Playwright | **no `executable_path`** | `browser_type="firefox"` |
|
||||
| Maxun | 17k | Playwright | not exposed | not exposed |
|
||||
|
||||
Three others that come up in these searches are not Playwright tools at all:
|
||||
`agent-browser` and `obscura` are written in Rust, and `BrowserOS` has no Playwright
|
||||
dependency in its manifest. Star count does not tell you what a project drives.
|
||||
|
||||
### browser-use
|
||||
|
||||
The configuration is real: `executable_path`, `channel`, `user_data_dir`, `proxy`, `args`
|
||||
and `headless` on `BrowserProfile`. The surrounding code is Chrome executable discovery
|
||||
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
|
||||
used. [The full version is here](browser-use-detection.md).
|
||||
|
||||
### Stagehand
|
||||
|
||||
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.
|
||||
|
||||
So the option exists and it expects a Chromium build.
|
||||
|
||||
### Skyvern
|
||||
|
||||
CDP throughout. There is no exposed way to point at a different binary, and the protocol
|
||||
would not match if there were.
|
||||
|
||||
### crawl4ai
|
||||
|
||||
The only one of these built on Playwright with Firefox genuinely selectable, through
|
||||
`browser_type="firefox"`. What is missing is any field naming a binary, so you get
|
||||
Playwright's managed build. Its own stealth mode applies `playwright-stealth`, which its
|
||||
documentation notes does not support Firefox, so that combination is largely inert.
|
||||
[The full version is here](crawl4ai-stealth-custom-browser.md).
|
||||
|
||||
### 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.
|
||||
|
||||
## What applies regardless of the engine
|
||||
|
||||
Swapping the browser engine changes none of the tells a server leaks, and those tells
|
||||
matter more than the binary question because they are true for every tool, CDP or
|
||||
Playwright. On a server, all of these are true at once and none of them is about
|
||||
automation:
|
||||
|
||||
- **No GPU**, so WebGL reports a software renderer.
|
||||
[What those strings give away](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**, and no speech voices.
|
||||
[The seven audio values](audiocontext-fingerprinting.md) and
|
||||
[the voice list](speech-synthesis-voices.md).
|
||||
- **A screen with no taskbar** and a default resolution.
|
||||
[The relationships that must hold](screen-size-headless-tells.md).
|
||||
- **Codec support** describing a slim build, including whether decoding is hardware
|
||||
accelerated. [Three surfaces in one API](codec-fingerprinting.md).
|
||||
- **A TLS handshake** decided before any of this.
|
||||
[Which nothing above the network stack can reach](ja3-ja4-tls-fingerprint.md).
|
||||
|
||||
Swapping the browser engine does not change a single item on that list. If your agent
|
||||
fails in a container and works on your laptop, this is almost certainly where the
|
||||
difference is, and it is the same for a CDP tool and a Playwright tool.
|
||||
[The container walkthrough](playwright-docker-detection.md) goes through it in order.
|
||||
|
||||
## The signal that is specific to agents
|
||||
|
||||
One signal no fingerprint work touches is the rhythm of the agent loop itself. An agent
|
||||
thinks between actions: it reads the page, calls a model, waits, then acts. The resulting
|
||||
rhythm has a shape no person produces.
|
||||
|
||||
- Long pauses clustered around **model latency** rather than around reading speed.
|
||||
- **No movement during the pause.** A person drifts, scrolls slightly, hovers. An agent's
|
||||
pointer is motionless for two seconds and then arrives.
|
||||
- Actions landing **dead centre** on targets, because coordinates come from an
|
||||
accessibility tree rather than from a hand.
|
||||
- **No wasted actions.** People hover over things they do not click and change their
|
||||
minds.
|
||||
|
||||
This explains blocks that arrive **after** a few interactions rather than at first load,
|
||||
and that timing is the cheapest diagnostic you have.
|
||||
[Human-like pointer motion](human-mouse-movement.md) covers what can be done about the
|
||||
mechanical half, and it is honest that the deliberation pattern is a different problem.
|
||||
|
||||
## This stopped being a theoretical concern in 2026
|
||||
|
||||
Agent-driven browsing used to be rare enough that most detection stacks didn't bother
|
||||
building a dedicated signal for it. That changed this year. Fingerprint, the
|
||||
commercial fingerprinting vendor behind FingerprintJS, shipped a product in early
|
||||
2026 specifically aimed at classifying AI agent traffic - not bot detection in
|
||||
general, agent detection as its own category, with its own signal set. Academic
|
||||
research published in the same period has been measuring the same target directly:
|
||||
building multi-layer fingerprints specifically to separate an LLM-driven browsing
|
||||
session from a human one, using exactly the rhythm-based signals described above
|
||||
plus whatever else the page surface gives away.
|
||||
|
||||
The practical upshot for anyone running an agent against a real site: the timing
|
||||
and pointer-behavior signal in the previous section is not a corner case anymore.
|
||||
It is an active, funded area of detection work, aimed specifically at the traffic
|
||||
pattern an agent loop produces, independent of whatever engine sits underneath it.
|
||||
Fixing the browser's fingerprint and fixing the agent's behavior are now both live
|
||||
requirements, not one obvious fix and one theoretical afterthought.
|
||||
|
||||
## The route that does accept a different engine
|
||||
|
||||
If you want an engine whose fingerprint is set in its own source and you want an agent to
|
||||
drive it, the working combination today is MCP rather than CDP.
|
||||
|
||||
Microsoft's `playwright-mcp` accepts a browser and an executable path and speaks MCP, so
|
||||
any agent framework that talks MCP can drive a patched Firefox through it.
|
||||
[That integration is written up here](integrations/playwright-mcp.md).
|
||||
|
||||
The trade is explicit: you give up the agent loop of whichever framework you were using
|
||||
and get an engine-level fingerprint. Whether that is worth it depends on which of the two
|
||||
problems at the top of this page you actually have.
|
||||
|
||||
## Conclusion
|
||||
|
||||
The honest summary is that the agent ecosystem standardised on CDP, and CDP means
|
||||
Chromium. A Firefox engine does not drop into browser-use, Stagehand or Skyvern, and
|
||||
crawl4ai is one missing field away rather than one protocol away.
|
||||
|
||||
More importantly, for most people the engine is not the binding constraint. The container
|
||||
is. Every item in the machine list above is true whichever tool you picked, and none of
|
||||
them is fixed by a stealth setting inside it.
|
||||
|
||||
Work out which problem you have first: a block at the first request points at the machine
|
||||
or the address, and a block after several actions points at behaviour.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can I use a stealth Firefox with browser-use?** No. It drives Chrome over CDP.
|
||||
|
||||
**Does Stagehand support a custom browser?** Yes, `executablePath`, and it expects a
|
||||
Chromium build.
|
||||
|
||||
**Can crawl4ai use a patched engine?** Not through configuration. It accepts
|
||||
`browser_type="firefox"` but has no field naming a binary.
|
||||
|
||||
**Why does my agent work locally and fail in Docker?** Because the container answers
|
||||
differently about the GPU, the fonts, the audio device and the screen. The agent is
|
||||
identical.
|
||||
|
||||
**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.
|
||||
|
||||
**See also:** [browser-use in detail](browser-use-detection.md),
|
||||
[crawl4ai in detail](crawl4ai-stealth-custom-browser.md),
|
||||
[Playwright MCP](integrations/playwright-mcp.md), and
|
||||
[the checklist for being detected on one site](playwright-detected-as-bot.md).
|
||||
|
||||
## Sources
|
||||
|
||||
- `browser_use/browser/profile.py` and `chrome.py`; Stagehand's
|
||||
`packages/core/lib/v3/launch/local.ts` and its browser configuration docs; Skyvern's
|
||||
CDP client; `crawl4ai/async_configs.py`; Maxun's package manifest. All read
|
||||
2026-07-27 and 2026-07-28.
|
||||
- Star counts from the GitHub API on the same dates.
|
||||
- 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 exists because eight separate articles all
|
||||
concluding "does not fit" would have been worse for you than one that says why.*
|
||||
@@ -0,0 +1,211 @@
|
||||
---
|
||||
title: "What is ASN and IP reputation in bot detection?"
|
||||
description: "What ASN and IP reputation are: how they score requests before JavaScript runs, how reputation builds and decays, and why a clean browser on a burned IP loses."
|
||||
parent: "Network, Proxy and WebRTC"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 23
|
||||
---
|
||||
|
||||
|
||||
# What is ASN and IP reputation in bot detection?
|
||||
|
||||
An ASN identifies which network operator an address belongs to, and IP reputation is the
|
||||
abuse history attached to that address; together they let a detector score a connection
|
||||
before a single line of JavaScript runs. This is the layer a browser cannot touch, and it
|
||||
is why a session with a flawless fingerprint can still be turned away at the door.
|
||||
|
||||
This page explains what an ASN is, how IP reputation gets built and how it decays, why a
|
||||
perfect browser on a flagged block loses anyway, and where the browser's job ends and the
|
||||
proxy's job begins.
|
||||
|
||||
## What an ASN actually is
|
||||
|
||||
An ASN, an [Autonomous System Number](https://datatracker.ietf.org/doc/html/rfc1930),
|
||||
identifies the network operator that announces a block of IP addresses to the rest of the
|
||||
internet. A residential internet provider has one or more ASNs. A cloud host has its own.
|
||||
When a connection reaches a server, the server can look up the address and learn, in a
|
||||
single query, which operator it belongs to and what kind of operator that is.
|
||||
|
||||
That last part is the point. ASNs carry a category. A range that belongs to a consumer
|
||||
internet provider looks like a person at home. A range that belongs to a hosting company
|
||||
or a cloud region looks like a server, because that is what almost everything in it is.
|
||||
The lookup is cheap, it happens at the very first packet, and it does not care in the
|
||||
slightest what browser you plan to run. A datacenter ASN is a strong prior on its own:
|
||||
real customers rarely browse a shopping site from a cloud region, so a request from one
|
||||
starts the session already suspected. This is covered in more depth in
|
||||
[can websites detect a datacenter or proxy IP](can-websites-detect-a-datacenter-proxy-ip.md),
|
||||
and the short version is that they can, directly, at the network layer.
|
||||
|
||||
## How IP reputation is built and how it decays
|
||||
|
||||
The ASN category is the coarse signal. Reputation is the fine one, and it is per-address
|
||||
and per-block rather than per-operator.
|
||||
|
||||
A reputation service records what addresses have done. If a particular IP, or the /24
|
||||
block around it, has recently been the source of credential-stuffing traffic, scraping
|
||||
runs, spam, or a burst of failed logins, that history attaches to the address. It is
|
||||
shared: the block was burned by whoever used it before you, and you inherit the score. A
|
||||
single address can also burn itself inside one session, purely by volume. If one IP opens
|
||||
several hundred sessions against the same endpoint in an hour, that velocity is itself the
|
||||
signal, independent of how human each individual session looks.
|
||||
|
||||
Reputation decays, but slowly and unevenly. An address that sat quiet for a long stretch
|
||||
recovers some standing. An address that is being actively abused right now does not, and
|
||||
the decay resets every time the block is used again. This is why a cheap shared proxy
|
||||
never really recovers: the moment its score drifts back toward neutral, the next user on
|
||||
the same block drives it back down. You are not renting a clean address, you are renting a
|
||||
position in a queue of people degrading it.
|
||||
|
||||
Three inputs, then, all read before the browser matters: the ASN's category, the block's
|
||||
abuse history, and the live session count from that address.
|
||||
|
||||
## Why a perfect fingerprint on a burned block still loses
|
||||
|
||||
A perfect fingerprint on a burned block still loses because a detector scores the network
|
||||
layer and the fingerprint layer independently, and a flawless browser can only zero out the
|
||||
second one - it has no way to reach the first.
|
||||
|
||||
invisible_playwright is designed to look like a real browser driven by a real person. The
|
||||
fingerprint is coherent, the TLS handshake belongs to a genuine Firefox, and the driver
|
||||
layer does not announce automation. That is why it passes most detection checks: the parts
|
||||
a browser controls, it controls well. What it cannot do is change the address the
|
||||
connection arrives on. A coherent browser on a burned IP is still on a burned IP.
|
||||
|
||||
The two layers are scored independently and both have to be right. Picture a detector as
|
||||
adding up evidence. The network layer contributes its verdict, a datacenter ASN or a block
|
||||
with recent abuse, before any script runs. The fingerprint layer contributes its verdict
|
||||
after. A perfect browser sets the second contribution to roughly zero, which is exactly
|
||||
what you want, but it cannot make the first contribution negative. If the network layer
|
||||
alone crosses the threshold, the session is challenged or blocked no matter how clean
|
||||
everything downstream reads. This is the mechanism behind
|
||||
[being blocked with a clean fingerprint](why-blocked-with-a-clean-fingerprint.md): nothing
|
||||
is wrong with the browser, and the browser was never the thing that failed.
|
||||
|
||||
You can prove which layer you are hitting in about a minute. Open the same URL by hand,
|
||||
from the same machine and the same exit, in a stock browser. If the manual visit is also
|
||||
challenged, the browser is not your problem and no fingerprint change will help. If the
|
||||
manual visit passes and the automated one does not, the difference is in the browser or
|
||||
the behaviour, and that is a different investigation entirely.
|
||||
|
||||
## Where the browser ends and the proxy begins
|
||||
|
||||
The division of labour is clean, and being clear about it saves a lot of wasted effort.
|
||||
|
||||
The browser's job is everything the server reads after the connection is established: the
|
||||
fingerprint fields, the TLS handshake, the absence of automation tells, the driver layer.
|
||||
invisible_playwright handles those from one seed, reproducibly. Your job, the part the
|
||||
browser cannot do for you, is three things it has no access to.
|
||||
|
||||
- **A clean exit.** An address on a consumer ASN, on a block without recent abuse, not
|
||||
already shared by a crowd. Around 90% of proxy addresses are public and therefore
|
||||
already known and scored before you send a byte through them. The clean fraction is the
|
||||
part worth paying for.
|
||||
- **Human pacing.** Session count per address is a reputation input, so hundreds of
|
||||
sessions from one IP burns it regardless of browser quality. Spread the work across
|
||||
addresses and across time.
|
||||
- **Behaviour and quotas.** Per-account limits, rate limits, and the timing of your
|
||||
actions are yours to supply. The browser looks human; whether it acts human is up to
|
||||
the code driving it.
|
||||
|
||||
One more thing that is genuinely the browser's job and is easy to mistake for a network
|
||||
problem: the browser and the exit have to tell the same story. An exit in one country
|
||||
behind a browser claiming another is a contradiction the detector reads directly, and it
|
||||
is cheap to get right. invisible_playwright derives the timezone from the egress IP by
|
||||
default, which is why
|
||||
[a timezone that does not match the proxy](timezone-proxy-mismatch.md) has its own page.
|
||||
|
||||
## A runnable example
|
||||
|
||||
The browser side is two lines. You supply the proxy; the wrapper wires it, routes DNS
|
||||
through it, and derives the timezone from its exit so the browser and the network agree.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
proxy = {
|
||||
"server": "socks5://gate.example.com:1080",
|
||||
"username": "user",
|
||||
"password": "pass",
|
||||
}
|
||||
|
||||
# seed=42 makes the identity reproducible; the proxy is the exit you supply
|
||||
with InvisiblePlaywright(seed=42, proxy=proxy) as browser:
|
||||
page = browser.new_page()
|
||||
# confirm the exit the browser is actually leaving from,
|
||||
# rather than assuming it
|
||||
page.goto("https://example.com/ip")
|
||||
print(page.inner_text("body"))
|
||||
```
|
||||
|
||||
The `browser` object is a real Playwright
|
||||
[`Browser`](https://playwright.dev/python/docs/api/class-browser), so every standard
|
||||
method works exactly as documented upstream. Note what the example does and does not
|
||||
claim: it pins the fingerprint so a failure is reproducible, and it reads back the exit so
|
||||
you know which address your reputation is riding on. It does not make a bad address good.
|
||||
If the printed IP sits on a datacenter ASN or a burned block, the cleanest browser in the
|
||||
world is still leaving from there.
|
||||
|
||||
## Conclusion
|
||||
|
||||
ASN and IP reputation are the part of bot detection that runs before your browser gets a
|
||||
turn. The ASN says what kind of network you are on, the reputation says what that address
|
||||
and its neighbours have been doing, and the session count says how hard you are leaning on
|
||||
it right now. All three are read at connection time, none of them are in a browser's
|
||||
gift to change, and a perfect fingerprint sets its own layer to zero without touching
|
||||
theirs.
|
||||
|
||||
So the honest framing is the useful one. invisible_playwright makes the browser layer look
|
||||
like a real person's real browser, which is most of the battle and the part most tools get
|
||||
wrong. The network layer is yours: a clean exit, human pacing, and quotas you respect. Get
|
||||
both right and the session passes. Get the browser perfect on a burned block and it does
|
||||
not, and now you know exactly why.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What is an ASN in bot detection?** The number identifying the network operator that owns
|
||||
the address you connect from. Detectors read it at the first packet to learn whether you
|
||||
look like a home connection or a datacenter, before any JavaScript runs.
|
||||
|
||||
**Can a good fingerprint fix a bad IP?** No. The two are scored independently. A perfect
|
||||
browser zeroes out its own layer but cannot make a burned or datacenter address look
|
||||
clean, so the session can still be blocked on the network verdict alone.
|
||||
|
||||
**Why does my clean browser still get blocked?** Almost always the exit. Prove it by
|
||||
opening the same URL by hand from the same machine and exit in a stock browser; if that is
|
||||
challenged too, the browser was never the problem.
|
||||
|
||||
**How does an IP get a bad reputation?** From abuse history on the address or its block,
|
||||
inherited from whoever used it before you, plus live session volume. Shared cheap proxies
|
||||
never recover because the next user re-burns the block as it decays.
|
||||
|
||||
**Does invisible_playwright give me a clean IP?** No, and it does not claim to. It handles
|
||||
the browser fingerprint, TLS and driver layers. You supply the proxy, the pacing and the
|
||||
quotas; the browser cannot change the address it arrives on.
|
||||
|
||||
**How many sessions can one IP make?** Fewer than you would like, because session count is
|
||||
itself a reputation input. Hundreds of sessions from one address burns it regardless of
|
||||
how human each session looks. Spread across addresses and across time.
|
||||
|
||||
## Sources
|
||||
|
||||
- [RFC 1930](https://datatracker.ietf.org/doc/html/rfc1930), the IETF guidelines that
|
||||
define an Autonomous System as a routing policy unit and specify the ASN that identifies
|
||||
it.
|
||||
- [Playwright's `Browser` class reference](https://playwright.dev/python/docs/api/class-browser),
|
||||
for what a launched `Browser` object exposes once the wrapper hands it back.
|
||||
- This project's release and validation gates, which test the browser layer through a real
|
||||
proxy and confirm the exit address inside the browser rather than assuming it.
|
||||
- The network-layer behaviour described here is read from public reputation and ASN-lookup
|
||||
mechanics, cross-checked against the browser layer this project controls.
|
||||
|
||||
**See also:** [can websites detect a datacenter or proxy IP](can-websites-detect-a-datacenter-proxy-ip.md)
|
||||
for the network layer in detail, [browser trust scores explained](browser-trust-score-explained.md)
|
||||
for how the fingerprint layer is scored separately, and
|
||||
[why you can be blocked with a clean fingerprint](why-blocked-with-a-clean-fingerprint.md)
|
||||
when every browser check comes back green.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The browser layer is the
|
||||
part we can make perfect; the IP is the part only you can keep clean.*
|
||||
@@ -0,0 +1,192 @@
|
||||
---
|
||||
title: "AudioContext fingerprinting, and why adding noise backfired"
|
||||
description: "AudioContext fingerprinting is usually beaten with noise. We shipped that defence, measured it, and it made sessions easier to detect. The seven values and why."
|
||||
parent: "Canvas, WebGL, Fonts and Audio"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 8
|
||||
---
|
||||
|
||||
|
||||
# AudioContext fingerprinting, and why adding noise backfired
|
||||
|
||||
Audio fingerprinting has a reputation for being hard to defeat. It deserves it, but
|
||||
not for the reason usually given.
|
||||
|
||||
The usual reason is that the audio pipeline is low-level and mathematically involved.
|
||||
The real reason is simpler and more annoying: **the obvious defence makes you easier
|
||||
to detect, not harder.** We shipped that defence, measured it, and turned it off. This
|
||||
page is what the measurements said.
|
||||
|
||||
## What is actually being measured
|
||||
|
||||
Audio fingerprinting collects seven values from the [Web Audio
|
||||
API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API), a rendered
|
||||
sample buffer plus six device and analyser readings, and checks that they agree with
|
||||
each other. Almost every guide stops at "it hashes how your device processes sound",
|
||||
which is true and useless. Here is the concrete shape.
|
||||
|
||||
A fingerprinting script builds a short offline audio graph, usually an oscillator into
|
||||
a dynamics compressor, renders it without playing anything, and reads the resulting
|
||||
samples back:
|
||||
|
||||
```js
|
||||
const ctx = new OfflineAudioContext(1, 44100, 44100);
|
||||
const osc = ctx.createOscillator();
|
||||
const comp = ctx.createDynamicsCompressor();
|
||||
osc.connect(comp); comp.connect(ctx.destination);
|
||||
osc.start(0); ctx.startRendering();
|
||||
// then: sum the rendered samples, hash the sum
|
||||
```
|
||||
|
||||
But the rendered buffer is only one of the values collected. The full set is wider
|
||||
than people expect, and this matters because they have to agree with each other:
|
||||
|
||||
| Value | What it is |
|
||||
|---|---|
|
||||
| `AudioContext.sampleRate` | 44100 or 48000, from the audio device |
|
||||
| `AudioContext.outputLatency` | the driver's reported latency |
|
||||
| `AudioContext.destination.maxChannelCount` | stereo, 5.1, whatever the device has |
|
||||
| the rendered sample sum | the oscillator-compressor output |
|
||||
| `AnalyserNode` frequency data sum | the same graph seen through an FFT |
|
||||
| `AnalyserNode` time domain data sum | the same graph in amplitude |
|
||||
| `DynamicsCompressorNode.reduction` | one float, the applied gain reduction |
|
||||
|
||||
Seven values, one machine. A profile claiming a 5.1 sound card with a laptop's latency
|
||||
and a rendered buffer that belongs to neither is caught by comparison, and no
|
||||
individual value in it is unusual.
|
||||
|
||||
## The mistake: noise that gets asked about twice
|
||||
|
||||
The intuitive defence is the canvas one: add a small amount of noise to the rendered
|
||||
samples so the hash differs per session. We implemented exactly that, seeded so the
|
||||
same identity always produced the same audio.
|
||||
|
||||
Two things went wrong, and the second one is the interesting one.
|
||||
|
||||
### Silence is a trap
|
||||
|
||||
[CreepJS](https://abrahamjuliot.github.io/creepjs/) has a check called
|
||||
`hasFakeAudio`. It does not compare your hash to a database. It builds a buffer that
|
||||
should be **silent**, renders it, and looks at whether anything is in it.
|
||||
|
||||
```js
|
||||
new OfflineAudioContext(1, 100, 44100) // 100 samples, oscillator frequency 0
|
||||
```
|
||||
|
||||
Nothing should come out of that. On real hardware nothing does. A tool adding noise to
|
||||
every rendered buffer puts noise into silence, which is physically impossible, and the
|
||||
check records a lie.
|
||||
|
||||
It also inspects the first 100 samples of a normal buffer and counts distinct values
|
||||
there, for the same reason: the beginning of a render is predictable, so variation
|
||||
there is manufactured.
|
||||
|
||||
The fix is not to stop adding noise, it is to add it only where noise can legitimately
|
||||
exist: skip buffers short enough to be a probe, skip the opening samples, and skip
|
||||
channels that carry no input at all. Noise on a silent channel is not subtle. It is a
|
||||
claim that your sound card produces sound when it is off.
|
||||
|
||||
**The general shape, which is worth more than the specific check:** a detector does not
|
||||
have to recognise your noise. It only has to ask a question whose correct answer is
|
||||
*nothing*, and see whether it gets something.
|
||||
|
||||
### The defence was the signal
|
||||
|
||||
The second problem was not expected: with the noise correctly guarded and passing the
|
||||
silence checks, a commercial fingerprinting service still scored the browser as
|
||||
tampered. We isolated the audio noise with a kill switch and ran it both ways on the
|
||||
same machine and the same identity:
|
||||
|
||||
| Audio noise | tampering score |
|
||||
|---|---|
|
||||
| on | 0.4349 |
|
||||
| off | 0.0564 |
|
||||
|
||||
Nearly an order of magnitude, from one feature. The audio noise was not one
|
||||
contributor among many, it was the dominant one.
|
||||
|
||||
So we ship with it **off**. The un-noised audio output is still host-independent,
|
||||
because the values around it are set from the seed and the render is deterministic, and
|
||||
it matches what a real Firefox on that configuration produces. Turning the noise off
|
||||
did not make sessions linkable: it made them identical to the honest answer, which is
|
||||
what everything else on that machine is claiming anyway.
|
||||
|
||||
That inversion is the lesson worth carrying:
|
||||
|
||||
> A randomised value is not automatically safer than a fixed one. If everyone with a
|
||||
> given browser and OS produces the same audio hash, producing that same hash makes you
|
||||
> one of them. Producing a unique one makes you the only person on the internet whose
|
||||
> sound card is a snowflake.
|
||||
|
||||
Randomising helps where the honest value identifies your specific machine. It hurts
|
||||
where the honest value identifies your *class* of machine, because there the crowd is
|
||||
the disguise.
|
||||
|
||||
## Getting the details right, if you do add noise
|
||||
|
||||
Two things we got wrong on the first attempt and had to measure our way out of.
|
||||
|
||||
**Scale is per-surface.** Frequency data is in decibels, roughly -100 to 0. Time domain
|
||||
data is amplitude, -1 to 1. The same epsilon on both is either invisible on one and
|
||||
enormous on the other. We ended up around `1e-4` for frequency, `1e-7` for time domain,
|
||||
and `1e-5` for the compressor's single reduction float.
|
||||
|
||||
**The noise has to be a function of the seed and the position, not of a random number
|
||||
generator.** If it is random per call, reading the same value twice returns two
|
||||
different answers, and a script that reads it twice is a script anyone can write. Ours
|
||||
hashes the seed together with the channel index and the sample position, so the same
|
||||
identity renders the same buffer forever, and two reads agree.
|
||||
|
||||
That second point is the one that catches most tools. It is easy to check and it is
|
||||
checked.
|
||||
|
||||
## What to look at on your own setup
|
||||
|
||||
```js
|
||||
const ctx = new AudioContext();
|
||||
console.log(ctx.sampleRate, ctx.outputLatency, ctx.destination.maxChannelCount);
|
||||
ctx.close();
|
||||
```
|
||||
|
||||
- **`sampleRate` is 44100 or 48000.** Anything else is rare enough to be interesting.
|
||||
- **The three device values describe one plausible device.** A 5.1 channel count with a
|
||||
laptop latency is two devices in one answer.
|
||||
- **[`outputLatency`](https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/outputLatency)
|
||||
is not zero and not identical across machines.** A container with no sound device is
|
||||
a real tell here, in the same way that [a machine with no GPU is one for
|
||||
WebGL](webgl-renderer-strings.md).
|
||||
- **Read the rendered sum twice in one session.** It must match. If it does not, your
|
||||
noise is per-call, and that is the single cheapest tampering check there is.
|
||||
- **Render a silent buffer and confirm it is silent.**
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can I just disable AudioContext?** You can, and then you have a browser without the
|
||||
Web Audio API, which every real browser has. That is a stronger signal than any hash.
|
||||
|
||||
**Do the privacy extensions that randomise audio work?** They stop the hash being
|
||||
stable, which is what they promise. They also generally randomise per call and put
|
||||
noise in silence, both of which are detectable in one line. Against tracking, they
|
||||
help. Against a system asking whether you are tampering, they are the thing it finds.
|
||||
|
||||
**Is audio fingerprinting stronger than canvas?** It has less entropy on its own. It is
|
||||
harder to fake convincingly, because it is seven values that have to agree plus a
|
||||
render that has to look like it came from the device the other six describe.
|
||||
|
||||
**Why does my audio fingerprint differ between headless and headed?** Usually the audio
|
||||
device. A headless container often has none, so the values fall back to defaults that
|
||||
say so.
|
||||
|
||||
**See also:** [why a FingerprintJS visitor ID changes](fingerprintjs-visitor-id.md),
|
||||
since the audio hash is one of the components that ID is made of,
|
||||
[why headless browsers render different fonts](headless-fonts-differ.md)
|
||||
and [your renderer string says NVIDIA, your pixels say software](renderer-string-vs-render.md),
|
||||
which are the same "the honest answer describes your machine" problem on other
|
||||
surfaces, and [how CreepJS decides you are lying](creepjs-explained.md).
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. The two scores above are our own A/B, on one
|
||||
machine and one identity, with the audio noise as the only variable. The feature they
|
||||
killed was one we wrote.*
|
||||
@@ -0,0 +1,226 @@
|
||||
---
|
||||
title: "AudioContext sampleRate and latency as a fingerprint"
|
||||
description: "AudioContext.sampleRate, outputLatency and maxChannelCount are read from the audio driver, so a headless server leaks. How a seeded browser keeps them coherent."
|
||||
parent: "Canvas, WebGL, Fonts and Audio"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 13
|
||||
---
|
||||
|
||||
|
||||
# AudioContext sampleRate and latency as a fingerprint
|
||||
|
||||
An `AudioContext` fingerprints a machine before it renders a single sample: `sampleRate`,
|
||||
`outputLatency` and `destination.maxChannelCount` are read straight from the operating
|
||||
system's audio driver, so a headless server with no sound hardware answers them with
|
||||
tell-tale defaults. The defence is not to spoof each number, but to return all three as
|
||||
one coherent device profile that a real machine could actually have.
|
||||
|
||||
Most writing about audio fingerprinting is about the rendered buffer: you run an
|
||||
`OfflineAudioContext`, hash the samples it produces, and treat that hash as the signal.
|
||||
That is a real surface and it has [its own page here](audiocontext-fingerprinting.md).
|
||||
|
||||
This page is about the other half, the part that needs no rendering at all. Before a
|
||||
single sample is generated, an `AudioContext` already exposes three plain numbers that
|
||||
come straight from the operating system's audio stack: `sampleRate`, `outputLatency`,
|
||||
and `destination.maxChannelCount`. They are cheaper to read than any buffer hash, they
|
||||
are stable within a session, and on a headless server they are one of the clearest
|
||||
tells that no real sound hardware is present.
|
||||
|
||||
## The three numbers a real audio stack exposes
|
||||
|
||||
Open an `AudioContext` on a normal desktop and read four fields:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
profile = page.evaluate("""() => {
|
||||
const ctx = new AudioContext();
|
||||
const out = {
|
||||
sampleRate: ctx.sampleRate,
|
||||
outputLatency: ctx.outputLatency,
|
||||
baseLatency: ctx.baseLatency,
|
||||
maxChannelCount: ctx.destination.maxChannelCount,
|
||||
};
|
||||
ctx.close();
|
||||
return out;
|
||||
}""")
|
||||
print(profile)
|
||||
```
|
||||
|
||||
Each of those fields is a question to the driver, not to the browser:
|
||||
|
||||
- **`sampleRate`** is the rate the audio device is running at, almost always `44100` or
|
||||
`48000` Hz. It is decided by the sound card and its driver, not by the page.
|
||||
- **`outputLatency`** is roughly how long it takes a sample to travel from the graph to
|
||||
the speaker. It reflects the buffer size the driver negotiated, and it differs between
|
||||
onboard audio, a USB interface, and a surround setup.
|
||||
- **`maxChannelCount`** on the destination node is how many output channels the device
|
||||
can drive: `2` for ordinary stereo, `6` for a 5.1 setup, `8` for 7.1.
|
||||
|
||||
None of these is an automation flag. They are hardware facts, and that is exactly what
|
||||
makes them useful to a detector: JavaScript cannot invent a sound card it does not have.
|
||||
|
||||
## Why the values have to agree with each other
|
||||
|
||||
The trap here is not any single value being unusual. Every one of these numbers, taken
|
||||
alone, is common. The signal is in the combination.
|
||||
|
||||
Real devices come in a small number of shapes. Onboard laptop audio tends to run stereo
|
||||
at 48000 Hz with a modest latency. A cheap USB headset might report 44100 Hz. A discrete
|
||||
sound card feeding a 5.1 receiver reports six channels and a latency in a range that
|
||||
matches a card built for that job. What you never see on real hardware is the
|
||||
cross-product: a `maxChannelCount` of 6 paired with the sample rate and latency of a
|
||||
thin laptop codec, because no such device exists.
|
||||
|
||||
That cross-value contradiction is precisely what a consistency-minded detector looks
|
||||
for, and it is the same class of check that catches a Windows user agent over a Linux
|
||||
font set, or [hardware concurrency and device memory](hardware-concurrency-device-memory.md)
|
||||
that pair oddly with the machine being claimed. A fingerprint is not a list of values,
|
||||
it is a set of relationships, and the relationships are where a naive spoof falls apart.
|
||||
|
||||
## What a headless container reports instead
|
||||
|
||||
Run the same three reads inside a server container with no sound hardware and you get one
|
||||
of two failure shapes, both of them loud.
|
||||
|
||||
The first is a null audio backend: the context comes back with a default sample rate and
|
||||
a latency that is suspiciously round or zero, the same on every container image, because
|
||||
there is no driver underneath negotiating anything. A value that is byte-identical across
|
||||
thousands of visitors is not neutral, it is a cohort.
|
||||
|
||||
The second is worse. Some headless setups fail to construct the context at all, or
|
||||
suspend it immediately, so the page sees a `state` that never reaches `running`. As with
|
||||
every other surface, [an empty or blocked result is itself a signal](how-to-test-bot-detection.md),
|
||||
not a clean pass. A detector that records suppression by name counts the absence against
|
||||
you exactly as it would count a wrong value.
|
||||
|
||||
This is the same reason [an empty speech-voice list](speech-synthesis-voices.md) gives a
|
||||
server away: both audio output and installed voices are reads into the operating system,
|
||||
and a datacenter answers them with defaults that say "datacenter".
|
||||
|
||||
## How this browser keeps the profile coherent
|
||||
|
||||
The fix is not to pick three plausible numbers independently, because independent draws
|
||||
are what produce the impossible device. The engine returns all three together as one
|
||||
coherent profile, chosen for the session from a small set of real device archetypes, so
|
||||
the values always describe a machine that could actually exist:
|
||||
|
||||
| Device archetype | `sampleRate` | `outputLatency` | `maxChannelCount` |
|
||||
|---|---|---|---|
|
||||
| Plain stereo desktop | 44100 Hz | around 40 ms | 2 |
|
||||
| USB audio interface | 48000 Hz | lower, near 30 ms | 2 |
|
||||
| 5.1-capable sound card | 48000 Hz | near 40 ms | 6 |
|
||||
|
||||
Each row is a machine that exists; the impossible combinations between rows are the ones a
|
||||
detector is looking for.
|
||||
|
||||
Because the whole profile is keyed off the session seed, a six-channel destination never
|
||||
lands next to a laptop's latency, and the same seed reproduces the same audio device on
|
||||
every run. The three fields move as a unit, which is the property the detector is testing
|
||||
for. This is the general principle these patches follow: the goal is to look like a real
|
||||
machine, not merely to avoid an obvious default, and a suppressed or arbitrary value
|
||||
fails that goal as surely as a wrong one.
|
||||
|
||||
## Measuring it yourself with a fixed seed
|
||||
|
||||
The point of a seed is that a finding is reproducible. Read the profile under two seeds
|
||||
and confirm two things at once: that each profile is internally coherent, and that the
|
||||
same seed returns the same device every time.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
READ = """() => {
|
||||
const ctx = new AudioContext();
|
||||
const out = [ctx.sampleRate, ctx.destination.maxChannelCount,
|
||||
Math.round((ctx.outputLatency || 0) * 1000)];
|
||||
ctx.close();
|
||||
return out;
|
||||
}"""
|
||||
|
||||
for seed in (42, 1337):
|
||||
with InvisiblePlaywright(seed=seed) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
rate, channels, latency_ms = page.evaluate(READ)
|
||||
print(f"seed={seed}: {rate} Hz, {channels} ch, ~{latency_ms} ms")
|
||||
```
|
||||
|
||||
Two checks turn this into evidence rather than a single reading:
|
||||
|
||||
1. **Run each seed twice.** The tuple must be identical across runs of the same seed. If
|
||||
it drifts, something is randomising per call, which is
|
||||
[the cheapest tampering check a detector has](audiocontext-fingerprinting.md).
|
||||
2. **Sanity-check the pairing by hand.** Six channels should never appear beside a
|
||||
latency that belongs to onboard stereo. If it does, you have found the exact
|
||||
contradiction this section exists to prevent.
|
||||
|
||||
Compare the output to a stock Firefox on the same machine and you will see the shape of
|
||||
the guarantee: the stock browser reports your real card, the seeded browser reports a
|
||||
coherent invented one, and neither reports the round, hardware-free defaults a bare
|
||||
container does. If you need a specific device rather than a seed-derived one,
|
||||
[pinning a field](pinning.md) leaves the rest of the identity untouched.
|
||||
|
||||
## Conclusion
|
||||
|
||||
`sampleRate`, `outputLatency` and `maxChannelCount` are read straight from the OS audio
|
||||
driver, which means a headless server has nothing truthful to say through them and a
|
||||
careless spoof says something impossible. The buffer hash gets all the attention, but
|
||||
these three static numbers are read first and cost nothing to check. Treating them as one
|
||||
coherent device profile, reproducible from a seed, is what keeps a six-channel count from
|
||||
ever sitting next to a laptop's latency, and that pairing is the thing a consistency check
|
||||
is actually built to find.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What is AudioContext.sampleRate and can I change it from JavaScript?** It is the rate
|
||||
the audio device runs at, `44100` or `48000` Hz, read from the driver. Page JavaScript
|
||||
cannot change it truthfully; only the engine underneath can decide what the read returns.
|
||||
|
||||
**Why does my headless server report the same audio values on every run?** Because there
|
||||
is no sound hardware, so the context falls back to a fixed default. Identical values
|
||||
across every container are a cohort, not a clean fingerprint.
|
||||
|
||||
**Is outputLatency a reliable fingerprinting signal?** On its own, weakly. In combination
|
||||
with sample rate and channel count it is strong, because only certain triples correspond
|
||||
to devices that actually exist.
|
||||
|
||||
**What does maxChannelCount reveal?** How many output channels the device can drive: 2 for
|
||||
stereo, 6 for 5.1, 8 for 7.1. A value that contradicts the latency and rate is the tell.
|
||||
|
||||
**How do I make these values consistent with each other?** Do not draw them
|
||||
independently. Pick a real device archetype and take all three from it, which is what a
|
||||
seed-derived profile does automatically.
|
||||
|
||||
**Will an empty or suspended AudioContext pass a detector?** No. A blocked or suppressed
|
||||
read is recorded as its own signal, so an absent value fails the same way a wrong one
|
||||
does.
|
||||
|
||||
## Sources
|
||||
|
||||
- W3C Web Audio API specification, which defines `sampleRate`, `baseLatency` and
|
||||
`outputLatency` on `AudioContext` and `maxChannelCount` on the destination node:
|
||||
[www.w3.org/TR/webaudio/](https://www.w3.org/TR/webaudio/).
|
||||
- MDN Web Docs on the same properties, read from the engine rather than from any single
|
||||
detector's rendering of them:
|
||||
[AudioContext.sampleRate](https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/sampleRate),
|
||||
[AudioContext.outputLatency](https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/outputLatency),
|
||||
and [AudioDestinationNode.maxChannelCount](https://developer.mozilla.org/en-US/docs/Web/API/AudioDestinationNode/maxChannelCount).
|
||||
- This project's own audio patches and their release notes, which choose the three static
|
||||
audio properties together as one coherent device profile so the values never contradict
|
||||
each other.
|
||||
|
||||
**See also:** [AudioContext fingerprinting](audiocontext-fingerprinting.md) for the
|
||||
rendered-buffer side of the same surface, [why getVoices() comes back empty](speech-synthesis-voices.md)
|
||||
for the other operating-system read that gives a server away, and
|
||||
[the checklist for being detected on one site](playwright-detected-as-bot.md) for where
|
||||
the audio device sits in the order you should debug.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The audio device is one of
|
||||
the machine tells no page-level plugin can reach, which is why it is solved in the engine.*
|
||||
@@ -0,0 +1,148 @@
|
||||
---
|
||||
title: "Why automating login is riskier than reusing a session"
|
||||
description: "Automating a login form runs the most monitored flow on most sites. Reusing a saved session skips it, if the fingerprint still matches the one that logged in."
|
||||
parent: "The Automation Layer"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 12
|
||||
---
|
||||
|
||||
|
||||
# Why automating login is riskier than reusing a session
|
||||
|
||||
**Automating a login form is riskier than reusing a session because the login form is
|
||||
the single most heavily monitored flow on most sites, and reusing a saved session avoids
|
||||
that flow entirely.** The catch is that a reused session only holds if the browser
|
||||
fingerprint still matches the one that created it.
|
||||
|
||||
A script that fills a username, types a password and clicks submit looks like the
|
||||
obvious way to get an automated session logged in. It is also, on most sites, the
|
||||
single most heavily instrumented sequence of actions a visitor can perform - the exact
|
||||
place account-takeover and credential-stuffing defenses concentrate, because that is
|
||||
where they matter most for the site.
|
||||
|
||||
This page explains why that flow draws the most scrutiny, how session reuse skips it,
|
||||
and the one condition - fingerprint consistency - that decides whether a reused session
|
||||
keeps working.
|
||||
|
||||
## Automating the login form vs reusing a session: which is safer
|
||||
|
||||
Reusing a saved session is safer on most sites, because it never runs the login form -
|
||||
the flow where abuse defenses are strongest - and instead starts already authenticated,
|
||||
the way a returning visitor does. Automating the form can work, but it runs directly
|
||||
into the site's most aggressive checks.
|
||||
|
||||
| | Automate the login form | Reuse a saved session |
|
||||
|---|---|---|
|
||||
| What runs | Username, password, submit: the most monitored flow | No login flow; the session starts authenticated |
|
||||
| Scrutiny | Highest on the site | Same as any returning visitor |
|
||||
| Main dependency | Human-like timing, focus order, pointer motion | Fingerprint matching the session's original |
|
||||
| Fails when | Any automation signal is caught at the form | The fingerprint or exit country changes |
|
||||
|
||||
## Why the login flow specifically gets more scrutiny than the rest of the site
|
||||
|
||||
Most pages on a site are read by anyone. A login form is different: it is the one
|
||||
place where getting it wrong has a direct cost to the operator, so it is where fraud
|
||||
and abuse defenses get the most investment, updated the most often, and tuned the most
|
||||
aggressively. A page that flags automation loosely everywhere else often flags it
|
||||
tightly at the one form that asks for credentials.
|
||||
|
||||
That means every automation-detectable signal on this site - the timing between
|
||||
keystrokes, whether the pointer travelled to the field or teleported, whether a field
|
||||
was focused before it was filled, the rhythm between filling the form and submitting
|
||||
it - gets checked hardest at exactly the moment a login script runs it.
|
||||
|
||||
## The alternative: don't run the flow at all
|
||||
|
||||
Playwright's [`storage_state`](https://playwright.dev/python/docs/api/class-browsercontext#browser-context-storage-state)
|
||||
captures cookies and local storage from a context and can load them into a new one.
|
||||
Log in once, by hand or through a session you trust,
|
||||
[save and reuse that state](save-reuse-login-storage-state-playwright.md), and every
|
||||
subsequent automated session starts already authenticated - no username field, no
|
||||
password field, no submit click, and none of the scrutiny attached to that specific
|
||||
sequence.
|
||||
|
||||
```python
|
||||
# once, from a session that actually logged in
|
||||
context.storage_state(path="session.json")
|
||||
|
||||
# every run after that
|
||||
context = browser.new_context(storage_state="session.json")
|
||||
```
|
||||
|
||||
This is not a workaround. It is the same mechanism a real returning visitor uses:
|
||||
nobody who logged into a site yesterday retypes their password today, they carry a
|
||||
session cookie that says who they already are. An automated session doing the same
|
||||
thing is not imitating unusual behaviour, it is doing what every session that isn't a
|
||||
first-time login already does.
|
||||
|
||||
## The condition this depends on, and it is not optional
|
||||
|
||||
A session was created by a specific browser, on a specific machine, presenting a
|
||||
specific fingerprint at the moment of login. Replaying that session's cookies from a
|
||||
different fingerprint is asking a site to believe that the same identity suddenly
|
||||
changed its GPU, its font list, its canvas output and its TLS handshake between one
|
||||
request and the next - which is exactly the kind of cross-session inconsistency
|
||||
[a detector is built to catch](timezone-proxy-mismatch.md), regardless of whether the
|
||||
cookie itself is genuinely valid.
|
||||
|
||||
Sites that bind a session to more than a cookie - checking the fingerprint against
|
||||
what was recorded at login, not just validating the token - will flag or invalidate a
|
||||
replayed session on a mismatched machine even though the credential is real. The
|
||||
cookie proves who logged in. It does not, on its own, prove the request came from the
|
||||
same browser that did.
|
||||
|
||||
The practical requirement follows directly: the fingerprint has to stay the same
|
||||
across the login and every session that reuses it. [A profile tied to one seed](persistent-profiles.md)
|
||||
is what makes that possible - the identity that logged in and the identity replaying
|
||||
the cookie later are the same one, not two that happen to share a token.
|
||||
|
||||
## What to actually do
|
||||
|
||||
1. **Log in once**, through a session using the exact identity - seed, profile, proxy
|
||||
country - you intend to keep using.
|
||||
2. **Save `storage_state` immediately after**, while the session is fresh.
|
||||
3. **Reuse it from a context built with the same identity**, not a fresh or different
|
||||
one. The cookie and the fingerprint are a pair; only one half being right is not
|
||||
enough.
|
||||
4. **Treat expiry as certain, not exceptional.** Sessions end. Build the re-login path
|
||||
once, using the same identity, rather than improvising it the first time a saved
|
||||
session stops working.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Is it safe to automate a login form at all?** It works, and it is the highest-scrutiny
|
||||
sequence on most sites. If a session can be captured and reused instead, that avoids
|
||||
the scrutiny rather than trying to survive it.
|
||||
|
||||
**Does a valid session cookie guarantee I won't be flagged?** No. A cookie proves a
|
||||
credential. Some sites separately check whether the fingerprint replaying it matches
|
||||
the one that created it, and a mismatch there is checked independently of whether the
|
||||
token itself is genuine.
|
||||
|
||||
**Can I use one saved session across different machines or proxies?** Not safely if
|
||||
the fingerprint or exit country changes. The session and the identity that created it
|
||||
are a pair for exactly the same reason [a proxy and a timezone have to agree](timezone-proxy-mismatch.md).
|
||||
|
||||
**What happens when the saved session expires?** The automation needs a real
|
||||
re-authentication path, through the same identity that created the original session,
|
||||
not a different one improvised under pressure.
|
||||
|
||||
**See also:** [Save and reuse login with storage_state in Playwright](save-reuse-login-storage-state-playwright.md),
|
||||
for the practical capture-and-reuse steps;
|
||||
[Playwright persistent profile: what it fixes and breaks](persistent-profiles.md), for
|
||||
the identity half of this pairing;
|
||||
[how to scrape data behind a login with Playwright](how-to-scrape-behind-login-playwright.md),
|
||||
for the end-to-end flow; and
|
||||
[human-like pointer motion](human-mouse-movement.md), for what the login flow itself
|
||||
checks when there is no way to avoid running it.
|
||||
|
||||
## Sources
|
||||
|
||||
- Playwright's own [`storage_state` / `storageState`](https://playwright.dev/python/docs/api/class-browsercontext#browser-context-storage-state)
|
||||
API, for the session capture and reuse mechanism described above.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level, on why the safest login is usually the one that
|
||||
never runs as automation at all.*
|
||||
@@ -0,0 +1,227 @@
|
||||
---
|
||||
title: "Back a computer-use agent with a real browser engine"
|
||||
description: "Run OpenAI's computer-use agent inside patched Firefox by implementing its Computer interface over an invisible_playwright page, and the honest limits."
|
||||
parent: "AI Agents and Frameworks"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 16
|
||||
---
|
||||
|
||||
|
||||
# Back a computer-use agent with a real browser engine
|
||||
|
||||
A computer-use agent is a loop: take a screenshot, send it to a model, get back a
|
||||
coordinate to click or some text to type, apply it, screenshot again. The interesting
|
||||
question for anyone running one against real sites is not the model. It is what browser
|
||||
the screenshots come from and where the clicks land, because that is the part a site can
|
||||
inspect.
|
||||
|
||||
The good news is that the popular reference implementation was built to let you swap that
|
||||
part out. This page shows how, using the real invisible_playwright API, and it is honest
|
||||
about what the swap fixes and what it leaves entirely up to you.
|
||||
|
||||
## The seam that makes this easy
|
||||
|
||||
OpenAI's open `cua-sample-app` does not hardcode a browser. The screenshot-and-click loop
|
||||
drives a small, pluggable `Computer` interface, and the repository ships one
|
||||
implementation of it called `LocalPlaywrightComputer`. Every action the model returns -
|
||||
`screenshot`, `click`, `type`, `scroll`, `keypress`, `goto` - is a method the loop calls
|
||||
on whatever `Computer` object you hand it. The loop does not know or care what is behind
|
||||
those methods.
|
||||
|
||||
That seam is the whole opportunity. If you implement the same interface over a browser you
|
||||
control, the same loop now runs inside your engine. Nothing about the agent's reasoning
|
||||
changes. What changes is the thing on the other side of `screenshot()` and `click()`.
|
||||
|
||||
## What backing it with a real engine actually fixes
|
||||
|
||||
`LocalPlaywrightComputer` drives a stock automation build. invisible_playwright is a
|
||||
Firefox patched at the C++ level and driven by stock Playwright, generating a full,
|
||||
internally consistent identity per session - GPU, canvas, audio, fonts, screen, roughly
|
||||
400 fields - from one seed. Point the `Computer` interface at one of its pages and two
|
||||
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
|
||||
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
|
||||
point to point.
|
||||
|
||||
What it does not touch is equally important, and the next section is about that.
|
||||
|
||||
## Two lines to launch, one class to adapt
|
||||
|
||||
The launch is the same two-line change as anywhere else in these docs. `InvisiblePlaywright`
|
||||
returns a real Playwright `Browser`, so every method you already use is available:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
page.mouse.click(200, 140) # the pointer arcs there on a Bezier curve
|
||||
```
|
||||
|
||||
To feed that page to the agent, wrap it in a class that satisfies the `Computer`
|
||||
interface. This is a representative subset of the methods the loop calls; each one is a
|
||||
plain call on the real Playwright `page`:
|
||||
|
||||
```python
|
||||
import base64
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
|
||||
class InvisibleComputer:
|
||||
"""Adapts an invisible_playwright page to cua-sample-app's Computer interface."""
|
||||
|
||||
environment = "browser"
|
||||
dimensions = (1280, 800)
|
||||
|
||||
def __init__(self, page):
|
||||
self._page = page
|
||||
|
||||
def screenshot(self) -> str:
|
||||
png = self._page.screenshot()
|
||||
return base64.b64encode(png).decode()
|
||||
|
||||
def click(self, x: int, y: int, button: str = "left") -> None:
|
||||
self._page.mouse.click(x, y, button=button)
|
||||
|
||||
def type(self, text: str) -> None:
|
||||
self._page.keyboard.type(text)
|
||||
|
||||
def keypress(self, keys: list[str]) -> None:
|
||||
for key in keys:
|
||||
self._page.keyboard.press(key)
|
||||
|
||||
def scroll(self, x: int, y: int, scroll_x: int, scroll_y: int) -> None:
|
||||
self._page.mouse.move(x, y)
|
||||
self._page.mouse.wheel(scroll_x, scroll_y)
|
||||
|
||||
def goto(self, url: str) -> None:
|
||||
self._page.goto(url)
|
||||
|
||||
def get_current_url(self) -> str:
|
||||
return self._page.url
|
||||
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
computer = InvisibleComputer(page)
|
||||
# hand `computer` to the cua-sample-app Agent in place of LocalPlaywrightComputer;
|
||||
# the screenshot-and-click loop now runs inside the patched Firefox.
|
||||
```
|
||||
|
||||
Everything here uses only documented Playwright methods on a real `Browser` and `Page`.
|
||||
There is no wrapped subset to learn, which is the point of the two-line switch. Pass a
|
||||
`seed` and the identity is reproducible, so a run that gets challenged can be replayed
|
||||
exactly instead of guessed at.
|
||||
|
||||
## What it does not fix, and who supplies that
|
||||
|
||||
Swapping the engine fixes the engine and the page. It does not change two things that
|
||||
decide most real outcomes, and pretending otherwise would be dishonest.
|
||||
|
||||
- **The click rhythm.** The loop still clicks a coordinate, waits for the model, and
|
||||
clicks the next coordinate. That cadence has a shape: long pauses clustered around model
|
||||
latency rather than around reading speed, and clicks that land dead-centre on targets.
|
||||
The Bezier motion between points helps, but the higher-level timing is the agent's, and
|
||||
a site that watches behaviour rather than fingerprints is watching that. Human pacing is
|
||||
something you add on top; see [the pause shaped like model latency](ai-browser-agents-stealth.md)
|
||||
and [what human pointer motion actually looks like](human-mouse-movement.md).
|
||||
- **The network path.** The screenshots come from a real-looking Firefox, but the traffic
|
||||
still exits wherever your host or proxy sends it. A genuine browser on a datacenter
|
||||
address, or on an IP a thousand other people are using this minute, still loses. IP
|
||||
reputation, per-account quotas and rate limits are not browser properties, and no engine
|
||||
swap touches them. You supply the clean exit.
|
||||
|
||||
Set a proxy the same way as any other session, and let the browser timezone follow the
|
||||
exit rather than pinning it by hand:
|
||||
|
||||
```python
|
||||
proxy = {"server": "socks5://gate.example.com:1080", "username": "u", "password": "p"}
|
||||
with InvisiblePlaywright(seed=42, proxy=proxy) as browser:
|
||||
page = browser.new_page()
|
||||
computer = InvisibleComputer(page)
|
||||
...
|
||||
```
|
||||
|
||||
The honest summary: this raises the browser and the page from "obvious automation" to
|
||||
"indistinguishable from a real Firefox", which clears the fingerprint, TLS and driver
|
||||
layer. It leaves behaviour timing and network reputation exactly where they were, on your
|
||||
side of the line. See [why a clean fingerprint can still be blocked](why-blocked-with-a-clean-fingerprint.md)
|
||||
for what remains after the engine stops being the problem.
|
||||
|
||||
## Prove the swap did what you think
|
||||
|
||||
Do not trust the diff, measure it. Run the agent's own `screenshot()` against a public
|
||||
fingerprinting page, once with `LocalPlaywrightComputer` and once with the adapter above,
|
||||
and compare the reports field by field rather than reading the verdicts. The fields that
|
||||
move - GPU renderer, canvas hash, the driver flag, the platform string - are what the
|
||||
swap bought you. The fields that do not move, and the timing and address it cannot touch,
|
||||
are what you still owe. The method is the same one in
|
||||
[how to test bot detection without a false pass](how-to-test-bot-detection.md): assert the
|
||||
right signal is present, not that a wrong one is absent, and run it more than once.
|
||||
|
||||
## Conclusion
|
||||
|
||||
The pluggable `Computer` interface in OpenAI's `cua-sample-app` is the seam that lets you
|
||||
run the exact same screenshot-and-click loop inside a different browser. Implementing it
|
||||
over an invisible_playwright page fixes the two things a site inspects first - the engine
|
||||
the screenshots come from and the page the clicks land on - and that is genuinely most of
|
||||
the fingerprint battle. It is not the whole session. The coordinate-click rhythm and the
|
||||
network path are still yours, and an agent that looks like a real Firefox on a bad IP with
|
||||
robotic pacing is still an agent that gets caught. Swap the engine, then supply the pacing
|
||||
and the exit.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can I use invisible_playwright with OpenAI's computer-use agent?** Yes. The
|
||||
`cua-sample-app` drives a pluggable `Computer` interface; implement that interface over an
|
||||
invisible_playwright page and the loop runs inside the patched Firefox.
|
||||
|
||||
**Does this make my agent undetectable?** No, and no tool honestly can. It makes the
|
||||
browser engine, TLS and driver layer read as a real Firefox, which clears most
|
||||
fingerprint checks. It does not fix your IP, your rate limits, or the timing of the clicks.
|
||||
|
||||
**What exactly does the engine swap change?** The screenshots are rendered by a real-looking
|
||||
Firefox instead of an automation build, and the clicks land through Bezier pointer motion.
|
||||
The higher-level click cadence and the network path are unchanged.
|
||||
|
||||
**Do I have to rewrite the agent's loop?** No. You implement one small adapter class with
|
||||
methods like `screenshot`, `click`, `type` and `scroll`, each a plain call on the real
|
||||
Playwright page. The loop stays as it is.
|
||||
|
||||
**Why does behaviour timing still matter?** Because a site can watch when you act, not just
|
||||
what your browser reports. Pauses shaped like model latency and clicks dead-centre on
|
||||
targets are a behavioural signal the engine does not touch.
|
||||
|
||||
**What proxy should I use?** A clean one. [Around 90% of proxies are already known and
|
||||
blocked](configuration.md) before you ever use them, and a perfect browser on a known IP
|
||||
still loses. Set it via the `proxy` argument and let the timezone auto-derive from the exit.
|
||||
|
||||
**See also:** [AI browser agents and stealth](ai-browser-agents-stealth.md) for what
|
||||
applies across every agent framework, [how browser-use gets detected](browser-use-detection.md)
|
||||
for the CDP-driven case, and [the checklist for being detected on one site](playwright-detected-as-bot.md)
|
||||
for the order to debug in once something flags you.
|
||||
|
||||
## Sources
|
||||
|
||||
- OpenAI's open `cua-sample-app` and its `Computer` interface, including the shipped
|
||||
`LocalPlaywrightComputer` implementation, read from the repository rather than assumed.
|
||||
- This project's own API: `InvisiblePlaywright` returns a real Playwright `Browser`, so
|
||||
the adapter above uses only documented Playwright methods - [`Page`](https://playwright.dev/python/docs/api/class-page),
|
||||
[`Mouse`](https://playwright.dev/python/docs/api/class-mouse) and
|
||||
[`Keyboard`](https://playwright.dev/python/docs/api/class-keyboard) - unchanged.
|
||||
- This project's release gates and the field-by-field comparison method documented in the
|
||||
testing pages linked above.
|
||||
|
||||
---
|
||||
|
||||
*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 swap is the easy
|
||||
half; the pacing and the exit are the half that decides the session.*
|
||||
@@ -1,16 +1,16 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="139" height="20" role="img" aria-label="browser launches: 1M">
|
||||
<title>browser launches: 1M</title>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="157" height="20" role="img" aria-label="browser launches: 1.64M">
|
||||
<title>browser launches: 1.64M</title>
|
||||
<linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient>
|
||||
<clipPath id="r"><rect width="139" height="20" rx="3" fill="#fff"/></clipPath>
|
||||
<clipPath id="r"><rect width="157" height="20" rx="3" fill="#fff"/></clipPath>
|
||||
<g clip-path="url(#r)">
|
||||
<rect width="116" height="20" fill="#555"/>
|
||||
<rect x="116" width="23" height="20" fill="#007ec6"/>
|
||||
<rect width="139" height="20" fill="url(#s)"/>
|
||||
<rect x="116" width="41" height="20" fill="#007ec6"/>
|
||||
<rect width="157" height="20" fill="url(#s)"/>
|
||||
</g>
|
||||
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="11">
|
||||
<text x="58.0" y="15" fill="#010101" fill-opacity=".3">browser launches</text>
|
||||
<text x="58.0" y="14">browser launches</text>
|
||||
<text x="127.5" y="15" fill="#010101" fill-opacity=".3">1M</text>
|
||||
<text x="127.5" y="14">1M</text>
|
||||
<text x="136.5" y="15" fill="#010101" fill-opacity=".3">1.64M</text>
|
||||
<text x="136.5" y="14">1.64M</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 886 B After Width: | Height: | Size: 898 B |
@@ -1,16 +1,16 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="79" height="20" role="img" aria-label="Stars: 1.8k">
|
||||
<title>Stars: 1.8k</title>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="20" role="img" aria-label="Stars: 1.88k">
|
||||
<title>Stars: 1.88k</title>
|
||||
<linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient>
|
||||
<clipPath id="r"><rect width="79" height="20" rx="3" fill="#fff"/></clipPath>
|
||||
<clipPath id="r"><rect width="80" height="20" rx="3" fill="#fff"/></clipPath>
|
||||
<g clip-path="url(#r)">
|
||||
<rect width="43" height="20" fill="#555"/>
|
||||
<rect x="43" width="36" height="20" fill="#e8a317"/>
|
||||
<rect width="79" height="20" fill="url(#s)"/>
|
||||
<rect x="43" width="37" height="20" fill="#e8a317"/>
|
||||
<rect width="80" height="20" fill="url(#s)"/>
|
||||
</g>
|
||||
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="11">
|
||||
<text x="21.5" y="15" fill="#010101" fill-opacity=".3">Stars</text>
|
||||
<text x="21.5" y="14">Stars</text>
|
||||
<text x="61.0" y="15" fill="#010101" fill-opacity=".3">1.8k</text>
|
||||
<text x="61.0" y="14">1.8k</text>
|
||||
<text x="61.5" y="15" fill="#010101" fill-opacity=".3">1.88k</text>
|
||||
<text x="61.5" y="14">1.88k</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 843 B After Width: | Height: | Size: 847 B |
@@ -0,0 +1,16 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="204" height="38" viewBox="0 0 204 38" role="img" aria-label="Join on Telegram">
|
||||
<title>Join on Telegram</title>
|
||||
<defs>
|
||||
<linearGradient id="g" x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="0" stop-color="#37AEE2"/>
|
||||
<stop offset="1" stop-color="#1E96C8"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<rect x="0.5" y="0.5" width="203" height="37" rx="18.5" fill="url(#g)"/>
|
||||
<g transform="translate(20 9.5)" fill="#fff">
|
||||
<path d="M18.6 1.1 1.2 7.9c-1.0.4-1.0.9-.2 1.2l4.4 1.4 1.7 5.2c.2.6.4.7.9.3l2.5-2.0 4.2 3.1c.8.4 1.3.2 1.5-.7l2.7-12.7c.2-1.0-.4-1.5-1.3-1.1Zm-4.0 3.1-7.3 6.6-.3 3.1-1.5-4.6 9.1-5.1Z"/>
|
||||
</g>
|
||||
<text x="123" y="24.5" fill="#fff" text-anchor="middle"
|
||||
font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif"
|
||||
font-size="15" font-weight="600">Join on Telegram</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 863 B |
|
Before Width: | Height: | Size: 106 KiB After Width: | Height: | Size: 102 KiB |
|
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 103 KiB |
@@ -0,0 +1,202 @@
|
||||
---
|
||||
title: "Battery API fingerprint: does Firefox expose it?"
|
||||
description: "Does desktop Firefox expose the Battery Status API? No, it was removed in 2017, so a battery object under a Firefox user agent gives away a fake browser."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 29
|
||||
---
|
||||
|
||||
|
||||
# Battery API fingerprint: does Firefox expose it?
|
||||
|
||||
Short version: on the desktop, no. Firefox removed the
|
||||
[Battery Status API](https://developer.mozilla.org/en-US/docs/Web/API/Battery_Status_API)'s
|
||||
`navigator.getBattery()` from web content in the 52 series back in 2017, on privacy
|
||||
grounds, and it has never come back.
|
||||
So a real desktop Firefox has no Battery Status API at all. `navigator.getBattery` is
|
||||
`undefined`, and there is nothing to read.
|
||||
|
||||
That single fact turns the Battery API into a small but reliable consistency check. A
|
||||
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
|
||||
that for free.
|
||||
|
||||
## What the Battery Status API was, and why Firefox dropped it
|
||||
|
||||
The Battery Status API let a page call `navigator.getBattery()` and read the charge
|
||||
level, whether the device was plugged in, and the seconds until full or empty. It was
|
||||
meant for power-aware pages that could defer heavy work on a low battery.
|
||||
|
||||
The privacy problem showed up quickly. The charge level was reported with enough
|
||||
precision, and it changed slowly enough, that the combination of level plus
|
||||
charging state plus time-remaining behaved like a short-lived identifier: two page
|
||||
loads seconds apart saw the same unusual value, and that value could be used to correlate
|
||||
visitors even across contexts that were supposed to be isolated. Firefox responded by
|
||||
removing the API from web content entirely in the
|
||||
[52 series in 2017](https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/52),
|
||||
restricting it to chrome/privileged code only. Chromium kept a
|
||||
reduced version. That divergence is the whole point for fingerprinting: the presence or
|
||||
absence of `getBattery` is now a per-engine trait, not a per-device one.
|
||||
|
||||
## Why absence is the honest answer, and a fake battery is the tell
|
||||
|
||||
A fake battery reading is the riskier of the two outcomes, because an absence matches
|
||||
every real Firefox automatically while a fake value has to survive every angle a
|
||||
detector can check it from. There are two ways an automation stack can end up
|
||||
"consistent" with a Firefox user agent on this surface.
|
||||
|
||||
The first is to actually be a Firefox build, in which case `navigator.getBattery` is
|
||||
simply not there, because the engine never defined it. Nothing is spoofed. There is no
|
||||
value to keep plausible over time, no charging animation to fake, no drain rate to model.
|
||||
The gap in the API is real, so it survives every probe automatically.
|
||||
|
||||
The second is to run an engine that does expose the Battery API, usually a Chromium base,
|
||||
and then bolt on a JavaScript layer that tries to look like Firefox. Now the stealth
|
||||
layer has a decision to make. If it leaves `getBattery` in place, the page reads a battery
|
||||
object from a claimed-Firefox browser, which no real Firefox produces, and that is a
|
||||
direct contradiction.
|
||||
|
||||
If it deletes `getBattery` to hide the mismatch, it has to delete it
|
||||
convincingly: the property has to be gone from the prototype, absent from a
|
||||
`for..in` walk, missing from `Object.getOwnPropertyNames`, and it has to stay missing when
|
||||
a detector fetches a clean copy of `Navigator.prototype` from a fresh iframe and compares.
|
||||
A partial delete that patches the obvious access but leaves a trace elsewhere is worse than
|
||||
leaving the API alone, because now there is both a Firefox user agent and evidence of
|
||||
tampering. This is the pattern CreepJS is built to catch: it does not ask what you report,
|
||||
it asks whether the shape of your environment is internally consistent and whether anything
|
||||
looks deleted.
|
||||
|
||||
The general rule, which the Battery API illustrates cleanly, is that adding a fake signal
|
||||
is almost always more dangerous than a real absence. An absence is one bit that matches
|
||||
every other Firefox on earth. A fake is a value you now have to defend against every angle
|
||||
a detector can approach it from.
|
||||
|
||||
## How the patched build inherits the gap natively
|
||||
|
||||
invisible_playwright drives a Firefox that is patched at the C++ level, not a different
|
||||
engine wearing a Firefox user agent. Because the base is a real Firefox from the current
|
||||
release line, it inherits the same missing Battery API that every stock desktop Firefox
|
||||
has had since 2017. There is no shim reintroducing `getBattery` and no shim removing it,
|
||||
because there was never anything to remove. The surface is correct for the same reason a
|
||||
stock Firefox is correct: the engine simply does not implement that API for web content.
|
||||
|
||||
That is the recurring theme across the fingerprint surface. A field is most robust when it
|
||||
is genuinely produced by a real browser rather than reconstructed on top of one. The same
|
||||
logic covers the identity fields that a page reads far more often than the battery, such
|
||||
as [what `navigator.vendor` and `navigator.productSub` report on Firefox](navigator-vendor-productsub-firefox.md),
|
||||
which are wrong on a Chromium base pretending to be Firefox and correct on an actual
|
||||
Firefox build.
|
||||
|
||||
## Check it yourself in two lines
|
||||
|
||||
Switching from stock Playwright is a two-line change, and after that every standard
|
||||
Playwright method works unchanged. Here is the whole probe: launch, open a page, and ask
|
||||
the browser whether it has a Battery API.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
|
||||
report = page.evaluate("""() => ({
|
||||
userAgent: navigator.userAgent,
|
||||
hasGetBattery: typeof navigator.getBattery,
|
||||
onPrototype: 'getBattery' in Navigator.prototype,
|
||||
})""")
|
||||
|
||||
print(report)
|
||||
```
|
||||
|
||||
On this build you get a Firefox user agent, `hasGetBattery` equal to `"undefined"`, and
|
||||
`onPrototype` equal to `False`. That is the correct, boring result: a Firefox with no
|
||||
Battery API, exactly like the one a person runs. The `seed=42` argument makes the whole
|
||||
identity reproducible, so if you are comparing this against a stock Firefox on the same
|
||||
machine you can rerun the exact same fingerprint rather than a fresh random one each time.
|
||||
|
||||
The comparison is the part worth doing by hand. Open the same probe in a stock desktop
|
||||
Firefox and you will see the identical three values. Open it in a plain Chromium and
|
||||
`hasGetBattery` comes back `"function"`. That contrast, run against a real reference
|
||||
browser rather than read as a verdict, is the method the
|
||||
[testing guide](how-to-test-bot-detection.md) argues for on every surface.
|
||||
|
||||
## What a passing battery check does not buy you
|
||||
|
||||
This is where honesty matters, because it is easy to overread a green result.
|
||||
|
||||
Having no Battery API, correctly, tells a detector that this browser looks like a genuine
|
||||
Firefox on this one narrow surface. It says nothing whatsoever about your network. The
|
||||
Battery API cannot see your IP address, your exit country, or how many requests you have
|
||||
made in the last minute. A browser can be a flawless Firefox on every fingerprint field
|
||||
and still be turned away because the exit IP is a known datacenter range, because the
|
||||
account behind the session hit a per-account quota, because the requests arrived faster
|
||||
than a human hands could produce them, or because the pointer never moved before the click.
|
||||
|
||||
invisible_playwright is designed to look like a real browser driven by a real person, and
|
||||
that is genuinely why it passes most fingerprint, TLS and driver-layer checks: the engine
|
||||
is a real Firefox, so the traits it reports are the traits Firefox actually has, this API
|
||||
absence among them. But it does not supply a clean IP, it does not pace your actions, and
|
||||
it does not manage per-account limits. Those are yours to bring: a reputable exit, human
|
||||
timing, and sane volume. The [configuration guide](configuration.md) covers the proxy and
|
||||
timezone side of that, and the [detected-on-one-site checklist](playwright-detected-as-bot.md)
|
||||
walks the causes in the order they are usually the real culprit, with the network exit near
|
||||
the bottom of the list rather than the top.
|
||||
|
||||
## Conclusion
|
||||
|
||||
The Battery Status API is a clean example of a detection signal that is best handled by not
|
||||
existing. Desktop Firefox removed it in 2017, so the honest state for anything claiming to
|
||||
be Firefox is to have no `getBattery` at all. A stealth layer that adds a fake battery
|
||||
object to a non-Firefox engine creates the exact contradiction it was trying to avoid, and
|
||||
one that tries to delete the API instead has to delete it perfectly or leave a tampering
|
||||
trace. A patched real-Firefox build sidesteps the whole dilemma by inheriting the gap
|
||||
natively. It is a small surface, it costs nothing to get right, and getting it right is
|
||||
worth exactly as much as it is: one consistent bit, and not one bit more about your IP or
|
||||
your behaviour.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does Firefox have a Battery API?** Not on the desktop for web content. It was removed in
|
||||
the 52 series in 2017 for privacy reasons, so `navigator.getBattery` is `undefined`.
|
||||
|
||||
**Is a battery reading under a Firefox user agent a red flag?** Yes. A real desktop Firefox
|
||||
cannot return a battery object, so a page that gets one from a claimed-Firefox browser has
|
||||
caught a fake.
|
||||
|
||||
**Does Chrome still expose it?** Chromium kept a reduced Battery API, which is why the
|
||||
presence or absence of `getBattery` now works as a per-engine trait rather than a
|
||||
per-device one.
|
||||
|
||||
**Should a stealth tool fake a battery to look complete?** No. Adding a fake signal is more
|
||||
dangerous than a real absence, because the fake has to survive every angle a detector can
|
||||
probe from, while an absence matches every other Firefox automatically.
|
||||
|
||||
**Does invisible_playwright spoof the Battery API?** No. It drives a real patched Firefox,
|
||||
so the API is simply absent the same way it is absent in a stock Firefox. There is nothing
|
||||
to spoof.
|
||||
|
||||
**If my battery check passes, am I undetectable?** No. This surface says nothing about your
|
||||
IP reputation, per-account quotas, rate limits, or behaviour. A clean proxy and human pacing
|
||||
are still on you.
|
||||
|
||||
## Sources
|
||||
|
||||
- Mozilla's own [Firefox 52 release notes](https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/52),
|
||||
which record the Battery Status API becoming available only to chrome/privileged code
|
||||
in that release, 2017.
|
||||
- This project's own fingerprint parity checks, which read `navigator.getBattery` against a
|
||||
stock desktop Firefox and confirm both report the same absence.
|
||||
|
||||
**See also:** [what data websites collect about your browser](what-data-websites-collect-about-your-browser.md),
|
||||
[the navigator.vendor and productSub story on Firefox](navigator-vendor-productsub-firefox.md),
|
||||
and [how navigator.webdriver actually reads](navigator-webdriver-explained.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 most robust fingerprint
|
||||
field is the one a real browser genuinely produces, and sometimes the one it genuinely does
|
||||
not.*
|
||||
@@ -0,0 +1,187 @@
|
||||
---
|
||||
title: "BFCache and pageshow.persisted under browser automation"
|
||||
description: "Automation disables the back/forward cache, so pageshow.persisted is always false and every Back is a full reload. Why sites notice, and what enabling it costs."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 13
|
||||
---
|
||||
|
||||
|
||||
# BFCache and pageshow.persisted under browser automation
|
||||
|
||||
**Under browser automation, `pageshow.persisted` is almost always `false`, because the
|
||||
drivers switch the
|
||||
[back/forward cache](https://developer.mozilla.org/en-US/docs/Glossary/bfcache) off.**
|
||||
Every back navigation becomes a full reload
|
||||
instead of an instant restore, and a page that pays attention to the difference is
|
||||
looking at a browser that behaves unlike every consumer browser of the last decade.
|
||||
|
||||
Press Back in a real browser and the previous page usually comes back instantly,
|
||||
restored from memory with its JavaScript state intact. The page is told about it: a
|
||||
`pageshow` event fires with `persisted` set to `true`. Under automation that almost never
|
||||
happens.
|
||||
|
||||
This page covers what the cache does, what automation does to it, why the difference is
|
||||
visible, what turning it back on breaks in your own tests, and how to decide.
|
||||
|
||||
## What the back/forward cache actually does
|
||||
|
||||
When you navigate away, the browser can keep the whole page in memory rather than
|
||||
discarding it: the DOM, the JavaScript heap, the scroll position, the state of your
|
||||
variables. Navigate back and it is restored rather than rebuilt.
|
||||
|
||||
The page finds out through the
|
||||
[`pageshow`](https://developer.mozilla.org/en-US/docs/Web/API/Window/pageshow_event) event:
|
||||
|
||||
```js
|
||||
window.addEventListener('pageshow', (e) => {
|
||||
console.log('restored from bfcache:', e.persisted);
|
||||
});
|
||||
window.addEventListener('pagehide', (e) => {
|
||||
console.log('kept in bfcache:', e.persisted);
|
||||
});
|
||||
```
|
||||
|
||||
`persisted` is `true` on a restore and `false` on an ordinary load. It is a single
|
||||
boolean, available to any script, and it is normally used for legitimate purposes such as
|
||||
re-running analytics on a restored view.
|
||||
|
||||
## What automation does to it
|
||||
|
||||
Automation switches the cache off deliberately, in both major engines, so it never
|
||||
restores a page. Two different situations, both ending in the same place.
|
||||
|
||||
**Firefox under Playwright.** The driver that Playwright uses to control Firefox sets
|
||||
`disallowBFCache` on every docshell it manages. That is a deliberate choice on its part:
|
||||
a cached page makes automation less predictable, because state survives navigations that
|
||||
a test expects to reset.
|
||||
|
||||
**Chromium under automation.** The cache is generally not in play either, and there is a
|
||||
long-standing question on the Playwright tracker about how to enable it at all.
|
||||
|
||||
The result is the same in both: `event.persisted` is `false` on every navigation, always,
|
||||
in a browser where a real user would frequently see `true`.
|
||||
|
||||
## Why a page can notice
|
||||
|
||||
The difference is not subtle once you look for it, and none of it needs a fingerprinting
|
||||
library.
|
||||
|
||||
**The event itself.** A session that navigates back and forth several times and reports
|
||||
`persisted: false` every single time describes a browser with the cache disabled.
|
||||
Disabling it is not something ordinary users do.
|
||||
|
||||
**The timing.** A restore is immediate because nothing is rebuilt. A reload fetches,
|
||||
parses and executes. A page that measures how long its own initialisation took on a back
|
||||
navigation sees two very different numbers.
|
||||
|
||||
**The side effects of a reload.** Scripts run again, timers restart, counters reset,
|
||||
analytics fire a fresh page view. A page holding in-memory state watches it vanish on
|
||||
every back navigation, which is behaviour it can compare against what it expects.
|
||||
|
||||
None of this is a strong standalone signal. It belongs to the same family as
|
||||
[the pointer that teleports](human-mouse-movement.md): one more way in which the session
|
||||
does not behave like a person's browser, cheap to check and rarely thought about.
|
||||
|
||||
## How this project handles it, and what it costs you
|
||||
|
||||
The behaviour here is inverted relative to the stock driver: the cache is **left enabled
|
||||
by default**, so a back navigation restores the page and `persisted` comes back `true`,
|
||||
which is what a real Firefox does. The old behaviour is available behind a preference for
|
||||
anyone who needs it.
|
||||
|
||||
The cost is real and you should know it before you enable this anywhere:
|
||||
|
||||
**[`go_back()`](https://playwright.dev/python/docs/api/class-page#page-go-back) waiting
|
||||
for `load` can time out.** A bfcache restore does not fire `load`,
|
||||
because nothing loaded. Code that navigates back and waits for that event will sit there
|
||||
until the timeout expires.
|
||||
|
||||
```python
|
||||
# fragile once bfcache is enabled
|
||||
page.go_back() # may wait for a load that never comes
|
||||
|
||||
# robust either way
|
||||
page.go_back(wait_until="domcontentloaded")
|
||||
page.wait_for_selector("#something-on-the-previous-page")
|
||||
```
|
||||
|
||||
Waiting for something you can see is more robust than
|
||||
[waiting for a lifecycle event](how-to-wait-for-page-load-playwright.md) anyway, and it
|
||||
works whether or not the page was restored.
|
||||
|
||||
**State survives navigation.** That is the point of the cache, and it is also the thing
|
||||
that makes a test suite non-deterministic if the suite assumed a fresh page. If your
|
||||
tests depend on state being reset by going back, they were depending on the automation
|
||||
behaving unlike a browser.
|
||||
|
||||
## Deciding which behaviour you want
|
||||
|
||||
The two cases genuinely differ and it is worth being explicit rather than picking a
|
||||
default:
|
||||
|
||||
- **A test suite against your own application.** Predictability is worth more than
|
||||
realism, nothing is watching, and a cache that preserves state between steps causes
|
||||
flakiness. Disabling it is reasonable.
|
||||
- **A session that needs to look like a person's browsing.** Realism wins, and the cost
|
||||
is writing navigation waits that do not depend on `load`.
|
||||
|
||||
The mistake is not choosing either one. It is not knowing which you have, and then being
|
||||
surprised by a timeout or by a signal.
|
||||
|
||||
## Conclusion
|
||||
|
||||
The back/forward cache is a small thing that automation turns off for good engineering
|
||||
reasons, and turning it off produces a browser whose back button behaves differently from
|
||||
every consumer browser.
|
||||
|
||||
The fix is not complicated. Leave the cache on and stop waiting for `load` after a back
|
||||
navigation. The second half is what actually costs effort, and it is the reason the stock
|
||||
drivers made the other choice.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What does `event.persisted` mean?** That the page was restored from the back/forward
|
||||
cache rather than loaded again.
|
||||
|
||||
**Why is `persisted` always false in Playwright?** Because the driver disables the cache,
|
||||
in Firefox explicitly and in Chromium effectively.
|
||||
|
||||
**Can a site detect that bfcache is disabled?** It can observe that back navigations
|
||||
never restore, which is not how consumer browsers behave. It is a weak signal on its own
|
||||
and it belongs to a family of weak behavioural signals.
|
||||
|
||||
**Why does `go_back()` hang after I enable bfcache?** Because a restore does not fire
|
||||
`load`. Wait for `domcontentloaded` or for an element instead.
|
||||
|
||||
**Should I enable it?** For realistic sessions yes, for deterministic test suites
|
||||
probably not.
|
||||
|
||||
**Does bfcache leak state between pages?** It preserves state within a page across
|
||||
navigation, which is its purpose. There is an open Playwright issue about globals
|
||||
appearing to leak between pages because of it, which is worth reading if you see
|
||||
something odd.
|
||||
|
||||
**See also:** [human-like mouse movement](human-mouse-movement.md), the same category of
|
||||
behavioural difference, and
|
||||
[the checklist for being detected on one site](playwright-detected-as-bot.md), where
|
||||
behaviour is step five, and [how websites detect bots](how-do-websites-detect-bots.md)
|
||||
for where behavioural signals sit in the wider picture.
|
||||
|
||||
## Sources
|
||||
|
||||
- [MDN: the back/forward cache (bfcache)](https://developer.mozilla.org/en-US/docs/Glossary/bfcache)
|
||||
and [MDN: the `pageshow` event](https://developer.mozilla.org/en-US/docs/Web/API/Window/pageshow_event),
|
||||
which documents `persisted`.
|
||||
- Playwright's documented [`go_back()`](https://playwright.dev/python/docs/api/class-page#page-go-back)
|
||||
and its `wait_until` values, including `domcontentloaded`.
|
||||
- The Playwright tracker's open items on bfcache behaviour and on enabling it under
|
||||
Chromium.
|
||||
- This project's driver, which reads a preference before disabling the cache and leaves
|
||||
it enabled by default, with the `go_back` caveat recorded alongside it.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. The preference exists because the timeout described
|
||||
above is real, and a test suite that hits it deserves a way back to the old behaviour.*
|
||||
@@ -0,0 +1,261 @@
|
||||
---
|
||||
title: "WebDriver BiDi vs CDP: does the new protocol hide you"
|
||||
description: "WebDriver BiDi standardizes the automation control wire across browsers, but the leaks that expose automation live in the page, not on the protocol you speak."
|
||||
parent: "Comparisons"
|
||||
nav_order: 19
|
||||
---
|
||||
|
||||
|
||||
# WebDriver BiDi vs CDP: does the new protocol hide you
|
||||
|
||||
There is a hope, repeated often enough that it is worth answering directly, that
|
||||
WebDriver BiDi is the fix for automation detection. The reasoning goes: the old
|
||||
Chrome DevTools Protocol had a famous leak, everyone is moving to a standardized
|
||||
bidirectional protocol, so the standardized one must close it.
|
||||
|
||||
It does not, and the reason is the useful part. The leak people are trying to
|
||||
escape was never on the protocol wire. It is in the page. Changing which wire the
|
||||
driver speaks over leaves the page-level artifacts exactly where they were.
|
||||
|
||||
## The protocol is the control channel, not the fingerprint
|
||||
|
||||
The protocol is the wire a driver speaks over, not the fingerprint a page reads,
|
||||
so changing it moves nothing a detector looks at. CDP, BiDi and Firefox's own
|
||||
Juggler are all
|
||||
control channels: the out-of-process link a driver uses to say "open a page", "go
|
||||
to this URL", "evaluate this script", "give me the console messages". They are
|
||||
plumbing between your Python process and the browser process.
|
||||
|
||||
A detection script running inside the page cannot see that channel at all. It
|
||||
cannot see whether the command that opened the tab arrived as CDP JSON, as a BiDi
|
||||
message, or as a Juggler call. What it can see is whatever the browser does to the
|
||||
page as a side effect of being driven: a property that reads differently, a global
|
||||
that should not exist, a built-in prototype that was touched before the first
|
||||
script ran, a loop that runs measurably slower because the engine is in a
|
||||
different mode.
|
||||
|
||||
So the question "does BiDi hide me" is really two questions that get conflated. Is
|
||||
the control channel itself observable? Mostly no, for any of the three. Does
|
||||
switching the control channel change the in-page artifacts? Also no, because those
|
||||
artifacts are produced by a different mechanism entirely.
|
||||
|
||||
## What CDP's Runtime.enable leak actually was
|
||||
|
||||
The CDP `Runtime.enable` leak was a page-visible side effect of how Chromium
|
||||
automation manages JavaScript execution contexts, not a property of the CDP wire
|
||||
itself. It is narrower than the folklore around it, so it is worth stating
|
||||
exactly.
|
||||
|
||||
On Chromium, automation libraries call the CDP command `Runtime.enable` to manage
|
||||
the execution contexts they need for evaluating JavaScript. That call has an
|
||||
in-page side effect: it causes the browser to emit context-creation events, and a
|
||||
page can provoke and observe the timing of that machinery. Ordinary browsing never
|
||||
triggers it, so its footprint reads as automation. Two separate projects,
|
||||
[Patchright](vs-patchright.md) and
|
||||
[rebrowser-patches](vs-rebrowser-patches.md), independently converged on the same
|
||||
fix: stop calling `Runtime.enable` automatically and create the needed contexts by
|
||||
hand, with identifiers the page cannot correlate back to the session.
|
||||
|
||||
Notice what that fix is and is not. It is not "switch protocols". It is a change to
|
||||
how the driver uses the protocol so that the observable side effect stops
|
||||
happening in the page. The leak lived in the page; the fix lives at the driver.
|
||||
The protocol name never entered into it.
|
||||
|
||||
## Firefox automation here rides Juggler out of band
|
||||
|
||||
This project does not patch that leak because it never had it. The Firefox we ship
|
||||
is driven by stock Playwright over Juggler, an out-of-band control protocol that is
|
||||
not CDP and has no `Runtime.enable` command to call. There is no automatic
|
||||
context-enable step whose in-page timing a script can measure, because that step is
|
||||
a CDP-shaped thing and this is not CDP.
|
||||
|
||||
That is an architecture difference, not a cleverness difference. The
|
||||
`Runtime.enable` timing signal is specific to how CDP-driven Chromium manages
|
||||
execution contexts. A driver that manages contexts differently, over a different
|
||||
channel, does not emit that particular event and so cannot be caught by a probe
|
||||
looking for it. The class of Chromium hand-patches that exist to suppress it has no
|
||||
counterpart here for the same reason a Linux binary has no Windows registry to
|
||||
clean.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# A stock Playwright script. The control channel underneath is Juggler,
|
||||
# not CDP, so there is no Runtime.enable side effect for a page to time.
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# standard Playwright: the returned object is a real Browser
|
||||
print(page.title())
|
||||
```
|
||||
|
||||
None of that code mentions the protocol, which is the point: the wire is an
|
||||
implementation detail of the driver, and the same script would work if it changed.
|
||||
|
||||
## What WebDriver BiDi standardizes, and what it leaves untouched
|
||||
|
||||
WebDriver BiDi is a genuinely good thing and worth being precise about. It is a
|
||||
[W3C effort](https://www.w3.org/TR/webdriver-bidi/) to give every browser one
|
||||
bidirectional automation protocol, so that a driver can subscribe to events and
|
||||
issue commands the same way across engines, instead of CDP on one family and
|
||||
something bespoke on another. Firefox, Chromium and others implement it.
|
||||
Playwright itself has been building BiDi support. If you have ever wanted "one
|
||||
protocol, every browser", this is that.
|
||||
|
||||
What it standardizes is the shape of the control channel: the commands, the
|
||||
events, the subscription model. What it does not do, because it is not what a
|
||||
control protocol is for, is change what the browser exposes to the page. BiDi has
|
||||
no clause that turns off [`navigator.webdriver`](does-playwright-set-navigator-webdriver.md), no clause about whether a helper
|
||||
runs in the page's realm before the page's own scripts, no clause about whether the
|
||||
JavaScript engine is in a mode that runs loops slower. Those are engine and driver
|
||||
behaviors. A standardized wire carries them just as faithfully as a proprietary one.
|
||||
|
||||
The mental model that trips people up is that CDP and BiDi are alternatives on the
|
||||
same axis as "detected" and "not detected". They are not. Protocol choice and
|
||||
detectability are orthogonal. You can be trivially detectable over BiDi and hard to
|
||||
detect over Juggler, or the reverse, and the protocol name predicts neither.
|
||||
|
||||
## The leaks that survive any protocol change
|
||||
|
||||
If the wire is not where the tells are, where are they? Two families, both in the
|
||||
page, both indifferent to which control channel drove the browser.
|
||||
|
||||
The first is execution-context timing. Attaching a driver to the JavaScript engine
|
||||
can put realms into a debug-adjacent mode where the optimizing JIT is off and slow
|
||||
paths run on every call, and that is measurable from the page as time, with no
|
||||
property to read. It is
|
||||
[why a fingerprinting service can report developer tools with none open](debugger-timing-detection.md).
|
||||
Whether the driver spoke CDP, BiDi or Juggler to attach makes no difference to the
|
||||
resulting distribution; what matters is whether the engine was left in that mode.
|
||||
This project's fix was to attach without entering debug mode at all, so the JIT
|
||||
stays on. That is an engine change, and it would be exactly as necessary under BiDi.
|
||||
|
||||
The second is injected globals and touched built-ins. If a driver runs a helper in
|
||||
the page's own realm before the page loads, and that helper touches `JSON`,
|
||||
`Date.prototype` or `Array.prototype`, then the page starts life with built-ins
|
||||
that something else handled first, and that is observable. In a controlled
|
||||
experiment that was the difference between a session being blocked and not. The fix
|
||||
is to never touch the page realm until the page's own first script has run. Again:
|
||||
a driver behavior, carried identically over any wire. A page reading a leftover
|
||||
global does not know or care how the global got injected.
|
||||
|
||||
There is also a separate, wire-adjacent failure mode worth naming so it is not
|
||||
confused with the above: the driver and browser can drift out of agreement about
|
||||
the protocol's own field set, which
|
||||
[breaks the client rather than exposing it to the page](playwright-protocol-drift.md).
|
||||
That is a maintenance surface every automation stack has, standardized protocol or
|
||||
not, and it is orthogonal to detection too.
|
||||
|
||||
## How to choose, and what to actually measure
|
||||
|
||||
The practical upshot is that "which protocol" is not a stealth decision. Pick the
|
||||
protocol for engineering reasons: BiDi for cross-browser uniformity and a stable
|
||||
standard, CDP where you need a Chromium-specific capability it exposes, Juggler if
|
||||
you are on this project's Firefox because that is what it speaks. The three differ
|
||||
on engineering properties, but not on the axis people ask about here:
|
||||
|
||||
| Protocol | Cross-browser standard | `Runtime.enable`-style context leak | Control wire visible to the page | Protocol choice changes detectability |
|
||||
|---|---|---|---|---|
|
||||
| CDP | No (Chromium family) | Yes, until hand-patched at the driver | No | No |
|
||||
| WebDriver BiDi | Yes (W3C, multi-engine) | No such standardized clause | No | No |
|
||||
| Juggler | No (Firefox, this project) | No `Runtime.enable` command exists | No | No |
|
||||
|
||||
Then measure the
|
||||
things that actually decide detection, none of which the protocol choice sets.
|
||||
|
||||
The measurement that separates the real question from the imagined one is timing
|
||||
and page state against a stock browser on the same machine, not a protocol audit:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
PROBE = """
|
||||
() => {
|
||||
// 1. any global that a normal browser would not have?
|
||||
const suspects = Object.getOwnPropertyNames(window)
|
||||
.filter(n => /puppet|driver|automation|cdc_|selenium/i.test(n));
|
||||
// 2. rough JIT-sanity number; compare the RATIO to a stock browser
|
||||
const t = performance.now();
|
||||
for (let i = 0; i < 5e6; i++) Math.sqrt(i);
|
||||
const loopMs = performance.now() - t;
|
||||
// 3. did anything claim a user gesture nobody made?
|
||||
const ua = navigator.userActivation || {};
|
||||
return { suspects, loopMs, isActive: ua.isActive, webdriver: navigator.webdriver };
|
||||
}
|
||||
"""
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
print(page.evaluate(PROBE))
|
||||
```
|
||||
|
||||
Run the same probe in a stock browser and diff the results. The absolute loop
|
||||
number means nothing on its own; the ratio between the two browsers is the JIT
|
||||
signal. A non-empty `suspects` list is an injected-global leak. `webdriver` should
|
||||
read as it does on a clean browser. Every one of those is a page-level property,
|
||||
and every one of them would report the same value whether the tab was opened over
|
||||
CDP, BiDi or Juggler.
|
||||
|
||||
## Conclusion
|
||||
|
||||
WebDriver BiDi is worth adopting for what it is: one standard control protocol
|
||||
across browsers, which is a real convenience and a real cleanup. It is not a
|
||||
stealth upgrade, because it operates on the wrong axis. The `Runtime.enable` leak
|
||||
that made CDP notorious was a page-visible side effect of how one protocol managed
|
||||
contexts, fixed at the driver, not by changing wires. The leaks that remain,
|
||||
execution-context timing and injected globals, live in the page and the engine, and
|
||||
a standardized wire carries them as faithfully as a proprietary one. This project's
|
||||
Firefox never had the CDP leak because it does not speak CDP, and it closes the
|
||||
in-page leaks in the engine and driver, which is the layer where they actually are.
|
||||
Choose the protocol for engineering reasons and measure detection where it lives.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does switching from CDP to WebDriver BiDi make me undetectable?** No. The
|
||||
protocol is the control channel; the tells that flag automation are in the page and
|
||||
the engine, and they read the same over any wire.
|
||||
|
||||
**Was the CDP Runtime.enable leak a protocol problem?** It was a page-visible side
|
||||
effect of how CDP-driven Chromium managed execution contexts. The fix changes how
|
||||
the driver uses the protocol, not which protocol it is.
|
||||
|
||||
**Does this project have the Runtime.enable leak?** No. Its Firefox is driven over
|
||||
Juggler out of band, which has no `Runtime.enable` command, so the signal that
|
||||
several Chromium projects hand-patch never exists here to begin with.
|
||||
|
||||
**Is WebDriver BiDi bad, then?** Not at all. It is a solid cross-browser standard
|
||||
worth adopting for uniformity and stability. It just is not a detection fix,
|
||||
because detectability and protocol choice are orthogonal.
|
||||
|
||||
**What actually gives automation away if not the protocol?** Execution-context
|
||||
timing when the engine is left in a debug-adjacent mode, globals or touched
|
||||
built-in prototypes injected into the page realm, and behavior. All page-level or
|
||||
engine-level, none of them on the wire.
|
||||
|
||||
**How do I test my own setup?** Run a timing-and-globals probe in your automated
|
||||
browser and in a stock browser on the same machine, and diff them. The ratio, not
|
||||
the protocol name, is the signal.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's own debugger and execution-context fixes, described in
|
||||
[why an attached debugger makes automation detectable](debugger-timing-detection.md),
|
||||
for the in-page timing and injected-global leaks that survive a protocol change.
|
||||
- The [Patchright](vs-patchright.md) and [rebrowser-patches](vs-rebrowser-patches.md)
|
||||
comparisons on this site, read from each project's own repository, for what the
|
||||
CDP `Runtime.enable` fix is and is not.
|
||||
- The [WebDriver BiDi specification](https://www.w3.org/TR/webdriver-bidi/)'s own
|
||||
scope, for what a standardized control protocol standardizes and what it leaves
|
||||
to the engine.
|
||||
|
||||
**See also:** [why an attached debugger makes automation detectable](debugger-timing-detection.md)
|
||||
for the page-level leaks in detail, [invisible_playwright vs rebrowser-patches](vs-rebrowser-patches.md)
|
||||
for the CDP fix arrived at twice, and [how to test whether your browser is detected](how-to-test-bot-detection.md)
|
||||
for the compare-against-stock method this page leans on.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The protocol under
|
||||
the driver is an implementation detail; the leaks were never on the wire.*
|
||||
@@ -0,0 +1,223 @@
|
||||
---
|
||||
title: "Block images to speed up scraping (and when not to)"
|
||||
description: "Blocking images, fonts and media with route.abort() cuts bandwidth and wall-clock time, but a no-image waterfall is itself a tell. When to use it and when not to."
|
||||
parent: "Scraping with Playwright"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 92
|
||||
---
|
||||
|
||||
|
||||
# Block images to speed up scraping (and when not to)
|
||||
|
||||
Aborting image, font and media requests is one of the biggest speed wins available to a
|
||||
Playwright scraper, and it is two lines of code. It is also, on the wrong page, a clean
|
||||
way to get yourself noticed. A browser that fetches HTML and JavaScript and never a
|
||||
single image produces a request pattern no human session shows.
|
||||
|
||||
So this is not a pure win, and that is the reason it gets its own page. Blocking
|
||||
resources is the right call for internal test runs and for bulk data pulls where transfer
|
||||
cost dominates. It is the wrong call on exactly the sessions you most want to look human.
|
||||
This page covers what it saves, the two lines that do it, the tell it creates, and where
|
||||
the line between the two cases falls.
|
||||
|
||||
## What blocking resources actually saves
|
||||
|
||||
On most pages the HTML and the JavaScript are a small fraction of the bytes. Images,
|
||||
web fonts and any autoplaying media are the rest, and on an image-heavy listing page
|
||||
they are the large majority of the transfer. If your scraper only reads text, prices or
|
||||
structured data out of the DOM, every one of those bytes is downloaded and thrown away.
|
||||
|
||||
Aborting them changes two things you can measure:
|
||||
|
||||
- **Bandwidth.** On an image-heavy page the transfer routinely drops from a few megabytes
|
||||
to a few hundred kilobytes. Over tens of thousands of pages that is the difference
|
||||
between a proxy bill you notice and one you do not.
|
||||
- **Wall-clock time.** The page reaches its "loaded" state sooner because it is no longer
|
||||
waiting on the slowest large assets, and `page.goto` returns earlier. The saving is
|
||||
largest on pages that block rendering on fonts or lazy-load a wall of images.
|
||||
|
||||
The mechanic is stock Playwright, and it works identically under invisible_playwright:
|
||||
the wrapper returns a real Playwright `Browser`, so [`page.route` and `route.abort`](https://playwright.dev/python/docs/network#abort-requests)
|
||||
behave exactly as documented upstream. There is no special API to learn.
|
||||
|
||||
## The two lines that do it
|
||||
|
||||
Register a route handler, abort the resource types you do not need, and continue
|
||||
everything else. The launch is the usual two-line switch from stock Playwright.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# resource types that are pure weight for a text/data scrape
|
||||
BLOCK = {"image", "media", "font"}
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
|
||||
page.route(
|
||||
"**/*",
|
||||
lambda route: route.abort()
|
||||
if route.request.resource_type in BLOCK
|
||||
else route.continue_(),
|
||||
)
|
||||
|
||||
page.goto("https://example.com")
|
||||
print(page.title())
|
||||
```
|
||||
|
||||
The async form is the same shape:
|
||||
|
||||
```python
|
||||
from invisible_playwright.async_api import InvisiblePlaywright
|
||||
|
||||
BLOCK = {"image", "media", "font"}
|
||||
|
||||
async with InvisiblePlaywright(seed=42) as browser:
|
||||
page = await browser.new_page()
|
||||
|
||||
async def router(route):
|
||||
if route.request.resource_type in BLOCK:
|
||||
await route.abort()
|
||||
else:
|
||||
await route.continue_()
|
||||
|
||||
await page.route("**/*", router)
|
||||
await page.goto("https://example.com")
|
||||
print(await page.title())
|
||||
```
|
||||
|
||||
Two notes that save time later. Register the route **before** `goto`, or the first
|
||||
navigation's assets are already in flight before the handler exists. And keep
|
||||
`stylesheet` out of the block set unless you have checked the page: some layouts compute
|
||||
element positions from CSS, and dropping it can move the very nodes your selectors point
|
||||
at. `image`, `media` and `font` are the safe core; add `stylesheet` only after you
|
||||
confirm the DOM you read still resolves.
|
||||
|
||||
## The tell: a request waterfall no human produces
|
||||
|
||||
A real person's browser loads images, fetches the fonts the page asks for, and pulls the
|
||||
tracking pixel and the hero media without being told twice - and a scraper that refuses
|
||||
all three produces a request waterfall no human session shows. That is the honest
|
||||
caveat, and it is the whole reason this page is not just "block everything, go faster".
|
||||
|
||||
The network waterfall of a genuine session has a characteristic shape: a burst of mixed
|
||||
resource types, images arriving late and out of order, fonts blocking early paint. A
|
||||
session that fetches the HTML document and a handful of scripts and then goes silent has
|
||||
none of that shape. It is a request pattern that belongs to a scraper and to almost
|
||||
nothing else.
|
||||
|
||||
This is not a fingerprint that the engine can spoof. invisible_playwright is built to
|
||||
look like a real browser driven by a real person, and that is why it passes most
|
||||
detection: the [fingerprint, the TLS handshake and the driver layer read as a genuine
|
||||
Firefox](does-playwright-support-firefox-stealth.md). But *which requests you choose to
|
||||
make* is your behaviour, not the browser's identity. If your code refuses every image on
|
||||
a page a human would load, you have hand-built a behavioural tell that no stealth layer
|
||||
touches, the same category as a pointer that teleports or a form filled in eighty
|
||||
milliseconds. The [checklist for being flagged on one site](playwright-detected-as-bot.md)
|
||||
puts behaviour above the proxy for exactly this reason.
|
||||
|
||||
So the block set is a decision about the session, not a global optimisation you turn on
|
||||
once and forget.
|
||||
|
||||
## Where to block, and where not to
|
||||
|
||||
Split your work into two buckets and treat them differently.
|
||||
|
||||
**Block resources freely when load does not need to look human:**
|
||||
|
||||
- **Internal test runs and CI.** You are checking your own selectors and your own
|
||||
extraction, not passing anyone's inspection. Speed is the only axis that matters.
|
||||
- **Bulk data pulls where transfer cost dominates** and the endpoint is not scoring you,
|
||||
for example a site you have permission to crawl, an API-backed page, a
|
||||
[sitemap walk](how-to-scrape-a-sitemap-playwright.md) over thousands of URLs where the
|
||||
proxy bill is the real constraint.
|
||||
|
||||
**Leave images loading when the session needs to look human:**
|
||||
|
||||
- **The first visit to a page that is clearly scoring the session**, or any flow that
|
||||
starts behind a challenge. The seconds you save are not worth the waterfall shape.
|
||||
- **Anything interactive that a human would look at.** If the run
|
||||
[scrolls, clicks and reads](human-mouse-movement.md), it should also be pulling the
|
||||
images a reader would see.
|
||||
|
||||
A middle path exists and is often the right one: block the heaviest single type only.
|
||||
Dropping `media` and web `font` requests while still loading `image` keeps most of the
|
||||
human waterfall shape and still cuts real weight, because autoplaying video and large
|
||||
font files are frequently the worst offenders. Measure your own pages before deciding the
|
||||
block set is worth the tell.
|
||||
|
||||
## What this does not fix
|
||||
|
||||
Blocking resources is a speed and cost lever. It is not a stealth lever, and on its own
|
||||
it changes none of the things that actually decide whether a session gets through.
|
||||
|
||||
- **IP reputation.** A [datacenter or already-flagged
|
||||
exit](can-websites-detect-a-datacenter-proxy-ip.md) is visible before the first byte of
|
||||
HTML, and no route rule touches it. Supply a clean proxy yourself.
|
||||
- **Per-account quotas and rate limits.** Fetching fewer bytes per page does not raise a
|
||||
cap. If anything, going faster lets you hit it sooner, so pair aggressive blocking with
|
||||
[deliberate pacing](how-to-rate-limit-your-scraper-playwright.md).
|
||||
- **Behaviour and timing.** The waterfall shape above is one behavioural signal; pointer
|
||||
motion, dwell time and request cadence are others, and they are your responsibility, not
|
||||
the engine's.
|
||||
|
||||
invisible_playwright makes the browser read as a real Firefox. The clean proxy and the
|
||||
human pacing are the parts you bring. Blocking images speeds up the run; it does not move
|
||||
any of these three.
|
||||
|
||||
## Conclusion
|
||||
|
||||
`route.abort()` on `image`, `media` and `font` is a large, cheap speed and bandwidth win,
|
||||
and it works identically under invisible_playwright because the wrapper hands you a real
|
||||
Playwright browser. The catch is that a no-image request waterfall is a behavioural tell,
|
||||
so scope it: block freely on test runs and bulk pulls where load is the constraint, and
|
||||
leave images loading on the sessions you most want to read as human. When in doubt, block
|
||||
the heaviest type only and measure, rather than switching everything off and hoping the
|
||||
shape goes unnoticed.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does blocking images make Playwright faster?** Yes, often substantially, because images,
|
||||
fonts and media are usually the bulk of a page's bytes and a text scrape throws all of
|
||||
them away. Wall-clock time drops because the page stops waiting on the slowest assets.
|
||||
|
||||
**How do I block images in Playwright?** Register a `page.route("**/*", ...)` handler
|
||||
before `goto` and call `route.abort()` when `route.request.resource_type` is `image`,
|
||||
`media` or `font`, and `route.continue_()` otherwise.
|
||||
|
||||
**Does blocking images get me detected?** It can. A session that fetches HTML and scripts
|
||||
but never an image produces a request waterfall no human session shows. That is a
|
||||
behavioural tell, separate from your fingerprint, and no stealth layer hides it.
|
||||
|
||||
**Should I also block CSS and JavaScript?** Usually not. Many pages compute layout and
|
||||
render content from CSS and JavaScript, so blocking them can move or remove the nodes your
|
||||
selectors read. Start with `image`, `media` and `font` only.
|
||||
|
||||
**Will this make invisible_playwright undetectable?** No, and nothing does. It makes the
|
||||
browser read as a real Firefox, which is most of the battle, but IP reputation, account
|
||||
quotas, rate limits and timing are yours to handle with a clean proxy and human pacing.
|
||||
|
||||
**When should I not block images?** On the first visit to a page that is clearly scoring
|
||||
the session, and on any interactive flow a human would actually look at. There, looking
|
||||
human is worth more than the seconds you save.
|
||||
|
||||
## Sources
|
||||
|
||||
- Playwright's [request interception API](https://playwright.dev/python/docs/network#abort-requests)
|
||||
(`page.route`, `route.abort`, `route.continue_` and
|
||||
[`request.resource_type`](https://playwright.dev/python/docs/api/class-request#request-resource-type)),
|
||||
read from its own documentation rather than a rendered example.
|
||||
- This project's own measurements of per-page transfer on image-heavy pages, where images,
|
||||
fonts and media are consistently the majority of the bytes.
|
||||
- The behavioural-tell reasoning in this project's detection notes, where request shape is
|
||||
treated as behaviour rather than fingerprint.
|
||||
|
||||
**See also:** [pulling images down on purpose when you do want them](how-to-download-images-in-bulk-playwright.md),
|
||||
[the checklist for being detected on one site](playwright-detected-as-bot.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 speed is stock
|
||||
Playwright; the tell is the part the speed guides leave out.*
|
||||
@@ -0,0 +1,147 @@
|
||||
---
|
||||
title: "What BotD actually detects, and what it does not"
|
||||
description: "What BotD's twenty detectors actually check, read from its own source: mostly whether a browser is telling the truth about which engine it is, not automation."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 3
|
||||
---
|
||||
|
||||
|
||||
# What BotD actually detects, and what it does not
|
||||
|
||||
BotD is the open-source bot detector from the FingerprintJS team. It is small, it is
|
||||
readable, and reading it changes how you think about this problem, because most of
|
||||
its twenty detectors are not looking for automation at all.
|
||||
|
||||
They are checking whether your browser is telling the truth about **which browser it
|
||||
is**.
|
||||
|
||||
Read from source on 2026-07-27 (`fingerprintjs/BotD`, `src/detectors/`).
|
||||
|
||||
## The twenty detectors
|
||||
|
||||
```
|
||||
app_version distinctive_properties document_element_keys
|
||||
error_trace eval_length function_bind
|
||||
languages_inconsistency mime_types_consistence notification_permissions
|
||||
plugins_array plugins_inconsistency process
|
||||
product_sub rtt user_agent
|
||||
webdriver webgl window_external
|
||||
window_size
|
||||
```
|
||||
|
||||
Exactly one of those, [`webdriver`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/webdriver),
|
||||
is the check everybody knows. A handful look for
|
||||
specific named tools. The rest are engine identity and internal consistency.
|
||||
|
||||
| Detector group | The question it asks | Examples named here |
|
||||
|---|---|---|
|
||||
| The one everyone knows | Is the automation flag set? | `webdriver` |
|
||||
| Engine identity | Does the browser behave like the engine its user agent claims? | `eval_length`, `product_sub`, `error_trace`, `window_external` |
|
||||
| Internal consistency | Do two views of the same fact agree, and does a real machine and window exist? | `languages_inconsistency`, `mime_types_consistence`, `plugins_inconsistency`, `rtt`, `window_size` |
|
||||
|
||||
## The interesting group: what engine are you really?
|
||||
|
||||
Some values are decided by the JavaScript engine and cannot be changed from
|
||||
JavaScript without being obvious. BotD reads them, works out which engine you must
|
||||
be, and compares that against what your user agent claims.
|
||||
|
||||
**`eval_length`.** `eval.toString().length` is a fixed number per engine, the same
|
||||
category of leak as [any other native function's own source](tostring-native-code-detection.md).
|
||||
The check is literally: if the length is 37 and the engine kind is not WebKit or Gecko,
|
||||
that is a bot. A Chromium build claiming to be Firefox fails here on a value nobody thinks
|
||||
to spoof.
|
||||
|
||||
**`product_sub`.** If the browser claims to be Chrome, Safari, Opera or WeChat, then
|
||||
[`navigator.productSub`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/productSub)
|
||||
must be `20030107`. Firefox reports `20100101`. One
|
||||
comparison, no ambiguity ([why a real Firefox reports `20100101`](navigator-vendor-productsub-firefox.md)).
|
||||
|
||||
**`error_trace`.** Stack traces are formatted differently by different engines, and
|
||||
the detector matches the string for known tool signatures, PhantomJS among them.
|
||||
|
||||
**`function_bind`**, **`window_external`**, **`app_version`**: the same idea on other
|
||||
surfaces. `window_external` matches `window.external.toString()` against a known
|
||||
commercial crawler's signature.
|
||||
|
||||
None of these are secret. They are just values a spoofing layer does not think about,
|
||||
because they are not on the list of "things bots are known for".
|
||||
|
||||
## The second group: does your story hold together?
|
||||
|
||||
This group never asks whether a value is unusual. It asks whether two values that
|
||||
must agree actually do, and whether a real machine and window are behind them.
|
||||
|
||||
**`languages_inconsistency`**, **`mime_types_consistence`**,
|
||||
**`plugins_inconsistency`**: the same fact asked in two ways, with the answers
|
||||
compared. Not "is this value unusual" but "do these two agree".
|
||||
|
||||
**`rtt`**, **`window_size`**: values a real machine and a real window have, and a
|
||||
container often does not.
|
||||
|
||||
**`document_element_keys`** and **`distinctive_properties`**: attributes and globals
|
||||
that specific automation tools leave behind, which is the closest BotD gets to
|
||||
looking for bots directly.
|
||||
|
||||
## What this means if you are on the other side
|
||||
|
||||
Three things follow: spoofing a user agent alone tends to make a browser easier to
|
||||
detect rather than harder, being a genuine instance of the engine you claim passes
|
||||
this whole detector class for free, and the risk BotD does not touch moves to other
|
||||
signals entirely. They are the same three that turn up everywhere in this area.
|
||||
|
||||
**[Spoofing a user agent alone is worse than not spoofing it](is-changing-user-agent-enough.md).** Change the string and
|
||||
you have to change `productSub`, `eval.toString().length`, the stack-trace format,
|
||||
`window.external`, and the plugin and MIME arrays to match, or you have created the
|
||||
exact contradiction BotD is built to find. Most user-agent spoofing makes a browser
|
||||
easier to detect, not harder.
|
||||
|
||||
**Being a real instance of what you claim passes this whole class for free.** A real
|
||||
Firefox reporting Firefox has the right `productSub`, the right `eval` length, the
|
||||
right stack format and the right plugin array, because they are not claims, they are
|
||||
the engine. There is nothing to keep consistent because nothing was changed.
|
||||
|
||||
**The remaining risk moves elsewhere.** Passing every one of these twenty says
|
||||
nothing about whether [your GPU string is plausible](webgl-renderer-strings.md), your
|
||||
fonts match your platform, or [your timezone agrees with your IP](timezone-proxy-mismatch.md).
|
||||
Those are the ones that decide modern outcomes and BotD does not look at them.
|
||||
|
||||
## Checking your own
|
||||
|
||||
BotD is on npm and takes about four lines to run. Do it on the machine that will do
|
||||
the work instead of your laptop, and read which detectors fired rather than the
|
||||
verdict.
|
||||
|
||||
If any of the engine-identity group fires, stop and fix that first: it means the
|
||||
browser you are presenting is not the browser you are running, and no amount of work
|
||||
on the other surfaces compensates for that.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What is BotD?** The open-source bot detector from the FingerprintJS team. It runs in
|
||||
the page and returns a verdict rather than a fingerprint.
|
||||
|
||||
**Is BotD the same as FingerprintJS?** No. FingerprintJS
|
||||
[identifies a visitor across sessions](fingerprintjs-visitor-id.md). BotD answers a
|
||||
different question: is this automation.
|
||||
|
||||
**Why does most of it not look like bot detection?** Because most detectors check which
|
||||
browser engine you really are, by testing behaviours that differ between engines. A
|
||||
browser claiming one engine and behaving like another is the finding.
|
||||
|
||||
**Can I pass it by setting `navigator.webdriver` to undefined?** No. That is
|
||||
[one detector out of roughly twenty](navigator-webdriver-explained.md).
|
||||
|
||||
**Does passing BotD mean I am undetected?** It means one open-source detector found
|
||||
nothing. Commercial systems combine far more, including things no in-page script can
|
||||
see.
|
||||
|
||||
**See also:** [what sannysoft checks](sannysoft-explained.md), which is the older
|
||||
list of the same kind, and [how CreepJS detects tampering](creepjs-explained.md),
|
||||
which takes the consistency idea considerably further.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright).
|
||||
We gate every release on BotD, so the detector names and the compared values above
|
||||
come out of its source and not out of memory.*
|
||||
@@ -0,0 +1,159 @@
|
||||
---
|
||||
title: "Browser extensions are a fingerprint surface"
|
||||
description: "An installed browser extension is a fingerprint surface a page can detect three ways. How sites find extensions, and why a stealth extension backfires."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 12
|
||||
---
|
||||
|
||||
|
||||
# Browser extensions are a fingerprint surface
|
||||
|
||||
Yes, a website can detect an installed browser extension, and it can do so three
|
||||
separate ways: by probing the resources the extension exposes, by watching what it
|
||||
changes on the page, and by spotting the traces its API overrides leave behind. So an
|
||||
extension is not just a feature you add. It is another
|
||||
[fingerprint surface](what-is-a-browser-fingerprint.md), and the most common reason
|
||||
people add one is to hide a fingerprint, which is where this gets circular.
|
||||
|
||||
Adding an extension to an automated browser feels like adding a feature. It is also
|
||||
adding something a page can look for, and the sections below cover each of the three
|
||||
detection paths, when an extension is safe to run, and how to load one into a Firefox
|
||||
profile if you decide to.
|
||||
|
||||
## The three ways a page finds an extension
|
||||
|
||||
**[Web-accessible resources](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/web_accessible_resources).**
|
||||
An extension that exposes files to pages does so at a URL containing its own
|
||||
identifier. Fetch that URL and see whether it loads.
|
||||
|
||||
```js
|
||||
fetch('moz-extension://<id>/<file>') // resolves only if that extension is here
|
||||
```
|
||||
|
||||
The identifier differs per browser and, in Firefox, per profile, which limits the
|
||||
scan. It does not eliminate it, because extensions that need page access often need
|
||||
predictable resources.
|
||||
|
||||
**What it does to the page.** An ad blocker removes elements, so a page can insert a
|
||||
bait element with a name matching a common filter list and check whether it survived.
|
||||
A style-injecting extension changes computed values. Anything that modifies the DOM
|
||||
leaves the modification behind, and the modification is the detection.
|
||||
|
||||
**The behaviour it adds.** An extension that patches `navigator` or the canvas has to
|
||||
run before the page, and it leaves the same traces as any other page-level override:
|
||||
own properties where prototypes are expected, getters that are not native,
|
||||
[a `toString` that prints your source](tostring-native-code-detection.md).
|
||||
|
||||
## Why a stealth extension is usually the wrong shape
|
||||
|
||||
A stealth extension on top of a stealth engine usually makes you easier to detect, not
|
||||
harder, because two components deciding the same values contradict each other. This is
|
||||
worth stating plainly, because it is the most common reason someone asks how to load
|
||||
one.
|
||||
|
||||
A stealth extension operates at the page layer. It runs inside the document, it is
|
||||
made of JavaScript, and everything on
|
||||
[the three levels page](playwright-stealth-levels.md) about that layer applies to it. It
|
||||
also has to run before the page's own scripts, which is a race it does not always win.
|
||||
|
||||
And if the browser already sets those values in its engine, the extension is now a
|
||||
second opinion arguing with the first. Two components deciding what `navigator` says do
|
||||
not average out; they disagree, and the disagreement is easier to spot than either
|
||||
answer alone. That is the same argument as
|
||||
[turning off a crawler's own fingerprint generator](playwright-detected-as-bot.md).
|
||||
|
||||
So: extensions for functionality, yes. Extensions for stealth on top of a stealth
|
||||
engine, no.
|
||||
|
||||
## Extensions that are fine, and how to think about the rest
|
||||
|
||||
Ask what the extension does to the page:
|
||||
|
||||
- **Nothing visible to the page.** A tab manager, something that only touches its own
|
||||
UI. Effectively invisible.
|
||||
- **Changes what the page sees.** Blockers, style injectors, script managers. Findable,
|
||||
and worth knowing that ad blockers are extremely common on real browsers, so their
|
||||
presence is not by itself unusual. Their *absence* is more unusual than people
|
||||
assume.
|
||||
- **Rewrites browser APIs.** The fingerprinting-protection kind. These are the ones
|
||||
that create the arguing-with-the-engine problem.
|
||||
|
||||
The second point deserves emphasis, because it cuts against the instinct. A very large
|
||||
share of real browsers run an ad blocker. A profile that carries none is not
|
||||
suspicious on its own, but it is one more small way in which a fresh automated profile
|
||||
differs from a used personal one, alongside
|
||||
[having no cookies](recaptcha-v3-score.md).
|
||||
|
||||
## How to load one, if you decide to
|
||||
|
||||
There is no extension argument in this wrapper. What there is is a
|
||||
[persistent profile](persistent-profiles.md), and an extension installed into that
|
||||
profile stays there:
|
||||
|
||||
```python
|
||||
with InvisiblePlaywright(seed=42, profile_dir="/path/to/profile") as browser:
|
||||
...
|
||||
```
|
||||
|
||||
Launch once with that path, install the `.xpi` the normal way through the browser's own
|
||||
add-ons page, then reuse the directory. Without `profile_dir`, every session builds a
|
||||
fresh profile from the seed, which is exactly why an extension installed in one run is
|
||||
gone in the next.
|
||||
|
||||
Pair a stable profile with a [stable seed](reproducible-agent-browser-identity-seed.md).
|
||||
A profile that accumulates cookies and
|
||||
storage while the hardware it claims changes every launch is a session whose history
|
||||
and machine disagree about how long it has existed.
|
||||
|
||||
## Checking what yours is exposing
|
||||
|
||||
```js
|
||||
// does a known resource resolve?
|
||||
fetch('moz-extension://<id>/manifest.json').then(r => console.log('present', r.status))
|
||||
.catch(() => console.log('not found'));
|
||||
|
||||
// did something remove my bait element?
|
||||
const bait = document.createElement('div');
|
||||
bait.className = 'ad-banner ads adsbox';
|
||||
bait.style.height = '10px';
|
||||
document.body.appendChild(bait);
|
||||
setTimeout(() => console.log('blocked:', bait.offsetHeight === 0), 100);
|
||||
```
|
||||
|
||||
Then run the same checks with no extensions loaded and compare. Anything that differs
|
||||
is what the extension is telling the page about you.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can websites detect browser extensions?** Yes, through web-accessible resources,
|
||||
through what the extension does to the page, and through the traces any API override
|
||||
leaves.
|
||||
|
||||
**Does using an ad blocker make me more detectable?** It makes you findable, not
|
||||
unusual. Ad blockers are very common on real browsers.
|
||||
|
||||
**Should I use a stealth extension with a stealth browser?** No. Two layers deciding
|
||||
the same values contradict each other, and the contradiction is a stronger signal than
|
||||
either.
|
||||
|
||||
**How do I add an extension in Playwright with Firefox?** Through a persistent profile:
|
||||
install it once into that profile, then reuse the directory.
|
||||
|
||||
**Why does my extension disappear between runs?** Because a fresh profile is generated
|
||||
each launch unless you pass a persistent one.
|
||||
|
||||
**Are extension IDs the same everywhere?** In Firefox they are typically per-profile,
|
||||
which limits blind scanning. Do not rely on that as protection; extensions that need
|
||||
page access tend to expose predictable resources anyway.
|
||||
|
||||
**See also:** [Function.prototype.toString and the native code check](tostring-native-code-detection.md),
|
||||
which is what a page-level extension runs into, and
|
||||
[three ways to make Playwright undetected](playwright-stealth-levels.md), for why the
|
||||
layer an extension lives at has a ceiling.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. This page exists because someone asked in our
|
||||
discussions and got an answer about a different kind of extension entirely.*
|
||||
@@ -0,0 +1,262 @@
|
||||
---
|
||||
title: "Browser trust scores explained: what the number means"
|
||||
description: "CreepJS trust, FingerprintJS confidence and reCAPTCHA v3 score measure different things: what each trust score means and why one green does not imply the rest."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 8
|
||||
---
|
||||
|
||||
|
||||
# Browser trust scores explained: what the number means
|
||||
|
||||
CreepJS trust, FingerprintJS confidence and a reCAPTCHA v3 score all look like the
|
||||
same kind of number, and they are not: one counts contradictions, one measures how
|
||||
sure a match is, and one estimates behavioural risk. A high number from one says
|
||||
almost nothing about what the next one will read, and treating them as interchangeable
|
||||
is the single most common misreading behind "I pass one test and fail the next".
|
||||
|
||||
This page separates the three numbers people conflate, says what each one is actually
|
||||
counting, and shows why passing one implies nothing about the others. Then it shows
|
||||
how to read all three from one reproducible session so you can stop guessing which
|
||||
number moved.
|
||||
|
||||
## Three numbers, three different questions
|
||||
|
||||
The three numbers answer three unrelated questions: CreepJS trust asks whether your
|
||||
values contradict each other, a FingerprintJS visitor ID asks whether you are the same
|
||||
visitor as last time, and a reCAPTCHA v3 score asks how risky your behaviour and history
|
||||
look. Line them up and the confusion evaporates:
|
||||
|
||||
- **CreepJS trust** is a consistency and lie count. It is high when nothing you report
|
||||
contradicts anything else you report and nothing looks tampered with. It is not a
|
||||
rarity score, and being unusual does not lower it.
|
||||
- **A FingerprintJS visitor ID** is a hash, and the thing next to it labelled
|
||||
**confidence** is a separate number that says how sure the library is that this ID
|
||||
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.
|
||||
|
||||
| Number | The question it answers | What it reads | What moves it |
|
||||
|---|---|---|---|
|
||||
| CreepJS trust | Do my reported values contradict each other? | Descriptors, prototypes, stack traces, canvas and font surfaces | A patched or blocked probe, or two fields that disagree |
|
||||
| FingerprintJS visitor ID (+ confidence) | Am I the same visitor as before? | A hash of the browser's components, in a fixed order | Any one component changing changes the whole ID |
|
||||
| reCAPTCHA v3 score | How risky do my behaviour and history look? | Interaction, cookies, storage and exit reputation, not the DOM | A warmed-up profile and realistic behaviour, not a cleaner fingerprint |
|
||||
|
||||
Different inputs, different outputs, different failure modes. The rest of this page is
|
||||
one section per number, then why they do not move together.
|
||||
|
||||
## CreepJS trust: a lie count, not a rarity score
|
||||
|
||||
[CreepJS records a blocked probe as a lie](creepjs-explained.md) and walks
|
||||
descriptors, prototypes and stack traces looking for values that were patched after
|
||||
the fact. Its trust figure goes up when the surfaces agree with each other and down
|
||||
when one of them looks edited or refuses to answer.
|
||||
|
||||
The part people get wrong: rarity does not enter into it. An identity that no other
|
||||
machine on earth shares can score perfectly, as long as every field is internally
|
||||
coherent. Conversely, the most common machine in the world scores badly the moment two
|
||||
of its fields disagree, because a lie is a contradiction and a contradiction is what
|
||||
this tool counts.
|
||||
|
||||
So the way to raise this number is not to look average. It is to be consistent: one
|
||||
platform reported everywhere, a canvas that hashes the same twice in a row, a font
|
||||
list that belongs to the operating system you claim. That is a property of how the
|
||||
identity is generated, not a value you can paste in.
|
||||
|
||||
## The FingerprintJS visitor ID and its separate confidence
|
||||
|
||||
[A FingerprintJS visitor ID is a hash of its components](fingerprintjs-visitor-id.md),
|
||||
around forty-one of them, serialised in a fixed order. There is no partial match:
|
||||
change one component and the whole ID changes as if everything had. That is why the
|
||||
same identity gives you the same ID and a different identity gives you a completely
|
||||
different one, with nothing in between.
|
||||
|
||||
The `confidence` sitting beside the ID is a different number entirely. It does not tell
|
||||
you whether you look automated. It tells you how reliable the library thinks this
|
||||
particular match is, based on how stable the components it collected tend to be. You
|
||||
can have a low-confidence ID on a perfectly clean browser and a high-confidence ID on a
|
||||
browser that is obviously a bot. The two numbers are answering "who is this" and "how
|
||||
sure am I", and neither is answering "is this a robot".
|
||||
|
||||
If your goal is to be recognised again, you want this ID stable. If your goal is to not
|
||||
be recognised, you want it to change. Either way, it is orthogonal to the trust number
|
||||
above.
|
||||
|
||||
## The reCAPTCHA v3 score: behaviour and history, not the DOM
|
||||
|
||||
reCAPTCHA v3 hands the site a number between 0.0 and 1.0, and
|
||||
[a fresh browser tends to score low on reCAPTCHA v3](recaptcha-v3-score.md) even when
|
||||
every fingerprint check it faces comes back clean. The reason is that this score is
|
||||
largely about history and behaviour, and a brand new profile has neither.
|
||||
|
||||
An empty profile is a browser that has never been anywhere: no cookies, no consent
|
||||
decisions, no storage, no prior interaction. There are far more automated sessions that
|
||||
look like that than human ones, and the score reflects that base rate rather than any
|
||||
DOM property you did or did not spoof. Perfecting your canvas hash does not move a
|
||||
number that was never reading your canvas.
|
||||
|
||||
This is the honest caveat the other two numbers do not carry: a stable, consistent,
|
||||
non-lying fingerprint is necessary and not sufficient here. It removes the reasons to
|
||||
distrust you; it does not manufacture the past you do not have. That part is warmed-up
|
||||
profiles, realistic behaviour and a reputable exit, none of which a fingerprint layer
|
||||
can supply.
|
||||
|
||||
## Why passing one says nothing about the others
|
||||
|
||||
The three numbers are independent, so a high score on one predicts nothing about the
|
||||
other two. Put them side by side and the independence is obvious:
|
||||
|
||||
- You can score high on CreepJS trust and low on reCAPTCHA v3, because a perfectly
|
||||
consistent browser with no history is exactly what a consistent bot also looks like.
|
||||
- You can have a stable, high-confidence FingerprintJS ID and still fail CreepJS,
|
||||
because a stable ID only means your components did not move, not that they are
|
||||
telling the truth.
|
||||
- You can pass reCAPTCHA v3 on a warmed profile and fail CreepJS, because behavioural
|
||||
reputation says nothing about whether a descriptor was patched.
|
||||
|
||||
They cross-cut. Each of the [four detector deep-dives in this set](how-to-test-bot-detection.md)
|
||||
measures a different axis, and a green on one axis is not a green on the others. The
|
||||
practical rule is to name which number you are looking at before you react to it,
|
||||
because the fix for a low CreepJS trust (consistency) is not the fix for a low
|
||||
reCAPTCHA v3 score (history), and applying one to the other wastes days.
|
||||
|
||||
## A blocked probe lowers the score, it does not hide from it
|
||||
|
||||
One instinct makes all three numbers worse at once: suppressing a signal. Blocking
|
||||
canvas, returning an empty font list, refusing WebRTC, randomising a value per call so
|
||||
nothing can pin it.
|
||||
|
||||
Every one of those is counted against you, not for you:
|
||||
|
||||
- CreepJS records a blocked probe as a lie by name, so blocking lowers trust directly.
|
||||
- A value that changes on every read is a tampering tell, and a per-call-changing
|
||||
canvas or audio hash reads as randomisation rather than a real device.
|
||||
- A missing signal is still a signal. An empty result where a real browser has data is
|
||||
itself the anomaly.
|
||||
|
||||
The consistency that raises a trust number is the opposite of hiding. This is why a
|
||||
seed-derived identity, where every surface is drawn from one seed and stays put, scores
|
||||
better than any suppression strategy: it answers every probe with a coherent value
|
||||
instead of a refusal.
|
||||
|
||||
## Measure all three from one seeded session
|
||||
|
||||
The way to stop guessing which number moved is to make the identity reproducible, so a
|
||||
change in a score is a change you made rather than a change in the draw. The wrapper is
|
||||
stock Playwright with a seeded fingerprint, so the `browser` you get back is a real
|
||||
Playwright `Browser` and every method is the one you already know:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
def read_canvas(page):
|
||||
return page.evaluate("""() => {
|
||||
const c = document.createElement('canvas');
|
||||
const ctx = c.getContext('2d');
|
||||
ctx.textBaseline = 'top';
|
||||
ctx.font = '14px Arial';
|
||||
ctx.fillText('trust-score-probe', 2, 2);
|
||||
return c.toDataURL();
|
||||
}""")
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
first = read_canvas(page)
|
||||
second = read_canvas(page)
|
||||
assert first == second # stable within a session, so not a per-call tell
|
||||
```
|
||||
|
||||
Reading the same value twice in one session is the cheapest consistency check there
|
||||
is: if `first` and `second` disagree, something is randomising per call, which is the
|
||||
exact tampering pattern that costs you CreepJS trust. Here they match, which is the
|
||||
behaviour you want.
|
||||
|
||||
Now confirm it is stable across sessions too, which is what keeps a FingerprintJS ID
|
||||
where you put it, and what a consistency check rewards:
|
||||
|
||||
```python
|
||||
def canvas_for_seed(seed):
|
||||
with InvisiblePlaywright(seed=seed) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
return read_canvas(page)
|
||||
|
||||
a = canvas_for_seed(42)
|
||||
b = canvas_for_seed(42) # same seed, relaunched
|
||||
c = canvas_for_seed(7) # a different identity
|
||||
|
||||
assert a == b # same seed reproduces the same machine
|
||||
assert a != c # a different seed is a different, still-consistent machine
|
||||
```
|
||||
|
||||
Measured this way, the same seed reproduces byte-identical canvas output run after run,
|
||||
and a different seed produces a different value that is itself internally consistent.
|
||||
That reproducibility is what lets you attribute a score change to the one thing you
|
||||
changed. If you have not passed a seed, log `sf.seed` from the instance first so a run
|
||||
that scored interestingly can be replayed exactly.
|
||||
|
||||
The honest boundary, again: this makes the CreepJS-style consistency axis and the
|
||||
FingerprintJS linkability axis controllable and repeatable. It does not warm up a
|
||||
profile, and the reCAPTCHA v3 number will still start low on a session with no past no
|
||||
matter how clean the fingerprint is.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Three numbers, three axes. CreepJS trust counts contradictions and lies, a
|
||||
FingerprintJS ID and its confidence measure whether you are the same visitor as before,
|
||||
and a reCAPTCHA v3 score estimates risk from behaviour and history. Passing one is not
|
||||
passing another, suppressing a signal lowers all three rather than hiding from any of
|
||||
them, and the only way to tell which number your last change actually moved is to hold
|
||||
the identity still with a seed and compare. Name the axis before you react to the
|
||||
number, and the contradictory results stop being contradictory.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Is a CreepJS trust score the same as a reCAPTCHA score?** No. CreepJS trust counts
|
||||
internal contradictions and tampering; a reCAPTCHA v3 score is a 0.0 to 1.0 risk
|
||||
estimate built mostly from behaviour and history. A high one does not predict the
|
||||
other.
|
||||
|
||||
**What does the FingerprintJS confidence number mean?** How sure the library is that
|
||||
this visitor ID matches the same visitor as before. It is about the reliability of the
|
||||
match, not about whether the browser looks automated.
|
||||
|
||||
**I pass CreepJS but still get a low reCAPTCHA score, why?** Because reCAPTCHA v3 is
|
||||
mostly reading history and behaviour, and a fresh profile has neither. A clean
|
||||
fingerprint removes reasons to distrust you; it does not supply a past.
|
||||
|
||||
**Does a rare fingerprint lower my trust score?** No. CreepJS trust is about
|
||||
consistency, not rarity. An unusual but coherent identity can score perfectly; a common
|
||||
but contradictory one scores badly.
|
||||
|
||||
**Does blocking canvas or fonts raise my score?** It lowers it. A blocked probe is
|
||||
recorded as a lie, and a value that changes per read is a tampering tell. Answering
|
||||
every probe with a coherent value scores better than refusing.
|
||||
|
||||
**Which score should I optimise for?** The one your target actually uses. Optimise
|
||||
consistency for a CreepJS-style check, a warmed profile and realistic behaviour for a
|
||||
reCAPTCHA-style score, and decide whether you want the FingerprintJS ID to stay put or
|
||||
change.
|
||||
|
||||
## Sources
|
||||
|
||||
- The three detectors named above, each with its own page in this set, read from their
|
||||
own source rather than from a rendered verdict: CreepJS on tampering, FingerprintJS on
|
||||
the hashed visitor ID and its confidence, and reCAPTCHA v3 on the behavioural score.
|
||||
- This project's own reproducibility measurements: identical seed reproduces
|
||||
byte-identical canvas output within and across sessions, which is the property a
|
||||
consistency check rewards.
|
||||
|
||||
**See also:** [how CreepJS decides you are lying](creepjs-explained.md) for the
|
||||
consistency axis, [why a fresh browser scores low on reCAPTCHA v3](recaptcha-v3-score.md)
|
||||
for the history axis, and [how to test whether your browser is detected](how-to-test-bot-detection.md)
|
||||
for the compare-against-a-stock-browser method that keeps these numbers honest.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The three numbers on this
|
||||
page get conflated because they all look like a percentage; none of them are the same
|
||||
percentage.*
|
||||
@@ -0,0 +1,190 @@
|
||||
---
|
||||
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."
|
||||
parent: "AI Agents and Frameworks"
|
||||
grand_parent: "Guides"
|
||||
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 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.
|
||||
|
||||
## What browser-use gives you to change
|
||||
|
||||
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.*
|
||||
@@ -0,0 +1,244 @@
|
||||
---
|
||||
title: "BrowserLeaks canvas and WebGL hash, explained"
|
||||
description: "The BrowserLeaks canvas and WebGL signature is a hash of a pixel readback, not your GPU. What it measures, and why one seed gives a byte-identical hash."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 6
|
||||
---
|
||||
|
||||
|
||||
# BrowserLeaks canvas and WebGL hash, explained
|
||||
|
||||
The BrowserLeaks canvas and WebGL signature is a hash of the pixels a readback call
|
||||
returns, not a fingerprint of your GPU. It sits at the very end of the render pipeline,
|
||||
which is why editing a reported renderer string never moves it, and why the only way to
|
||||
control it is to control the bytes handed back at the readback boundary. Get that boundary
|
||||
right and one seed produces a byte-identical hash on Windows and Linux alike.
|
||||
|
||||
BrowserLeaks shows you a canvas "signature" and a WebGL "signature" and treats each as a
|
||||
stable identifier for your machine (see [what each BrowserLeaks panel tests](browserleaks-explained.md)
|
||||
for the wider tour). People read those short hex strings as a fingerprint
|
||||
of the GPU, and then try to change the GPU to change them. That is the wrong layer. The
|
||||
signature is a hash of one specific thing, and once you know which thing, the whole
|
||||
surface reads differently.
|
||||
|
||||
This page is what the signature measures, where in the pipeline it is actually taken, what
|
||||
has to be true for two machines to produce the same one, and how to read both values
|
||||
yourself against a stock browser.
|
||||
|
||||
## What BrowserLeaks calls a signature
|
||||
|
||||
The canvas test draws text and shapes into an off-screen canvas, then asks the page to
|
||||
read the resulting pixels back out and hashes them. The WebGL test does the same with a
|
||||
rendered 3D scene. In both cases the "signature" you see is the hash of the pixel bytes,
|
||||
not of any property you can enumerate.
|
||||
|
||||
That distinction matters because the pixel bytes are the product of a long chain: the
|
||||
font rasterizer, the anti-aliasing, the GPU, the driver, the compositor. Two machines that
|
||||
report the same WebGL renderer string can still hash differently, because the string and
|
||||
the pixels are decided by different code. The signature is downstream of everything, which
|
||||
is exactly why detectors like it and exactly why it is hard to fake by editing properties.
|
||||
[The renderer string and the pixels it implies are two separate surfaces](renderer-string-vs-render.md),
|
||||
and a mismatch between them is its own tell.
|
||||
|
||||
## The readback is the only thing JavaScript can see
|
||||
|
||||
JavaScript never sees the render surface directly; the only bytes a page can obtain are the
|
||||
ones a readback call hands back. The GPU draws into memory the page has no handle on. The
|
||||
only way script gets any pixels at all is by calling a readback method -
|
||||
[`getImageData`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/getImageData),
|
||||
`toDataURL`, `toBlob` on the 2D side,
|
||||
[`readPixels`](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/readPixels)
|
||||
on the WebGL side - and those methods are
|
||||
the single point where the rendered pixels cross from the engine into script.
|
||||
|
||||
So the signature is not a measurement of your GPU. It is a measurement of whatever those
|
||||
readback calls return. If the bytes handed back at that boundary are a pure function of a
|
||||
seed, the signature is a pure function of the seed, and the GPU underneath stops mattering
|
||||
to the hash entirely.
|
||||
|
||||
That is the whole strategy in one sentence: the render can depend on the host all it likes,
|
||||
because the host contribution is overwritten before any script can observe it.
|
||||
|
||||
## What our substitution does at that point
|
||||
|
||||
At each readback boundary, the pixels the page receives are replaced with values derived
|
||||
from the seed and the position of the pixel, roughly `hash(seed, pixel_index)` per byte.
|
||||
The scene is still drawn, so timing and shape and side effects all behave like a real
|
||||
render, but the bytes that come back out are seed-determined rather than GPU-determined.
|
||||
|
||||
Two consequences follow directly:
|
||||
|
||||
- Read the canvas twice in one session and the hash is identical, because the same seed
|
||||
and the same pixel positions produce the same bytes. A hash that changes between two
|
||||
reads in one session is the cheapest tampering signal there is, and
|
||||
[per-call noise is exactly what a consistency probe is built to catch](canvas-fingerprint-noise.md).
|
||||
- Two different operating systems running the same seed return the same bytes, because
|
||||
nothing host-specific survives to the readback. That is the property the next section is
|
||||
about.
|
||||
|
||||
Because the substitution happens where the pixels are read rather than where they are
|
||||
drawn, it covers the indirect readback paths too - drawing the canvas into another canvas
|
||||
and reading that, capturing it as an image bitmap and reading that - since every one of
|
||||
them still ends at a readback call, and the readback is what gets replaced.
|
||||
|
||||
## Why a byte-identical hash across OSes is the real test
|
||||
|
||||
A stealth build that merely perturbs the canvas looks fine on one machine and falls apart
|
||||
across a fleet, because the perturbation rides on top of a host render that still differs
|
||||
between Windows and Linux. The honest test is not "did the hash change", it is "do two
|
||||
different hosts, same seed, produce the same hash to the byte".
|
||||
|
||||
Measured on this build, same seed on Windows and on Linux, read in the page the way
|
||||
BrowserLeaks reads it: the canvas signature is `df2a9319` on both, and the WebGL signature
|
||||
is `0df1d6f8` on both. Not close, identical.
|
||||
|
||||
| Signature | Windows | Linux | Match |
|
||||
|---|---|---|---|
|
||||
| Canvas | `df2a9319` | `df2a9319` | byte-identical |
|
||||
| WebGL | `0df1d6f8` | `0df1d6f8` | byte-identical |
|
||||
|
||||
Across a batch of sixteen distinct seeds run
|
||||
through a full fingerprinting suite, zero of sixteen failed the cross-host check on either
|
||||
operating system. That is the number that says the host contribution is actually gone
|
||||
rather than merely reduced, and it is the same guarantee the
|
||||
[canvas and WebGL cross-platform consistency page](canvas-webgl-cross-platform-consistency.md)
|
||||
describes from the engine side.
|
||||
|
||||
The reason this is worth insisting on: a server render and a laptop render disagreeing is
|
||||
one of the most common ways an otherwise-good identity gets linked across a fleet. If the
|
||||
hash is byte-identical by construction, that entire class of leak is closed rather than
|
||||
papered over.
|
||||
|
||||
## The low-entropy render left alone, and why
|
||||
|
||||
There is a trap in overwriting every readback unconditionally. Some pages do not draw a
|
||||
fingerprint scene at all - they draw a tiny reference block, a flat rectangle of one or two
|
||||
colours, precisely to check whether a browser is tampering with canvas output. A masking
|
||||
scanner expects that reference to come back byte-exact. If your substitution rewrites it,
|
||||
you have announced that you rewrite canvas reads, which is worse than any GPU string.
|
||||
|
||||
So the substitution has a threshold. A render with more than sixteen distinct colours is a
|
||||
real fingerprint scene and gets the full overwrite. A render at or below sixteen distinct
|
||||
colours is treated as a low-entropy reference and is left byte-exact, so its hash stays the
|
||||
global constant a masking scanner expects to see. The high-entropy scene is spoofed; the
|
||||
probe render is untouched. A detector looking for tampering on its reference block finds
|
||||
none, and a detector reading the fingerprint scene gets a clean, seed-stable, host-free
|
||||
hash.
|
||||
|
||||
This is the difference between hiding a signal and blocking it. Blocking canvas entirely,
|
||||
or scrambling every read, is itself a loud signal - the kind
|
||||
[a suppressed surface leaves behind](how-to-test-bot-detection.md). Leaving the reference
|
||||
render exact while making the fingerprint render seed-deterministic is what keeps the
|
||||
surface quiet.
|
||||
|
||||
## Reading the two hashes yourself
|
||||
|
||||
You do not need the detector's page to see this. Draw a canvas, read it back the way the
|
||||
signature is computed, and print the hash. Do it twice in one session to confirm stability,
|
||||
then relaunch with the same seed to confirm reproducibility.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
READBACK = """
|
||||
() => {
|
||||
const c = document.createElement('canvas');
|
||||
c.width = 300; c.height = 60;
|
||||
const ctx = c.getContext('2d');
|
||||
ctx.textBaseline = 'alphabetic';
|
||||
ctx.font = '16px sans-serif';
|
||||
ctx.fillStyle = '#069';
|
||||
ctx.fillText('signature check', 4, 40);
|
||||
ctx.strokeStyle = 'rgba(120,0,90,0.7)';
|
||||
ctx.beginPath(); ctx.arc(240, 30, 20, 0, Math.PI * 2); ctx.stroke();
|
||||
// the readback: the one point JavaScript sees the render
|
||||
const bytes = ctx.getImageData(0, 0, c.width, c.height).data;
|
||||
let h = 0x811c9dc5;
|
||||
for (let i = 0; i < bytes.length; i++) {
|
||||
h ^= bytes[i];
|
||||
h = (h + ((h << 1) + (h << 4) + (h << 7) + (h << 8) + (h << 24))) >>> 0;
|
||||
}
|
||||
return h.toString(16).padStart(8, '0');
|
||||
}
|
||||
"""
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
first = page.evaluate(READBACK)
|
||||
second = page.evaluate(READBACK)
|
||||
print("read 1:", first)
|
||||
print("read 2:", second)
|
||||
assert first == second, "canvas hash changed within a session - per-call noise"
|
||||
```
|
||||
|
||||
Run the same script a second time with the same `seed=42` and the printed hash is the same
|
||||
again. Change the seed and it changes. Run it on a Windows host and on a Linux host with
|
||||
one fixed seed and the two hosts print the same string. To make the comparison against a
|
||||
stock browser concrete, run the identical readback under plain Playwright on the same
|
||||
machine and note that its hash tracks the host GPU instead:
|
||||
|
||||
```bash
|
||||
python read_hash.py # invisible_playwright: seed-stable, host-free
|
||||
python read_hash_stock.py # stock Playwright: hash follows this machine's GPU
|
||||
```
|
||||
|
||||
The stock browser is the reference. The point is not that the two disagree; it is that the
|
||||
seeded one gives the same answer on a second machine and the stock one does not.
|
||||
|
||||
## Conclusion
|
||||
|
||||
The BrowserLeaks canvas and WebGL signatures are hashes of a readback, and the readback is
|
||||
the only place a page can observe a render at all. That single fact is what makes the
|
||||
surface tractable: substitute the bytes at the readback boundary with a function of the
|
||||
seed, and the signature becomes seed-determined instead of GPU-determined, byte-identical
|
||||
across operating systems, and stable across reads within a session. Leave the low-entropy
|
||||
reference render exact and a tampering probe finds nothing to flag. The measurable outcome
|
||||
is a canvas signature of `df2a9319` and a WebGL signature of `0df1d6f8` reproduced to the
|
||||
byte on two different hosts, with zero cross-host failures across sixteen seeds.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What does the BrowserLeaks canvas signature actually measure?** The hash of the pixels a
|
||||
readback call returns, not any property of your GPU. It is downstream of the entire render
|
||||
pipeline, which is why editing a renderer string does not move it.
|
||||
|
||||
**Why is my canvas hash different on my server than on my laptop?** Because a plain render
|
||||
depends on the host GPU, driver and rasterizer, and those differ. When the readback is
|
||||
replaced with a seed-derived function, the host drops out and the hash is the same on both.
|
||||
|
||||
**Should the canvas hash change on every page load?** No. A hash that changes between two
|
||||
reads in one session is per-call noise, which is itself detectable. It should be stable
|
||||
within a session and reproducible across sessions for a fixed seed.
|
||||
|
||||
**Is blocking canvas a good defence?** No. An empty or scrambled canvas is a loud signal.
|
||||
The quiet approach returns a plausible, stable hash and leaves a detector's low-entropy
|
||||
reference render byte-exact.
|
||||
|
||||
**Can I get the same signature on two machines on purpose?** Yes, that is the design. Same
|
||||
seed, same signature, to the byte, on Windows and Linux alike.
|
||||
|
||||
**Does this touch the WebGL renderer string too?** That is a separate surface with its own
|
||||
handling; see the note on [WebGL renderer strings](webgl-renderer-strings.md). The
|
||||
signature is the pixels, the renderer string is a reported value, and both have to agree.
|
||||
|
||||
## Sources
|
||||
|
||||
- BrowserLeaks canvas and WebGL pages, read for how the signature is computed: a hash over
|
||||
the bytes returned by a readback call
|
||||
([browserleaks.com/canvas](https://browserleaks.com/canvas),
|
||||
[browserleaks.com/webgl](https://browserleaks.com/webgl)).
|
||||
- This project's host-independence audit, which maps every path a host-dependent render
|
||||
value can reach JavaScript and confirms the seeded hashes (`df2a9319`, `0df1d6f8`)
|
||||
byte-identical on Windows and Linux, zero of sixteen seeds failing the cross-host check.
|
||||
|
||||
**See also:** [canvas and WebGL fingerprints identical across OSes](canvas-webgl-cross-platform-consistency.md),
|
||||
[the cheapest tampering check there is](canvas-fingerprint-noise.md), and
|
||||
[how to test whether your browser is detected](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 two hashes above are
|
||||
real measurements, reproduced to the byte on two operating systems from one seed.*
|
||||
@@ -0,0 +1,239 @@
|
||||
---
|
||||
title: "What BrowserLeaks actually tests, surface by surface"
|
||||
description: "What BrowserLeaks tests, surface by surface: canvas hash, WebGL, WebRTC, fonts, ClientRects. Why a unique panel is not a fail, and the miss it never flags."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 7
|
||||
---
|
||||
|
||||
|
||||
# What BrowserLeaks actually tests, surface by surface
|
||||
|
||||
BrowserLeaks is the tool people reach for when they want to see a number rather than
|
||||
read a verdict. It prints the raw value of each browser surface - the canvas hash, the
|
||||
WebGL parameter block, the WebRTC candidate addresses, the installed font list, the
|
||||
ClientRects geometry - each on its own page, roughly fifteen of them.
|
||||
|
||||
That design is its strength and the source of most of the panic it causes. It shows you
|
||||
everything and scores none of it. So the panel that lights up red and says "unique" is
|
||||
the one everybody worries about, while the thing that actually gets a session flagged -
|
||||
two panels that quietly contradict each other - is displayed in plain text and never
|
||||
called out, because BrowserLeaks does not compare its own pages to one another.
|
||||
|
||||
This page is what each surface measures, why "unique" is not the alarm it looks like,
|
||||
and how to read the tool for the failure it will not point at.
|
||||
|
||||
## A raw-value inspector, not a scorer
|
||||
|
||||
BrowserLeaks reads each browser surface and prints its raw value; it does not judge whether the values are coherent. It shows the canvas hash, the WebGL block, the font list and how rare each is in its sample, but it never cross-checks one surface against another and never hands you a trust score. That is the distinction that makes it useful, and the one people miss.
|
||||
|
||||
[CreepJS asks whether you are lying](creepjs-explained.md): it takes a clean copy of the
|
||||
built-ins, walks descriptors and prototypes, and cross-checks every surface against
|
||||
every other one, then hands you a single trust score. BrowserLeaks does none of that. It
|
||||
reads a value, hashes it if it is a bitmap, tells you how rare that exact value is in its
|
||||
own visitor sample, and moves on to the next page.
|
||||
|
||||
That means two things. First, a "unique" result on any single BrowserLeaks page is a
|
||||
statement about rarity in their sample, not about whether your browser is coherent. A
|
||||
perfectly real, perfectly consistent machine can be unique. Second, and this is the part
|
||||
that matters, BrowserLeaks will show you a Windows font list on one page and a WebGL
|
||||
renderer that no Windows machine ships on another, side by side, both green, and say
|
||||
nothing - because it has no page that reads both. The contradiction is on screen. The
|
||||
tool just is not looking for it.
|
||||
|
||||
## The fifteen pages, surface by surface
|
||||
|
||||
Each page answers one narrow question. Using them as if they were interchangeable is
|
||||
most of why people get confused.
|
||||
|
||||
- **Canvas.** Draws text and shapes to a `<canvas>`, reads the pixels back, and hashes
|
||||
them. The hash is a fingerprint of how your specific GPU, driver and font stack
|
||||
rasterize that exact drawing. It is not a property you can set; it is
|
||||
[a readback of what the machine actually painted](browserleaks-canvas-webgl-hash.md).
|
||||
- **WebGL.** Two things on one page: the
|
||||
[`UNMASKED_VENDOR_WEBGL` / `UNMASKED_RENDERER_WEBGL`](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_debug_renderer_info)
|
||||
strings, and a long block of numeric limits (max texture size, shader precision
|
||||
ranges, supported extensions). The strings are the famous part; the numeric block is
|
||||
the part that has to agree with them, and a disagreement is a contradiction a scoring
|
||||
detector catches even though BrowserLeaks prints both without comment.
|
||||
- **WebRTC.** Asks the browser to gather ICE candidates and prints the addresses it
|
||||
finds. This is where a proxied browser can leak the real local address next to the
|
||||
proxy exit, or [return nothing at all, which is its own tell](webrtc-leak-proxy.md).
|
||||
- **Fonts.** Measures the width of a probe string in a long list of font names and
|
||||
reports which ones are installed. Under a Windows user agent this list must look like
|
||||
Windows, not [the font set a bare Linux container ships](detect-installed-fonts-javascript.md).
|
||||
- **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.
|
||||
|
||||
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
|
||||
between them.
|
||||
|
||||
## The panel people fear: "unique" is not "wrong"
|
||||
|
||||
The canvas page is the one that sends people to search engines, and usually for the
|
||||
wrong reason.
|
||||
|
||||
It prints "unique" in red, a rarity percentage, and a signature hash, and the instinct
|
||||
is to make the number stop being unique. That instinct is backwards. A real browser on a
|
||||
real machine is very often unique on canvas, because the rasterization depends on a
|
||||
specific GPU and driver combination that few other visitors share. Uniqueness is the
|
||||
baseline for real hardware, not the anomaly.
|
||||
|
||||
The failure modes that actually matter on this panel are the opposite of "unique":
|
||||
|
||||
- **A hash that changes on every read.** If you refresh and the canvas signature is
|
||||
different each time, something is adding per-call noise, and per-call randomness is
|
||||
itself the tell - a real GPU is deterministic, so
|
||||
[a hash that will not repeat is the cheapest tampering signal there is](canvas-fingerprint-noise.md).
|
||||
- **A hash that matches thousands of other visitors exactly.** That is the signature of
|
||||
a software rasterizer, the same fallback renderer every headless container falls back
|
||||
to, which is a "this is a datacenter" flag wearing a "not unique" badge.
|
||||
|
||||
So the correct thing to want from the canvas panel is not a common value. It is a stable,
|
||||
plausible, hardware-shaped value that reads identically twice and is not the shared
|
||||
software-renderer hash. This product derives that value from the seed, so it is unique in
|
||||
the way real hardware is unique and byte-identical on a re-read, rather than either
|
||||
randomized per call or collapsed onto the software default.
|
||||
|
||||
## The risk it shows but never flags: two panels that disagree
|
||||
|
||||
Here is the thing BrowserLeaks displays and will never point at, and it is the thing a
|
||||
real scoring detector fails you on.
|
||||
|
||||
Every surface on the site carries an implicit claim about the same machine. The user
|
||||
agent says a platform. The WebGL renderer string implies a GPU vendor. The font list
|
||||
implies an operating system. The canvas and ClientRects hashes imply a specific
|
||||
rasterization stack. On a real browser these all describe one coherent computer. On a
|
||||
patched-together disguise they describe two or three different ones, and each individual
|
||||
page still looks fine on its own.
|
||||
|
||||
BrowserLeaks will happily show you:
|
||||
|
||||
- A user agent claiming Windows, and a font page missing the fonts every Windows install
|
||||
ships.
|
||||
- A WebGL renderer string naming a discrete GPU, and a canvas hash equal to the shared
|
||||
software-renderer value - the string says NVIDIA while the pixels were drawn by a
|
||||
software rasterizer.
|
||||
- A WebRTC page reporting a timezone-consistent exit, and a geolocation page a continent
|
||||
away.
|
||||
|
||||
None of those triggers a warning on BrowserLeaks, because no page reads another page.
|
||||
CreepJS would collapse your trust score on any one of them. This is exactly the gap the
|
||||
comparison method in [how to test whether your browser is detected](how-to-test-bot-detection.md)
|
||||
exists to close: the tool gives you the raw values, and it is on you to check that they
|
||||
agree, because it will not.
|
||||
|
||||
The practical consequence: do not read BrowserLeaks page by page and tick each one green.
|
||||
Read the values across pages as a set and ask whether one machine could produce all of
|
||||
them. That is the check the site skips.
|
||||
|
||||
## Reading BrowserLeaks with the product, twice and against a stock browser
|
||||
|
||||
The way to use BrowserLeaks well is to automate the cross-check it does not do: read the
|
||||
same surface twice for stability, and read the surfaces together for coherence.
|
||||
|
||||
Switching from plain Playwright is a two-line change, and the returned object is a real
|
||||
Playwright `Browser` with every standard method:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# seed fixed, so every surface is reproducible and a failing run can be replayed
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
|
||||
# 1. Stability: read the canvas signature twice. A real GPU is deterministic,
|
||||
# so these two hashes must be identical. If they differ, something is
|
||||
# adding per-call noise, which is a tell in its own right.
|
||||
page.goto("https://browserleaks.com/canvas")
|
||||
first = page.locator("#crc").inner_text()
|
||||
page.reload()
|
||||
second = page.locator("#crc").inner_text()
|
||||
assert first == second, "canvas hash changed between reads - per-call noise"
|
||||
|
||||
# 2. Coherence: pull the WebGL renderer string and the font list, then check
|
||||
# they tell the same story about one machine.
|
||||
page.goto("https://browserleaks.com/webgl")
|
||||
renderer = page.locator("#webgl-unmasked-renderer").inner_text()
|
||||
print("WebGL renderer:", renderer)
|
||||
|
||||
page.goto("https://browserleaks.com/fonts")
|
||||
print("fonts detected:", page.locator("#font-count").inner_text())
|
||||
```
|
||||
|
||||
Two rules turn that from a screenshot into a test.
|
||||
|
||||
First, assert presence, not absence. A BrowserLeaks page that comes back empty, blocked
|
||||
or still spinning is a failure, not a clean pass - the WebRTC page returning no candidates
|
||||
at all reads as clean to a naive check and as suspicious to a real detector.
|
||||
|
||||
Second, and this is the one caveat worth being honest about: the raw canvas and WebGL
|
||||
hashes are stable and reproducible per seed, but they are still *unique*, because real
|
||||
hardware is unique. If your threat model needs many sessions that are individually
|
||||
plausible, change the seed per session rather than reusing one - a reproducible
|
||||
fingerprint is a debugging tool, not a crowd to hide in. Run the same read against a stock
|
||||
browser on the same machine and diff the two reports field by field; anything that differs
|
||||
other than the exit address is your candidate, whatever colour the panel is.
|
||||
|
||||
## Conclusion
|
||||
|
||||
BrowserLeaks is the right tool for reading a specific surface and the wrong tool for
|
||||
deciding whether you are safe. It prints raw values page by page and scores none of them,
|
||||
so the "unique" canvas panel that scares people is usually just real hardware behaving
|
||||
normally, while the failure that actually matters - two panels describing two different
|
||||
machines - is on screen in plain text with no warning attached.
|
||||
|
||||
Read it as a set, not a stack of independent verdicts. Check that each value is stable on
|
||||
a re-read, check that the values across pages could all come from one computer, and diff
|
||||
the whole thing against a stock browser. Do that and BrowserLeaks becomes a precise
|
||||
instrument. Read it panel by panel and it will scare you about the wrong number and stay
|
||||
silent about the right one.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**BrowserLeaks says my canvas is unique - am I detected?** Almost certainly not.
|
||||
Uniqueness is the baseline for real hardware, which rasterizes in a way few other
|
||||
visitors share. The tell is the opposite: a hash that changes every read, or one that
|
||||
matches thousands of others exactly.
|
||||
|
||||
**Does BrowserLeaks give a bot score?** No. It is a raw-value inspector. It prints each
|
||||
surface and how rare it is, but it never scores cross-surface consistency the way CreepJS
|
||||
does, so it cannot tell you whether your surfaces agree with each other.
|
||||
|
||||
**Why does BrowserLeaks look clean but I still get blocked?** Because it showed you values
|
||||
that individually look fine and never checked that they describe one machine. A Windows
|
||||
user agent with a Linux font list passes every BrowserLeaks page and fails a real
|
||||
detector.
|
||||
|
||||
**Which BrowserLeaks page matters most?** None alone. The value is reading them together:
|
||||
the canvas, WebGL, font and WebRTC pages have to tell the same story about one computer.
|
||||
|
||||
**How do I know if my canvas hash is randomized?** Load the canvas page twice. A real GPU
|
||||
gives the identical hash both times. If it differs, something is injecting per-call noise,
|
||||
which is itself a signal.
|
||||
|
||||
**Should I try to make my canvas hash common?** No. Common usually means the shared
|
||||
software-renderer value that every headless container falls back to, which reads as a
|
||||
datacenter. You want a stable, hardware-shaped, unique value, not a popular one.
|
||||
|
||||
## Sources
|
||||
|
||||
- The BrowserLeaks surfaces named above, each read from its own page rather than from a
|
||||
summary score.
|
||||
- This project's release gates, including the WebRTC gate whose absence-only assertions
|
||||
passed a feature that returned nothing, and the seed-derived canvas readback checked for
|
||||
stability across reads.
|
||||
- The companion detector pages in this set, read from each tool's own behaviour.
|
||||
|
||||
**See also:** [how CreepJS scores the cross-surface consistency BrowserLeaks skips](creepjs-explained.md),
|
||||
[what the canvas and WebGL hash actually measures](browserleaks-canvas-webgl-hash.md), and
|
||||
[the comparison method that catches contradictions no single panel flags](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 seed makes every surface
|
||||
reproducible, so the two-read stability check above is a test rather than a guess.*
|
||||
@@ -0,0 +1,244 @@
|
||||
---
|
||||
title: "How to make Linux and macOS report real Windows fonts"
|
||||
description: "To make Linux and macOS report real Windows fonts, bundle the real font files and read only from them. Filtering a list leaves the host's rendering underneath."
|
||||
parent: "Canvas, WebGL, Fonts and Audio"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 6
|
||||
---
|
||||
|
||||
|
||||
# How to make Linux and macOS report real Windows fonts
|
||||
|
||||
To make Linux and macOS report real Windows fonts, ship the real Windows font files
|
||||
inside the browser and read only from that bundle on every platform. Filtering a host's
|
||||
font list is not enough: it changes what gets reported, not what gets rendered - the
|
||||
list says Windows, the pixels say something else. This page is what it took to make that
|
||||
bundle hold on three unrelated font backends, and where it still leaks.
|
||||
[Why headless browsers render different fonts](headless-fonts-differ.md) covers the
|
||||
detection side of the same problem, if you want that first.
|
||||
|
||||
## Why filtering the host was never going to be enough
|
||||
|
||||
The first instinct is to filter: hide the host's real fonts, report a Windows-shaped
|
||||
list instead. We tried a version of this and reverted it, because filtering only
|
||||
changes what gets reported, not what gets rendered. The host still draws the glyphs,
|
||||
still measures the widths, still rounds however its rasteriser rounds. A filtered font
|
||||
*name* sitting on top of Linux font *rendering* is a different, subtler version of the
|
||||
same contradiction: the list says Windows, the pixels say something else.
|
||||
|
||||
The fix that actually holds is upstream of the whole problem: ship the real font
|
||||
files inside the browser, and read only from that bundle, on every platform. This is
|
||||
the same direction Camoufox took first, and for the same reason - a real file produces
|
||||
real glyphs, real metrics, and a real hash, because nothing about it is simulated.
|
||||
|
||||
## One manifest, so three backends can't disagree with each other
|
||||
|
||||
Firefox already has a mechanism for carrying fonts inside the binary,
|
||||
`MOZ_BUNDLED_FONTS`, on by default on Windows and Linux and available on macOS with a
|
||||
build flag. The harder problem isn't shipping the files, it's making Windows'
|
||||
DirectWrite, Linux's fontconfig and macOS's CoreText - three font backends that know
|
||||
nothing about each other and enumerate host fonts in three different ways - report the
|
||||
*same* family list from the *same* files.
|
||||
|
||||
The fix is a single manifest, generated offline from the font files themselves and
|
||||
checked in as data, listing every family and which file and face index backs it. All
|
||||
three backends read the same manifest instead of asking their platform's normal font
|
||||
enumeration, so instead of three per-OS filters that can quietly drift apart, there is
|
||||
one source of truth for what a family is called and where its data lives.
|
||||
|
||||
Two details in that manifest turned out to matter more than the format itself:
|
||||
|
||||
**Naming has to follow the same precedence a real OS uses**, or the family names
|
||||
themselves become the tell. Font files carry more than one candidate name - a
|
||||
typographic name, a GDI-compatible name, sometimes a WWS name - and which one Windows
|
||||
actually shows depends on a precedence order. Getting that order wrong produces a
|
||||
family list that is real but *shaped* wrong: a font's marketing name where a real
|
||||
Windows machine would show its GDI name, which is exactly the kind of small
|
||||
inconsistency [consistency-based detection](playwright-detected-as-bot.md) is built to
|
||||
catch.
|
||||
|
||||
**Multi-face font files can't be indexed positionally across platforms.** A single
|
||||
`.ttc` file can carry several unrelated faces - regional CJK variants, for instance -
|
||||
and the safe way to pick the right one turned out to differ by backend: an index that
|
||||
is reliable on one platform is not guaranteed to point at the same face on another,
|
||||
because not every platform documents face order as stable. Matching by the face's own
|
||||
embedded name instead of its position avoids picking the wrong face silently.
|
||||
|
||||
## Making three backends refuse to fall back to the host
|
||||
|
||||
A manifest is only half the fix. Each backend still has its own default behaviour when
|
||||
something isn't in its bundle-only list, and each of those defaults quietly reaches for
|
||||
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
|
||||
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.
|
||||
|
||||
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
|
||||
is no single flag that does this once for all platforms.
|
||||
|
||||
## The macOS gap: two layers, and only one was visible without a Mac
|
||||
|
||||
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
|
||||
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
|
||||
anything - a Mac host would enumerate its own system fonts right alongside the bundle,
|
||||
leaking the host OS on the one platform where nobody could see it happen locally.
|
||||
|
||||
**Layer two surfaced only when the first fix actually ran in CI.** Porting the hook
|
||||
and shipping it should have closed the gap. It didn't: the very next automated
|
||||
macOS run still showed most of the bundle missing and several real host fonts
|
||||
leaking through, on a build that had compiled cleanly and looked, from the source,
|
||||
like a complete fix. The actual cause was one level down - the build configuration
|
||||
that turns bundled fonts on at all was set to enable itself only on two of the three
|
||||
target platforms. The third silently defaulted off, which also compiled out the very
|
||||
hook layer one had just added, since that code only exists when bundled fonts are
|
||||
built in. A hook that is correct and a build that never includes it produce the same
|
||||
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
|
||||
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
|
||||
was supposed to be the whole answer. A gate that runs somewhere other than the real
|
||||
target platform is checking a different, easier question.
|
||||
|
||||
## What this validates, and what it costs
|
||||
|
||||
Validated cross-platform: Windows and Linux expose the identical family set from the
|
||||
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
|
||||
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
|
||||
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
|
||||
|
||||
Consistent with treating a suppressed signal as a fail rather than 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
|
||||
isn't wired to the bundle-only mode at all, so a page asking for a font by exact name
|
||||
through that specific CSS feature fails to resolve where a real installation would have. A resolved lookup versus a
|
||||
failed one is itself a detail a determined check could compare.
|
||||
- One backend's fallback for a character outside the bundle's family set reaches
|
||||
straight for the real host catalogue rather than staying inside the bundle, so an
|
||||
uncommon glyph can momentarily surface real host font data.
|
||||
- One backend's `system-ui` generic keeps a narrow live query against the host font
|
||||
service as an extra fallback candidate, a single generic family that didn't get
|
||||
folded into the same guard as the rest.
|
||||
- One platform's font-substitution mechanism reads a live OS-level alias table
|
||||
regardless of bundle-only mode, so the set of names that resolve through it still
|
||||
varies by the specific machine's own configuration.
|
||||
|
||||
None of these are enumeration leaks in the sense the validation above checks for -
|
||||
that check passed, repeatedly, on real measurement. They are narrower seams: specific
|
||||
code paths that keep a live dependency on the host font service instead of routing
|
||||
through the bundle like everything else. Each is a known, open item rather than
|
||||
something papered over, because a gap you haven't found yet is worse than one you have.
|
||||
|
||||
## A closed example of the same class: enumeration passing while rendering was wrong
|
||||
|
||||
Before the manifest fixed multi-face naming across platforms, a narrower version of the
|
||||
same problem shipped and was found and closed on Linux specifically. It is worth
|
||||
walking through because it is the clearest illustration of why enumeration alone is
|
||||
never enough of a check.
|
||||
|
||||
A `.ttc` file is a collection: several complete faces sharing one set of font tables,
|
||||
addressed through a `TTCHeader` that starts with the four-byte marker `ttcf` instead of
|
||||
the single-face `sfnt` header an ordinary font file has. Several bundled CJK families -
|
||||
regional Chinese, Japanese and a couple of serif/math variants - ship as `.ttc`
|
||||
collections for exactly that reason: related faces, one file.
|
||||
|
||||
The font-table code on Linux never checked for that marker. It read every font file as
|
||||
if it only had one face, at a fixed offset from the start of the file. For an ordinary
|
||||
font that offset is correct. For a `.ttc` collection it lands wherever the first face's
|
||||
data happens to be, regardless of which face was actually requested by name.
|
||||
|
||||
The result was a font that enumerated correctly - the family name resolved, the browser
|
||||
reported it was using the right font - while the glyphs actually rendered came from
|
||||
whichever face happened to sit at that fixed offset. Measured directly: metrics for
|
||||
several of these families were wrong on Linux and correct on Windows, same seed, same
|
||||
manifest, same claimed font name. Enumeration was clean. Rendering was not. That gap is
|
||||
exactly what a check that stops at "is the font in the list" cannot see.
|
||||
|
||||
The fix adds a lookup that reads the `TTCHeader` when the `ttcf` marker is present,
|
||||
finds the requested face's own offset from the collection's face-directory table, and
|
||||
reads from there instead of assuming offset zero. After the fix, the same measurement
|
||||
that had shown a mismatch showed matching metrics on both platforms, for every affected
|
||||
family.
|
||||
|
||||
The general lesson is the same one the four seams above are named for: a signal that
|
||||
looks closed because the obvious check passed is not the same as a signal that is
|
||||
closed. This one needed a metrics comparison, not a font list, to be caught at all -
|
||||
and it was a real, shipped gap for a period, not a hypothetical one.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Filtering a host's fonts leaves the host's rendering underneath, which is a
|
||||
contradiction with extra steps. Shipping the real files and reading only from them
|
||||
removes the contradiction at the source, at the cost of a larger binary, a fixed
|
||||
family list, and three separate backends that each needed convincing not to reach for
|
||||
the host on their own. What's left is a short, named list of narrower seams, not a
|
||||
general claim that the surface is closed.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can I make a Linux machine report Windows fonts?** Reporting the name is not the
|
||||
hard part; matching the rendering is. Bundling the actual font files and reading only
|
||||
from them is what makes the two agree.
|
||||
|
||||
**Does installing Windows fonts on Linux fix fingerprinting?** It gets you the right
|
||||
names. It does not by itself stop the browser's normal font backend from also seeing
|
||||
whatever else is on the host, and licensing is a separate problem again.
|
||||
|
||||
**Why not just spoof the font list in JavaScript?** There's no enumeration API to
|
||||
intercept; [detection works by measuring rendered text](detect-installed-fonts-javascript.md),
|
||||
and a script cannot change what the OS actually draws.
|
||||
|
||||
**Does this fix cost anything?** A larger binary, and a font list that's frozen at
|
||||
build time rather than tracking whatever the real OS might add later.
|
||||
|
||||
**Is this the same thing Camoufox does?** The same direction - real files, not a
|
||||
filter - checked independently rather than assumed to work the same way underneath.
|
||||
|
||||
**See also:** [why headless browsers render different fonts](headless-fonts-differ.md),
|
||||
for the detection side this architecture answers; [invisible_playwright vs Camoufox](vs-camoufox.md),
|
||||
for where this approach sits relative to theirs; and
|
||||
[WebGL renderer strings](webgl-renderer-strings.md), for the same shape of problem on
|
||||
different hardware.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's own font-bundle architecture and its per-platform integration work,
|
||||
including the validated cross-platform measurement (Windows/Linux locally,
|
||||
macOS in CI) and the four open gaps listed above.
|
||||
- Firefox's own bundled-fonts build mechanism, which this architecture builds on
|
||||
rather than replaces.
|
||||
- [CSS Fonts Module Level 4](https://www.w3.org/TR/css-fonts-4/) (W3C), for the generic
|
||||
font family keywords and the `local()` src descriptor referenced above.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level, including three separate font backends convinced not
|
||||
to ask their host anything.*
|
||||
@@ -0,0 +1,224 @@
|
||||
---
|
||||
title: "Can a website detect a virtual machine?"
|
||||
description: "How a website infers a VM: software GPU renderers, odd core and memory counts, missing audio, generic metrics - what a browser fingerprint can and cannot hide."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 15
|
||||
---
|
||||
|
||||
|
||||
# Can a website detect a virtual machine?
|
||||
|
||||
Short version: a website cannot see your hypervisor directly, but it can read a
|
||||
handful of browser-visible values that a virtual machine or a cloud instance tends to
|
||||
get wrong, and it can add them up into a VM-likelihood score. So the honest answer is
|
||||
"partly". It can guess from what the browser reports, and it usually cannot prove
|
||||
anything from inside the page. What it can prove lives outside the browser: the exit
|
||||
IP and the network handshake.
|
||||
|
||||
This page is what a detector actually looks at, why a default VM answers those
|
||||
questions in a way that stands out, how a real-hardware persona changes the answers,
|
||||
and the parts that a browser fingerprint does not and cannot touch.
|
||||
|
||||
## What a detector can see, and what it cannot
|
||||
|
||||
A page runs JavaScript. JavaScript can read the values the browser chooses to expose,
|
||||
and nothing below that line. It cannot read the CPUID leaf that says "hypervisor
|
||||
present", it cannot query the BIOS vendor string, it cannot see the virtual disk
|
||||
controller. Those are the classic VM tells, and they belong to native malware analysis,
|
||||
not to a web page.
|
||||
|
||||
What a page can do is infer. Every value below is individually plausible and, taken
|
||||
together, describes a machine. A physical desktop and a headless cloud instance answer
|
||||
these questions differently, and a detector that has scored a few million real browsers
|
||||
knows what the physical desktop looks like.
|
||||
|
||||
- The GPU vendor and renderer string.
|
||||
- The number of logical CPU cores.
|
||||
- The reported device memory.
|
||||
- Whether an audio output device exists, and what it sounds like.
|
||||
- The screen geometry and pixel ratio.
|
||||
|
||||
None of these is an automation flag. They are all "this is probably not someone's
|
||||
desktop" flags, which is a different and often more damaging thing.
|
||||
|
||||
## The signals that feed a VM score
|
||||
|
||||
Here is what each one looks like when it comes from a virtualized or headless
|
||||
environment, and why it stands out.
|
||||
|
||||
**A software or generic GPU renderer.** A machine with no graphics hardware falls back
|
||||
to a software rasterizer, and the [WebGL renderer
|
||||
string](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_debug_renderer_info)
|
||||
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
|
||||
you have to accumulate. Worse, the string and the pixels can disagree: a renderer that
|
||||
names real hardware while a software path actually draws the frame is
|
||||
[a mismatch you cannot paper over with a property override](renderer-string-vs-render.md).
|
||||
The full surface is in [WebGL renderer strings](webgl-renderer-strings.md).
|
||||
|
||||
**Odd core and memory counts.**
|
||||
[`navigator.hardwareConcurrency`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/hardwareConcurrency)
|
||||
and
|
||||
[`navigator.deviceMemory`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/deviceMemory)
|
||||
are coarse, but their distribution across real browsers is not uniform. A tiny core
|
||||
count paired with a claim of a modern desktop, or a memory
|
||||
value that never appears on consumer hardware, moves the score. These two also have to
|
||||
agree with each other and with the rest of the persona, which is
|
||||
[why pinning one without its neighbours backfires](hardware-concurrency-device-memory.md).
|
||||
|
||||
**Missing or default audio.** An
|
||||
[`AudioContext`](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API)
|
||||
exposes a sample rate, an output latency and a channel count that come from a real
|
||||
audio device. A container with no sound hardware answers with defaults that say
|
||||
exactly that, and the rendered audio
|
||||
fingerprint carries the same information. See
|
||||
[AudioContext fingerprinting](audiocontext-fingerprinting.md) for what is actually
|
||||
being measured.
|
||||
|
||||
**Generic display metrics.** A resolution nobody ships, a device pixel ratio no real
|
||||
panel has, an available screen height equal to the full height (meaning no taskbar and
|
||||
no window chrome). Each of these is a small nudge; together they describe a virtual
|
||||
framebuffer rather than a monitor.
|
||||
|
||||
A detector does not need any single one of these to be damning. It needs several of
|
||||
them to point the same way at once, which is exactly what an unconfigured VM delivers.
|
||||
|
||||
## What invisible_playwright does about the browser-visible layer
|
||||
|
||||
invisible_playwright is a Firefox patched at the C++ level and driven by stock
|
||||
Playwright. Its whole design is to look like a real browser run by a real person, and
|
||||
that is why it passes most fingerprint, TLS and driver-layer checks: those layers read
|
||||
as a genuine Firefox because the browser genuinely is one, not a JavaScript costume
|
||||
over a headless engine.
|
||||
|
||||
For the VM signals specifically, the build derives one coherent real-hardware persona
|
||||
from a seed and overrides the browser-visible values to match it: the WebGL vendor and
|
||||
renderer name a real GPU (and the pixels are drawn to agree with the string, not just
|
||||
the string), `hardwareConcurrency` and device memory take values a real desktop
|
||||
reports, the `AudioContext` presents a real device's output characteristics, and the
|
||||
screen metrics describe a physical display. Every field is drawn from the same seed, so
|
||||
they agree with one another rather than being individually plausible and jointly
|
||||
contradictory, which is the failure mode a VM score is built to catch.
|
||||
|
||||
Switching from plain Playwright is two lines, and the operation this page is about -
|
||||
loading a page that scores your environment - is ordinary Playwright after that:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# same seed -> same GPU, cores, memory, audio and screen every run
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# read the values a VM detector would read
|
||||
report = page.evaluate("""() => {
|
||||
const gl = document.createElement('canvas').getContext('webgl');
|
||||
const dbg = gl && gl.getExtension('WEBGL_debug_renderer_info');
|
||||
return {
|
||||
renderer: dbg ? gl.getParameter(dbg.UNMASKED_RENDERER_WEBGL) : null,
|
||||
cores: navigator.hardwareConcurrency,
|
||||
memory: navigator.deviceMemory,
|
||||
sampleRate: new (window.AudioContext || window.webkitAudioContext)().sampleRate,
|
||||
screen: [screen.width, screen.height, window.devicePixelRatio],
|
||||
};
|
||||
}""")
|
||||
print(report)
|
||||
```
|
||||
|
||||
Run that inside the build and the renderer names a real GPU, the core and memory
|
||||
counts sit in the range real desktops report, the sample rate is a real device's, and
|
||||
the screen looks like a monitor. Run it in a stock headless browser on the same cloud
|
||||
instance and you will typically see a software renderer, a low core count and screen
|
||||
metrics that describe a framebuffer. That difference is the VM score, and it is the
|
||||
part a browser can control.
|
||||
|
||||
Because the persona is seed-derived, `seed=42` gives the same machine on every run,
|
||||
which is what makes a suspicious result reproducible instead of a one-off you cannot
|
||||
chase.
|
||||
|
||||
## The parts a browser fingerprint cannot fix
|
||||
|
||||
This is the honest caveat, and skipping it is how people get surprised.
|
||||
|
||||
Matching the browser-visible layer to a real desktop covers the browser-visible layer.
|
||||
It does nothing about:
|
||||
|
||||
- **The exit IP.** A datacenter address is a datacenter address, and a large share of
|
||||
VM detection in practice is just the IP's reputation and ASN. A perfect persona on a
|
||||
known cloud range still reads as a cloud instance. You supply the exit; the build
|
||||
only sets the browser to match it. See
|
||||
[why a container gets caught on the network and machine layers](playwright-docker-detection.md).
|
||||
- **Hypervisor timing side-channels.** Some detectors time operations whose cost
|
||||
differs under virtualization. That is a property of the CPU you are actually running
|
||||
on, not of any value the browser reports, and no fingerprint override changes it.
|
||||
- **Behaviour, rate and quota.** Human pacing, per-account limits and request velocity
|
||||
are yours to supply. A consistent browser hammering one endpoint from one address
|
||||
creates the exact signal it was trying to avoid.
|
||||
|
||||
So invisible_playwright helps with the browser-visible half of VM detection and does
|
||||
not, on its own, fix the IP, the timing floor or your behaviour. It is designed to be
|
||||
paired with a clean residential exit and human pacing, not to replace them. There is no
|
||||
setting that makes a browser undetectable, and any tool that claims one is selling the
|
||||
claim rather than the result.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Can a website detect a virtual machine? It can make a strong guess from the browser
|
||||
side - a software GPU renderer, odd core and memory counts, missing audio, generic
|
||||
display metrics - and it can prove very little from inside the page while proving quite
|
||||
a lot from your IP and handshake. invisible_playwright addresses the guessable,
|
||||
browser-visible half by presenting one coherent real-hardware persona instead of the
|
||||
default VM answers, and it is honest about the half it does not touch. Match the
|
||||
browser to a real desktop, put it behind a clean exit, pace it like a person, and the
|
||||
VM score stops being the thing that gives you away. Get any one of those three wrong and
|
||||
the other two will not save you.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can JavaScript detect that I am in a VM?** Not directly. It cannot read CPUID, BIOS
|
||||
strings or the hypervisor. It infers from browser-visible values like the GPU renderer,
|
||||
core count, audio device and screen, and scores how VM-like they look together.
|
||||
|
||||
**What is the biggest browser-side VM tell?** A software or generic WebGL renderer
|
||||
string. It is a value you can read in plain text rather than a statistic you have to
|
||||
accumulate, so it stands out immediately.
|
||||
|
||||
**Does invisible_playwright hide that I am on a cloud server?** It fixes the
|
||||
browser-visible signals - GPU, cores, memory, audio, screen - to one coherent real
|
||||
desktop persona. It does not change your IP, which is often the actual reason a cloud
|
||||
session gets flagged.
|
||||
|
||||
**Can a website detect a VM through timing?** Some detectors time operations that cost
|
||||
more under virtualization. That is a property of the CPU you run on, not a browser
|
||||
value, so no fingerprint override affects it.
|
||||
|
||||
**Will a real-hardware persona alone get me through?** No. Pair it with a clean
|
||||
residential exit and human pacing. The persona covers the machine the browser reports,
|
||||
not the address it connects from or how fast you click.
|
||||
|
||||
**Is there a setting that makes the browser undetectable?** No, and be wary of anything
|
||||
that says otherwise. This lowers the browser-visible VM score to a real desktop's; the
|
||||
IP, timing floor and behaviour are still yours to get right.
|
||||
|
||||
## Sources
|
||||
|
||||
- The public fingerprint suites this project tests against, read for which environment
|
||||
values they collect and how they weight them - GPU renderer, hardwareConcurrency,
|
||||
deviceMemory, AudioContext output and screen metrics.
|
||||
- This project's release gates, which compare each of those fields against a stock
|
||||
Firefox on the same machine rather than reading a verdict.
|
||||
|
||||
**See also:** [WebGL renderer strings](webgl-renderer-strings.md) and
|
||||
[hardwareConcurrency and deviceMemory](hardware-concurrency-device-memory.md) for two
|
||||
of the signals above, and [how to test whether your browser is detected](how-to-test-bot-detection.md)
|
||||
for the compare-against-stock method that catches a VM tell a verdict hides.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. It presents one coherent
|
||||
real-hardware persona to the browser-visible layer; the IP, the timing floor and the
|
||||
pacing are still yours to supply.*
|
||||
@@ -0,0 +1,221 @@
|
||||
---
|
||||
title: "Can a website detect Clipboard API access?"
|
||||
description: "A page can see navigator.clipboard and query clipboard-read permission state, but the async Clipboard API is a gesture gate, not a value fingerprint you leak."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 21
|
||||
---
|
||||
|
||||
|
||||
# Can a website detect Clipboard API access?
|
||||
|
||||
Short version: a page can see that `navigator.clipboard` exists and it can ask the
|
||||
Permissions API what state `clipboard-read` is in, so yes, it can observe your
|
||||
relationship with the clipboard. What it mostly cannot do is turn that into a stable
|
||||
fingerprint of your machine. The Clipboard API is interesting to a detector for a
|
||||
different reason than canvas or WebGL are: it is not a value you leak, it is a gate that
|
||||
only opens for a real user gesture, and its permission state has to agree with a second
|
||||
API that reports the same thing.
|
||||
|
||||
This page is what the async Clipboard API actually exposes, why it behaves as a gate
|
||||
rather than a fingerprint, the cross-check a detector runs against it, how to drive it
|
||||
with a real trusted click, and the honest limit of what a patched browser does here.
|
||||
|
||||
## What the async Clipboard API actually exposes
|
||||
|
||||
The modern surface is the [Clipboard API](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API)'s
|
||||
`navigator.clipboard`, with two methods that matter for detection:
|
||||
`writeText()` and `readText()` (plus their richer `write()`/`read()` cousins). Both return
|
||||
promises, and both are guarded before they ever touch the system clipboard.
|
||||
|
||||
A page can read three things without any special access:
|
||||
|
||||
- **Whether `navigator.clipboard` is present at all.** A secure context (HTTPS) in a
|
||||
modern browser has it; its absence under a modern user agent is itself a mismatch.
|
||||
- **The permission state for `clipboard-read`**, by asking the
|
||||
[Permissions API](https://developer.mozilla.org/en-US/docs/Web/API/Permissions_API)'s
|
||||
`navigator.permissions.query({name: 'clipboard-read'})`. That returns `granted`,
|
||||
`denied` or `prompt` without prompting anyone.
|
||||
- **What happens when it calls a method.** A rejected promise, and the shape of the
|
||||
rejection, tells the page which guard tripped.
|
||||
|
||||
None of those three is a serial number. They describe policy, not hardware, and that is
|
||||
the whole point of this surface.
|
||||
|
||||
## Why clipboard is a gate, not a value fingerprint
|
||||
|
||||
Canvas gives back a hash. WebGL gives back a renderer string. The clipboard gives back
|
||||
almost nothing that varies from one honest machine to the next, because access is gated
|
||||
on two conditions the specification requires:
|
||||
|
||||
1. **A user gesture.** `readText()` and `writeText()` are only allowed while the document
|
||||
has [transient activation](https://developer.mozilla.org/en-US/docs/Web/Security/Defenses/User_activation),
|
||||
meaning a real interaction (a click, a key press) happened
|
||||
recently. Call either one from a script with no gesture behind it and the promise
|
||||
rejects.
|
||||
2. **A permission.** Reading additionally requires the `clipboard-read` permission;
|
||||
writing is allowed under a gesture in most configurations but can also be governed by
|
||||
`clipboard-write`.
|
||||
|
||||
For an automation setup this is exactly the kind of check that separates a real browser
|
||||
from a spoofed one, and it separates them on *behaviour*, not on a leaked value. A script
|
||||
that dispatches its own synthetic `click` event to satisfy the gesture requirement fails,
|
||||
because a page-built event carries `isTrusted=false` and does not count as activation.
|
||||
This is the same boolean that decides
|
||||
[whether an automated click reads as real input](playwright-clicks-istrusted.md): the
|
||||
clipboard gate sits directly on top of it.
|
||||
|
||||
So the detector question is not "what is your clipboard value". It is "does the clipboard
|
||||
open for you the way it opens for a person", and the answer depends on whether your
|
||||
clicks are trusted.
|
||||
|
||||
## The cross-check: permission state must agree with the Permissions API
|
||||
|
||||
The sharper check does not call the clipboard at all. It reads two answers to the same
|
||||
question and looks at whether they line up.
|
||||
|
||||
`navigator.clipboard` being present implies a certain permission model. The Permissions
|
||||
API is then asked directly: `query({name: 'clipboard-read'})`. On a coherent, real
|
||||
browser those two facts describe one consistent policy. On an over-patched setup, where
|
||||
someone bolted on `navigator.clipboard` or forced a permission state from JavaScript
|
||||
without moving the other half, the two disagree, and the disagreement is the tell.
|
||||
|
||||
It is the same shape as
|
||||
[the notifications permission mismatch](permissions-api-consistency.md), where
|
||||
`Notification.permission` and `navigator.permissions.query({name: 'notifications'})` are
|
||||
expected to give one coherent answer and a headless browser gives two. Clipboard adds a
|
||||
third instance of the pattern, alongside
|
||||
[the notification-state cross-check detectors already run](notification-permission-detection.md).
|
||||
Nobody has to recognise automation directly; they just ask the same thing twice through
|
||||
different code and compare.
|
||||
|
||||
A patched-at-the-engine build does well here for an unglamorous reason: it is a real
|
||||
Firefox. The permission plumbing is the browser's own, so the Permissions API answer and
|
||||
the clipboard's actual behaviour come from one source and cannot contradict each other the
|
||||
way a page-level shim does. There is nothing to keep in sync because nothing was bolted
|
||||
on.
|
||||
|
||||
## Reading the clipboard with invisible_playwright
|
||||
|
||||
Because Playwright's clicks go through the native input path, they arrive as trusted
|
||||
gestures, so the clipboard gate opens exactly as it would for a hand on the mouse. The
|
||||
launch is the usual two lines, and after that everything is stock Playwright:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
|
||||
# A page button whose handler calls navigator.clipboard.writeText(...).
|
||||
# The Playwright click is a trusted gesture, so the write is permitted.
|
||||
page.click("#copy-button")
|
||||
|
||||
# Inspect the surface the way a detector would: presence plus the
|
||||
# permission state that has to agree with it.
|
||||
report = page.evaluate("""async () => {
|
||||
const present = 'clipboard' in navigator;
|
||||
let readState = 'unavailable';
|
||||
try {
|
||||
const s = await navigator.permissions.query({ name: 'clipboard-read' });
|
||||
readState = s.state; // 'granted' | 'denied' | 'prompt'
|
||||
} catch (e) {
|
||||
readState = 'query-failed';
|
||||
}
|
||||
return { present, readState };
|
||||
}""")
|
||||
|
||||
print(report) # e.g. {'present': True, 'readState': 'prompt'}
|
||||
```
|
||||
|
||||
The values you get back are the ones a genuine Firefox returns: `navigator.clipboard`
|
||||
present in the secure context, and a `clipboard-read` state that matches the browser's
|
||||
real policy rather than a hand-forced constant. If you need to grant clipboard permissions
|
||||
explicitly for a `readText()` flow, use Playwright's own
|
||||
`context.grant_permissions([...])` on the browser context, exactly as you would with
|
||||
upstream Playwright; there is no separate API to learn here.
|
||||
|
||||
The measurable point is the one from the section above: the presence flag and the
|
||||
permission state agree, and a click-gated `writeText()` succeeds because the gesture was
|
||||
trusted. That agreement is what the cross-check is looking for, and it is a property of
|
||||
being a real browser rather than of any value we inject.
|
||||
|
||||
## What this does not fix
|
||||
|
||||
Passing the clipboard cross-check is a fingerprint-and-driver-layer win, and it is worth
|
||||
being blunt about where that win stops.
|
||||
|
||||
- **IP reputation.** The clipboard gate has nothing to do with your exit address. A
|
||||
coherent clipboard on a datacenter IP is still on a datacenter IP. Supply a clean exit;
|
||||
see [Configuration](configuration.md) for the proxy setup.
|
||||
- **Per-account quotas and rate limits.** Looking like a real browser does not raise a
|
||||
limit that is counted per account or per address. Those are policy on the other side,
|
||||
not a browser property.
|
||||
- **Behaviour and timing.** The gate cares that a gesture is trusted, not that your pacing
|
||||
is human. A trusted click fired in a machine-perfect rhythm is still a rhythm a watcher
|
||||
can measure.
|
||||
- **Clipboard prompts by design.** Some `readText()` flows are meant to prompt a human.
|
||||
Automating your way around a deliberate consent step is a different problem from looking
|
||||
real, and this page is only about the second.
|
||||
|
||||
invisible_playwright is built to look like a real browser driven by a real person, which
|
||||
is why the fingerprint, the TLS handshake and the driver layer read as a genuine Firefox
|
||||
and why checks like this one pass. It does not launder a bad IP or manufacture pacing.
|
||||
Those you supply: a clean proxy and human-shaped behaviour.
|
||||
|
||||
## Conclusion
|
||||
|
||||
A website can absolutely detect that you are touching the Clipboard API, and it can read
|
||||
your `clipboard-read` permission state without prompting. But the async Clipboard API is a
|
||||
gate, not a value fingerprint: access opens only for a real trusted gesture, and the
|
||||
permission it reports has to agree with the Permissions API's answer for the same thing.
|
||||
A patched-at-the-engine Firefox driven by stock Playwright clears both because the gesture
|
||||
is genuinely trusted and the permission plumbing is the browser's own. That handles the
|
||||
browser side. The exit and the pacing are still yours to get right.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can a website tell if I read the clipboard?** It can see that `navigator.clipboard`
|
||||
exists and query the `clipboard-read` permission state. A silently rejected read also
|
||||
tells it which guard tripped. It cannot turn any of that into a stable machine
|
||||
fingerprint.
|
||||
|
||||
**Is the Clipboard API a fingerprinting surface?** Barely, in the value sense. It is a
|
||||
permission-and-gesture gate, so its interest to a detector is consistency and access
|
||||
behaviour, not a hash that varies between machines.
|
||||
|
||||
**Why does `readText()` reject in my automation?** Most often because there was no trusted
|
||||
user gesture, or the `clipboard-read` permission was not granted. A script-dispatched
|
||||
click does not count as a gesture.
|
||||
|
||||
**Do Playwright clicks satisfy the gesture requirement?** Yes. They go through the native
|
||||
input path and arrive as trusted events, so the clipboard gate opens as it would for a
|
||||
real user.
|
||||
|
||||
**What is the clipboard cross-check?** A detector compares `navigator.clipboard` presence
|
||||
against the Permissions API state for `clipboard-read`. On a real browser they describe
|
||||
one policy; a page-level shim that forces one without the other makes them disagree.
|
||||
|
||||
**Does a coherent clipboard mean I will not get blocked?** No. It is one browser-side
|
||||
signal. IP reputation, per-account quotas and behaviour are separate and are yours to
|
||||
handle.
|
||||
|
||||
## Sources
|
||||
|
||||
- The WHATWG and W3C definitions of the async Clipboard API and the Permissions API,
|
||||
including the user-activation and `clipboard-read`/`clipboard-write` requirements, read
|
||||
from the specifications rather than from a blog summary.
|
||||
- This project's own permission and gesture gates, which check that a click-gated
|
||||
operation succeeds under a trusted event and that the permission state a page can query
|
||||
agrees with the browser's real policy.
|
||||
|
||||
**See also:** [the trusted-click boolean the clipboard gate sits on](playwright-clicks-istrusted.md),
|
||||
[the permission answers that must agree](permissions-api-consistency.md), and
|
||||
[the notification cross-check detectors already run](notification-permission-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 clipboard opens for it
|
||||
because the gesture is genuinely trusted, not because a value was faked.*
|
||||
@@ -0,0 +1,205 @@
|
||||
---
|
||||
title: "Can a website tell you are running on a server?"
|
||||
description: "Websites spot a datacenter or headless host via software WebGL, missing audio, headless metrics, datacenter ASN - and what a real fingerprint can fix and cannot."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 25
|
||||
---
|
||||
|
||||
|
||||
# Can a website tell you are running on a server?
|
||||
|
||||
Often, yes. Not because the code is automated, but because the host is a server:
|
||||
no GPU, no sound card, no monitor, and an address that belongs to a datacenter. A
|
||||
browser running there answers a handful of ordinary questions in a way that only a
|
||||
server answers them, and a detector does not need anything clever to notice.
|
||||
|
||||
The honest split is worth stating up front. Most of these tells are JavaScript-visible
|
||||
properties of the machine, and a browser that presents a real desktop persona answers
|
||||
them the way a desktop does, whether the host underneath is a laptop, a Linux VM or a
|
||||
Docker container. One of them is not a browser property at all: the exit IP is read at
|
||||
the network layer, before any script runs, and no browser can disguise it. That one is
|
||||
yours to solve with a clean proxy.
|
||||
|
||||
## What a server actually leaks
|
||||
|
||||
The failures that get a headless-host session blocked are almost never automation
|
||||
flags like [`navigator.webdriver`](navigator-webdriver-explained.md). Those are solved
|
||||
by every serious tool on day one. The ones that survive are hardware questions the
|
||||
machine cannot answer honestly:
|
||||
|
||||
- **The GPU**, read through the [`WEBGL_debug_renderer_info`](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_debug_renderer_info)
|
||||
extension, which on a server is drawn by software.
|
||||
- **The audio device**, read through [`AudioContext`](https://developer.mozilla.org/en-US/docs/Web/API/AudioContext), which on a server does not exist.
|
||||
- **The screen**, whose resolution, available height and device pixel ratio describe
|
||||
a display that no real desktop has.
|
||||
- **The exit address**, whose ASN says datacenter.
|
||||
|
||||
None of these are in JavaScript's gift to change from a page-level script, which is
|
||||
why a stealth plugin bolted onto a stock headless browser does not touch them. They
|
||||
are decided by the box the browser runs on. The rest of this page walks the first three
|
||||
(which a real-browser build answers on the browser side) and then the fourth (which it
|
||||
cannot).
|
||||
|
||||
## The software renderer tell
|
||||
|
||||
Ask a browser on a normal desktop what draws its graphics and it names a real GPU
|
||||
vendor and model. Ask a browser on a server and, if it renders WebGL at all, it names
|
||||
a software rasterizer: strings like `llvmpipe` or `SwiftShader`, or a generic "software"
|
||||
renderer. That string is a plain statement that there is no graphics hardware present,
|
||||
and a detector reads it as exactly that.
|
||||
|
||||
There is a subtler version of the same tell, and it is the one that catches half-fixes:
|
||||
the renderer string can be edited to say a real GPU while the pixels are still drawn by
|
||||
software. A page that draws a scene and reads back the result gets output that does not
|
||||
match the name, which is [a mismatch you cannot patch from a string override](renderer-string-vs-render.md).
|
||||
The name and the pixels have to agree.
|
||||
|
||||
invisible_playwright presents a real GPU persona, and the readback matches it, because
|
||||
the presented persona is what actually answers both the string query and the render.
|
||||
The [WebGL renderer strings page](webgl-renderer-strings.md) covers what a consistent
|
||||
vendor/renderer pair looks like and why the two halves have to line up.
|
||||
|
||||
## The missing audio device and the headless screen
|
||||
|
||||
Sound is the same story as graphics. An AudioContext reports a sample rate, an output
|
||||
latency and a channel count, and on a real machine those come from a real sound card.
|
||||
A container has none, so it answers with the defaults that a headless host produces,
|
||||
and the defaults are a signature. An empty or default audio profile under a desktop user
|
||||
agent is a server saying it is a desktop. The mechanism is in
|
||||
[AudioContext fingerprinting](audiocontext-fingerprinting.md).
|
||||
|
||||
The screen is the third. Headless hosts report resolutions nobody runs, a device pixel
|
||||
ratio no physical display has, and an available height equal to the full height, which
|
||||
means there is no taskbar because there is no desktop. Each value on its own is weak;
|
||||
together they describe a monitor that does not exist. The full set of these is in
|
||||
[screen size and other headless tells](screen-size-headless-tells.md).
|
||||
|
||||
A real-browser build answers all three as a Windows desktop would: a real GPU persona,
|
||||
a real AudioContext output, and Windows screen metrics with a plausible available height
|
||||
and device pixel ratio. Those answers are the same whether the host is your laptop or a
|
||||
Linux container, because they are presented by the browser rather than read from the box.
|
||||
|
||||
## What invisible_playwright presents instead
|
||||
|
||||
The launch is two lines, and the browser you get back is a real Playwright `Browser`,
|
||||
so every method is the one you already know. Here is the launch plus reading back the
|
||||
three signals this page is about:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
|
||||
report = page.evaluate("""() => {
|
||||
const gl = document.createElement('canvas').getContext('webgl');
|
||||
const dbg = gl.getExtension('WEBGL_debug_renderer_info');
|
||||
const ac = new (window.AudioContext || window.webkitAudioContext)();
|
||||
return {
|
||||
renderer: gl.getParameter(dbg.UNMASKED_RENDERER_WEBGL),
|
||||
vendor: gl.getParameter(dbg.UNMASKED_VENDOR_WEBGL),
|
||||
sampleRate: ac.sampleRate,
|
||||
screen: [screen.width, screen.height, screen.availHeight],
|
||||
dpr: window.devicePixelRatio,
|
||||
platform: navigator.platform,
|
||||
};
|
||||
}""")
|
||||
print(report)
|
||||
```
|
||||
|
||||
Run that on a Linux server or inside a container and the renderer names a real GPU, the
|
||||
vendor matches it, the AudioContext reports a desktop sample rate, the screen metrics
|
||||
describe a Windows display with a taskbar, and `navigator.platform` reads `Win32`. The
|
||||
same `seed=42` produces the same persona every run, so a value you saw once is a value
|
||||
you can reproduce and diff, rather than a fresh random draw each launch.
|
||||
|
||||
Because the browser is a genuinely patched Firefox driven by stock Playwright, the layers
|
||||
underneath the JavaScript match too: the TLS handshake and the driver surface read as a
|
||||
real Firefox rather than as an automated one. That consistency is the reason it passes
|
||||
most detection checks, and the way to confirm it is by comparison against a stock browser
|
||||
on the same machine rather than by trusting a single verdict.
|
||||
|
||||
## The boundary: the datacenter IP is still visible
|
||||
|
||||
Here is the caveat, stated plainly because a page that only lists what it fixes is not
|
||||
honest. Everything above happens inside the browser, at the JavaScript layer. The exit
|
||||
IP does not. The server reads your address at the network layer before a single line of
|
||||
script runs, and if that address sits in a datacenter ASN, a perfect browser fingerprint
|
||||
does not hide it. The browser cannot disguise the IP, by design, because the IP is not
|
||||
a browser property.
|
||||
|
||||
So a headless host with a flawless desktop persona and a datacenter exit has fixed the
|
||||
JavaScript tells and left the network tell standing. The fix is a residential or mobile
|
||||
proxy that presents a clean address, passed on launch:
|
||||
|
||||
```python
|
||||
proxy = {
|
||||
"server": "socks5://gate.example.com:1080",
|
||||
"username": "user",
|
||||
"password": "pass",
|
||||
}
|
||||
with InvisiblePlaywright(seed=42, proxy=proxy) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
```
|
||||
|
||||
And the address is only the first of the things the browser does not fix. IP reputation,
|
||||
per-account quotas, rate limits, and behaviour and timing are all supplied by you: a
|
||||
clean exit, human pacing, and sane request volume. The [configuration page](configuration.md)
|
||||
covers proxy schemes and how the browser timezone is auto-derived from the exit so the
|
||||
two do not tell different stories, and the [Docker and container detection walkthrough](playwright-docker-detection.md)
|
||||
covers the host-side tells in the order they usually bite.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Can a website tell you are on a server? From the browser alone, it usually can, through
|
||||
software WebGL, a missing audio device and headless screen metrics. A real-browser build
|
||||
answers those as a desktop, on the browser side, regardless of the Linux or container host
|
||||
underneath, which is why the JavaScript-visible surface stops giving the server away. What
|
||||
it does not and cannot fix is the datacenter IP, which is read at the network layer and
|
||||
needs a clean proxy, along with the account limits and pacing that no fingerprint touches.
|
||||
Fix the machine tells with the browser, fix the address with the proxy, and pace the
|
||||
behaviour yourself.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can a website detect a headless or server browser?** Often, from the machine rather
|
||||
than the automation: a software WebGL renderer, no audio device, headless screen metrics,
|
||||
and a datacenter IP.
|
||||
|
||||
**Does invisible_playwright hide that I am on a server?** It presents a real GPU, real
|
||||
audio and Windows screen metrics on the browser side, so the JavaScript-visible tells look
|
||||
like a desktop. It does not hide the exit IP, which is a network-layer signal.
|
||||
|
||||
**Is the datacenter IP a browser problem?** No. The address is read before any script runs,
|
||||
so no browser can change it. That one needs a residential or mobile proxy.
|
||||
|
||||
**Why does a software renderer give me away?** Because a real desktop names a real GPU, and
|
||||
`llvmpipe` or `SwiftShader` is a plain statement that there is no graphics hardware present.
|
||||
|
||||
**Do I still need a proxy if my fingerprint is perfect?** Yes, if the host is in a
|
||||
datacenter. A flawless browser on a datacenter ASN is still on a datacenter ASN.
|
||||
|
||||
**Does this work the same in Docker as on a real machine?** The browser-side answers are
|
||||
the same because the persona is presented by the browser, not read from the host. The IP
|
||||
and the pacing still depend on where and how you run it.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's release gates, which read WebGL renderer, AudioContext output and screen
|
||||
metrics through the shipped binary on a Linux host and compare them against a stock
|
||||
desktop browser.
|
||||
- The per-surface pages linked throughout, each read from its own detector's source rather
|
||||
than from a rendered verdict.
|
||||
|
||||
**See also:** [Docker and container detection](playwright-docker-detection.md),
|
||||
[WebGL renderer strings](webgl-renderer-strings.md), and
|
||||
[screen size and other headless tells](screen-size-headless-tells.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 fixes the machine tells a
|
||||
server leaks in JavaScript; the datacenter IP and the pacing are still yours to supply.*
|
||||
@@ -0,0 +1,202 @@
|
||||
---
|
||||
title: "Can I Use My Real Browser Profile With Playwright?"
|
||||
description: "Playwright can point at a persistent profile, but reusing your daily browser leaks cookies and your machine fingerprint. Use a dedicated seed-fixed profile instead."
|
||||
parent: "The Automation Layer"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 24
|
||||
---
|
||||
|
||||
|
||||
# Can I Use My Real Browser Profile With Playwright?
|
||||
|
||||
Yes, technically. Playwright can launch against a [persistent user data
|
||||
directory](https://playwright.dev/python/docs/api/class-browsertype#browser-type-launch-persistent-context),
|
||||
and you can point it at the exact folder your everyday browser uses. The question is not
|
||||
whether it works. It is whether you want the two things that come with it: your personal
|
||||
cookies and history riding along in automated traffic, and whatever inconsistent
|
||||
fingerprint your daily machine happens to have.
|
||||
|
||||
Both are avoidable, and the fix is not "no profile". It is "a different profile". This
|
||||
page separates the good idea (a persistent profile) from the risky one (your personal
|
||||
one), and shows a seed-fixed persistent context that keeps login state across runs
|
||||
without carrying the host machine into every request.
|
||||
|
||||
## What people actually mean by "my real browser profile"
|
||||
|
||||
Two different wishes hide under the same sentence, and they have different answers.
|
||||
|
||||
The first is "I do not want to log in on every run." That is a reasonable and common
|
||||
need, and a persistent profile is the right tool for it: cookies, local storage and
|
||||
login state survive between sessions instead of starting empty each time.
|
||||
|
||||
The second is "I want to reuse the profile I browse with personally, because it is
|
||||
already logged in and already looks real." That is where it goes wrong. Your daily
|
||||
profile is full of your own cookies, your own history and consent decisions tied to
|
||||
your own identity, and none of that belongs in an automated session. It also inherits
|
||||
the fingerprint of the machine it launches on, which is a separate problem covered
|
||||
below.
|
||||
|
||||
You want the first wish granted and the second one declined.
|
||||
|
||||
## Why your personal profile is the wrong choice
|
||||
|
||||
Two independent reasons, and either one is enough on its own.
|
||||
|
||||
**It mixes your identity into automated traffic.** Every cookie, every stored session,
|
||||
every site that recognises you is now attached to whatever the automation does. If the
|
||||
automated session is flagged, throttled or challenged, it is your account that carries
|
||||
the record, not a disposable one. Linkability runs both directions: the profile links
|
||||
your automation to you, and links you to your automation.
|
||||
|
||||
**A stock profile carries whatever fingerprint the launching machine has.** This is the
|
||||
part most people miss. A plain profile does not standardise the machine underneath it.
|
||||
It reports the real GPU, the real fonts, the real screen and audio devices of wherever
|
||||
it runs. On your laptop that is your laptop. On a server it is a server with no GPU, no
|
||||
fonts and a screen size nobody has, which is [what actually gets a datacenter session
|
||||
detected](playwright-detected-as-bot.md), independent of any automation flag. Reusing
|
||||
your personal profile does not fix that. It just picks one specific inconsistent machine
|
||||
to leak.
|
||||
|
||||
The durable pattern is a dedicated profile whose identity you control, not the one you
|
||||
read your email with.
|
||||
|
||||
## The pattern that works: a dedicated, seed-fixed profile
|
||||
|
||||
invisible_playwright takes a persistent profile directory the same way plain Playwright
|
||||
does, through `profile_dir`. The difference is what fills in the machine. Instead of the
|
||||
host's real hardware, the fingerprint is derived from a seed, so the same seed produces
|
||||
the same coherent Windows browser every run: same GPU, same fonts, same screen, same
|
||||
audio context. Cookies and login state accumulate in the directory across runs; the
|
||||
machine stays a stable, real-looking Windows instance regardless of what the host
|
||||
actually is.
|
||||
|
||||
The launch is two lines over plain Playwright, and everything after it is stock
|
||||
Playwright:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# one directory, one seed, paired for good
|
||||
with InvisiblePlaywright(seed=42, profile_dir="/profiles/identity-42") as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com/account")
|
||||
# first run: log in here. the directory keeps the session.
|
||||
# later runs on the same seed + directory: already logged in.
|
||||
```
|
||||
|
||||
The `browser` object is a real Playwright `Browser`, so `new_page`, `goto`, `click`,
|
||||
`fill` and every other documented method work exactly as upstream. There is no wrapped
|
||||
subset to learn. Add a proxy and a timezone the same way [Configuration](configuration.md)
|
||||
describes, and the identity is complete: a logged-in session, on a consistent machine,
|
||||
behind the exit you chose.
|
||||
|
||||
The pairing is the rule to hold onto: one directory belongs to one seed, permanently. A
|
||||
stable directory with a changing seed describes a browser whose history spans weeks and
|
||||
whose graphics card changed overnight, which is exactly the contradiction [a persistent
|
||||
profile can create if you let the seed drift](persistent-profiles.md).
|
||||
|
||||
## Reproduce a run, and pin what has to stay fixed
|
||||
|
||||
The reason a fixed seed matters for a login profile is not only realism. It is
|
||||
debuggability. If every run drew a fresh machine, a failing run would tell you nothing:
|
||||
you could not separate the site changing from the fingerprint changing. Log the seed
|
||||
once and a failure becomes reproducible.
|
||||
|
||||
```python
|
||||
sf = InvisiblePlaywright(profile_dir="/profiles/identity-99")
|
||||
with sf as browser:
|
||||
print("seed =", sf.seed) # write this down next to the directory
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
```
|
||||
|
||||
Record the seed beside the directory name, because the folder outlives your memory of
|
||||
which number produced it. If one specific field has to hold constant across identities
|
||||
for reasons of your own, [pin that field](pinning.md) and leave the rest seed-derived
|
||||
rather than reusing a whole personal profile to get it.
|
||||
|
||||
## The honest caveat: what a profile does and does not buy you
|
||||
|
||||
A dedicated seed-fixed profile preserves session trust. It does not launder anything
|
||||
else, and it is worth being precise about the boundary.
|
||||
|
||||
What it fixes: the "no history" problem. The session looks like it has been used, stays
|
||||
logged in, and does not reset to a blank browser every run. What it does not touch:
|
||||
|
||||
- **IP reputation.** The profile says nothing about your exit. A perfect logged-in
|
||||
identity on a known datacenter address is still on a known datacenter address. Supply a
|
||||
clean proxy; the profile does not.
|
||||
- **Per-account limits and quotas.** A site that caps actions per account still caps
|
||||
them. A reused session does not raise the ceiling, and hammering it from one session is
|
||||
the surest way to spend the account.
|
||||
- **Rate limits and timing.** Behaviour and pacing are yours to supply. The engine makes
|
||||
the browser look real; it does not make a burst of requests look human. That is a
|
||||
[session-reuse-versus-relogin tradeoff](automating-login-vs-session-reuse.md) and a
|
||||
pacing decision, not a fingerprint one.
|
||||
|
||||
invisible_playwright is built to look like a real browser driven by a real person, which
|
||||
is why the fingerprint, TLS and driver layers read as a genuine Firefox and pass most
|
||||
in-page detection. That is a real and useful thing. It is not the same as evading every
|
||||
control, and a profile does not change where that line sits. The reader still brings the
|
||||
clean exit and the human pacing.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Can you use your real browser profile with Playwright? You can, and you should not. The
|
||||
part you want, staying logged in, comes from any persistent profile. The part you do not
|
||||
want, your personal cookies and one specific leaky machine in every request, is exactly
|
||||
what reusing your daily profile adds.
|
||||
|
||||
Point automation at a dedicated directory, pair it permanently with one seed so the
|
||||
machine underneath stays a coherent Windows browser instead of the host, and log the
|
||||
seed so a bad run is reproducible. Then remember what the profile is not: it keeps the
|
||||
session, and it leaves the IP, the quotas and the pacing to you.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can Playwright use an existing browser profile?** Yes, through a persistent user data
|
||||
directory. The mechanism is fine. Reusing the profile you personally browse with is the
|
||||
part to avoid.
|
||||
|
||||
**Why not just point it at my normal Chrome or Firefox profile?** Because it drags your
|
||||
personal cookies and history into automated traffic and inherits the launching machine's
|
||||
fingerprint, including a server's missing GPU and fonts.
|
||||
|
||||
**Does a persistent profile keep me logged in between runs?** Yes. Cookies and login
|
||||
state live in the directory and survive across sessions, as long as one directory maps
|
||||
to one seed and is never shared between concurrent runs.
|
||||
|
||||
**Does reusing a profile make me undetectable?** No. It fixes having no history and
|
||||
nothing else. The machine, the exit IP, the account quotas and your timing are all
|
||||
separate, and a profile touches none of them.
|
||||
|
||||
**Do I need a new seed for each profile?** Yes, a distinct seed per profile, and the
|
||||
same seed every time for a given profile. The seed is the machine; the directory is the
|
||||
history.
|
||||
|
||||
**Will a dedicated profile fix a blocked datacenter IP?** No. Session trust and IP
|
||||
reputation are unrelated. A logged-in identity on a flagged address is still on a flagged
|
||||
address; that needs a clean exit, not a profile.
|
||||
|
||||
## Sources
|
||||
|
||||
- Playwright's own [`launch_persistent_context`
|
||||
documentation](https://playwright.dev/python/docs/api/class-browsertype#browser-type-launch-persistent-context),
|
||||
which defines the user data directory mechanism this page builds on.
|
||||
- This project's persistent-context handling and the seed-to-fingerprint derivation
|
||||
described across these docs, including the seed and `profile_dir` pairing.
|
||||
- The detection ordering in the companion checklist, where machine tells outrank
|
||||
automation tells and the exit IP is a separate axis from the browser.
|
||||
|
||||
**See also:** [what a persistent profile fixes and breaks](persistent-profiles.md) for
|
||||
the traps that come with the directory, [automating the login versus reusing a
|
||||
session](automating-login-vs-session-reuse.md) for the tradeoff behind staying logged
|
||||
in, and [scraping behind a login with Playwright](how-to-scrape-behind-login-playwright.md)
|
||||
for the end-to-end version of this.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The seed-and-directory
|
||||
pairing rule is one I wrote down after debugging a profile whose machine changed
|
||||
overnight.*
|
||||
@@ -0,0 +1,195 @@
|
||||
---
|
||||
title: "Can two devices share a browser fingerprint?"
|
||||
description: "Yes - that's the goal: a shared browser fingerprint hides you among real users, while a unique one is trackable. How anonymity sets work and how to land in one."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 26
|
||||
---
|
||||
|
||||
|
||||
# Can two devices share a browser fingerprint?
|
||||
|
||||
Yes, two devices can present the same browser fingerprint, and if your goal is not to
|
||||
be followed around, that is the outcome you want rather than the one to avoid.
|
||||
|
||||
The intuition most people bring to this is backwards. It feels like a fingerprint should
|
||||
be unique, like a real one, and that a collision is a failure. For tracking it is the
|
||||
opposite: a fingerprint that only you have is a fingerprint that follows only you. A
|
||||
fingerprint that thousands of real people also have tells a tracker almost nothing about
|
||||
which of them you are.
|
||||
|
||||
This page is about that trade, why a common configuration beats a clever one, and how to
|
||||
land on a shared-looking identity on purpose instead of by luck.
|
||||
|
||||
## The anonymity set is the whole game
|
||||
|
||||
A browser fingerprint is not one value. It is a hash of many components read from
|
||||
JavaScript: the GPU string, the canvas and audio outputs, the installed fonts, the
|
||||
screen geometry, the platform, the language list, and dozens more. [FingerprintJS calls
|
||||
the resulting hash a visitor ID](fingerprintjs-visitor-id.md), and its job is to
|
||||
recognise you again on the next visit.
|
||||
|
||||
The number that decides whether it can is the size of the group that shares your value.
|
||||
This group is the anonymity set. If ten thousand other browsers produce exactly your
|
||||
hash, the visitor ID identifies a crowd, not you, and the tracker has to fall back on
|
||||
other signals to tell you apart. If your hash is unique, the visitor ID identifies you
|
||||
and only you, and it will do so every session until one of those components changes.
|
||||
|
||||
So the useful question is not "is my fingerprint unique". Uniqueness is the failure mode.
|
||||
The useful question is "how many real people look exactly like this", and you want that
|
||||
number large.
|
||||
|
||||
A one-of-a-kind fingerprint loses this even when every individual value is plausible. A
|
||||
GPU nobody else reports, a screen size nobody else has, a font set assembled by no real
|
||||
installer: each looks fine alone and, taken together, marks one browser out of everyone.
|
||||
That is why [pinning fields by hand is risky](pinning.md) unless you know the
|
||||
combination is one real machines actually ship.
|
||||
|
||||
## Why a common configuration beats a clever one
|
||||
|
||||
The instinct to look special is exactly the wrong instinct here.
|
||||
|
||||
Trackers do not need to prove you are automated to follow you. They only need your
|
||||
combination of values to be rare. Rarity is the signal, and it does not care whether the
|
||||
values are suspicious. A perfectly innocent, perfectly consistent, perfectly unique
|
||||
browser is perfectly trackable.
|
||||
|
||||
So the design target is the boring middle of the distribution: a Windows version many
|
||||
people run, a GPU many people have, a screen size that sits on a common laptop panel, a
|
||||
language list a large population shares. Land there and you disappear into a group. Land
|
||||
on the tails, even with clean values, and you stand out by being precise.
|
||||
|
||||
This is also why "resist fingerprinting" and "blend into a crowd" are two different
|
||||
strategies that can conflict. The browser's own
|
||||
[resistFingerprinting mode](resist-fingerprinting.md) makes many browsers report the same
|
||||
flattened values, which is one way to build an anonymity set, but the set it puts you in
|
||||
is the set of people who turned that mode on, and that set has its own recognisable shape.
|
||||
Blending in with the general population is a different bet: look like the common case, not
|
||||
like the privacy case.
|
||||
|
||||
## How a seed lands you in a crowd
|
||||
|
||||
invisible_playwright generates each identity to look like a common, real-world Windows
|
||||
machine rather than a rare or unusual one, because a configuration many genuine users
|
||||
also present blends in, while a one-of-a-kind combination stands out and is trackable.
|
||||
The GPU string, the renderer, and the capability limits it reports are chosen together
|
||||
and cross-checked, so
|
||||
[the WebGL parameters agree with each other](webgl-parameters-are-identical.md) the way a
|
||||
real driver's do rather than being mixed from different machines.
|
||||
|
||||
Switching from stock Playwright is two lines, and the identity is generated for you:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright() as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
```
|
||||
|
||||
Pass a seed and every field it implies comes back identical, run after run, so you can
|
||||
inspect the exact identity a seed produces and reuse it:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# same GPU, same canvas hash, same fonts, same screen, every run
|
||||
```
|
||||
|
||||
The `browser` returned is a real Playwright `Browser`. Every method works exactly as
|
||||
documented upstream; there is no reduced API to learn.
|
||||
|
||||
Two different seeds give two different plausible identities, and because each is
|
||||
generated to be a common real-world configuration, both can land in a well-populated
|
||||
part of the space.
|
||||
That is the sense in which two of your own devices can "share" a look: not that they hash
|
||||
to the same value by accident, but that each is a common configuration, and common
|
||||
configurations are shared by construction with the real population.
|
||||
|
||||
## The caveat: fingerprint is not the only thing matched
|
||||
|
||||
Blending in on fingerprint does not blend in everything, and this is the honest limit of
|
||||
what any fingerprint layer can do.
|
||||
|
||||
A browser identity that looks like a common real machine is why invisible_playwright
|
||||
passes most in-page detection: the fingerprint, the TLS handshake and the driver layer
|
||||
read as a genuine Firefox rather than an automated one. That is a real and load-bearing
|
||||
result. It is also only one of the axes a serious system matches on, and the others are
|
||||
matched separately:
|
||||
|
||||
- **Your IP address.** A crowd-blending fingerprint on a datacenter address, or on a
|
||||
proxy IP that is already known and shared by a thousand scrapers this minute, is
|
||||
singled out by the address alone. Fingerprint collisions do not help you here; supply a
|
||||
clean exit yourself.
|
||||
- **Your request pattern.** Rate, timing, the order you touch pages, per-account quotas.
|
||||
A hundred sessions that each look like a different real person, all arriving in the same
|
||||
ten seconds from the same place, are a pattern no fingerprint hides. Human pacing is
|
||||
yours to supply.
|
||||
- **The story your surfaces tell together.** A common browser fingerprint with a timezone
|
||||
or language that contradicts the exit IP is not blended in, it is inconsistent, and
|
||||
[a timezone that does not match the proxy](timezone-proxy-mismatch.md) is one of the
|
||||
most common self-inflicted versions of this.
|
||||
|
||||
So the accurate claim is narrow and worth stating plainly: a shared, common fingerprint
|
||||
helps you avoid being tracked and identified by fingerprint. It does nothing for IP
|
||||
reputation, quotas, rate limits, or behaviour. Those are matched on their own, they can
|
||||
single you out on their own, and the reader supplies the clean proxy and the human pacing
|
||||
that address them. Anyone promising that one browser makes a session undetectable is
|
||||
selling the part that does not exist.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Two devices sharing a browser fingerprint is not a bug, it is the objective. Uniqueness
|
||||
is what makes a browser trackable across sessions; membership in a large group of
|
||||
look-alike real users is what makes it hard to follow. Sampling common, cross-checked
|
||||
real-world configurations lands you in that group on purpose. Then pair it with an
|
||||
address and a rhythm that fit the same story, because fingerprint blending buys you the
|
||||
fingerprint axis and only that one.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can two devices have the same browser fingerprint?** Yes. Many components are shared by
|
||||
large populations, so identical hashes across devices are normal, and for anti-tracking
|
||||
they are what you want.
|
||||
|
||||
**Is a unique fingerprint good or bad?** Bad, if you do not want to be followed. Unique
|
||||
means recognisable on every future visit. Common means lost in a crowd.
|
||||
|
||||
**Does sharing a fingerprint make me anonymous?** On the fingerprint axis it hides you in
|
||||
a group. It does nothing about your IP address or your request pattern, which are matched
|
||||
separately and can identify you on their own.
|
||||
|
||||
**Why does invisible_playwright aim for a common configuration instead of a rare one?**
|
||||
Because rarity is the tracking signal. A configuration many real users also present puts
|
||||
you in a large anonymity set instead of marking you out.
|
||||
|
||||
**If I pass the same seed on two machines, do they look identical?** Yes. The same seed
|
||||
produces the same GPU, canvas, audio, fonts and screen, which is deliberate: it makes a
|
||||
run reproducible and lets two devices present the same known-good identity.
|
||||
|
||||
**Will a good fingerprint alone stop me from being blocked?** No. It handles the
|
||||
fingerprint, TLS and driver layers. A datacenter IP or a robotic request pattern is still
|
||||
a datacenter IP or a robotic pattern, and you supply the clean exit and the human pacing.
|
||||
|
||||
## Sources
|
||||
|
||||
- The FingerprintJS open-source library's visitor ID model, read from its own source, for
|
||||
how many components combine into one recognisable hash.
|
||||
- This project's approach of generating common, real-world Windows and GPU
|
||||
configurations rather than unique ones, and its cross-checking of GPU string, renderer
|
||||
and capability limits against each other.
|
||||
- This project's release gates, which separate fingerprint realness from IP and request
|
||||
signals precisely because a clean fingerprint does not clear the other two.
|
||||
|
||||
**See also:** [what a FingerprintJS visitor ID actually measures](fingerprintjs-visitor-id.md),
|
||||
[why the WebGL parameters have to agree with each other](webgl-parameters-are-identical.md),
|
||||
and [when the timezone does not match the proxy](timezone-proxy-mismatch.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 anonymity-set framing
|
||||
is the one that keeps me from "fixing" a shared fingerprint that was doing its job.*
|
||||
@@ -0,0 +1,192 @@
|
||||
---
|
||||
title: "Can websites detect a datacenter or proxy IP?"
|
||||
description: "Yes, directly at the network layer. No fingerprint can hide the IP the connection arrives on. Why fingerprint and IP layers are independent and both must be right."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 16
|
||||
---
|
||||
|
||||
|
||||
# Can websites detect a datacenter or proxy IP?
|
||||
|
||||
Yes, directly. The server sees the address your connection arrives on before a
|
||||
single line of your JavaScript runs, and it can look that address up: which
|
||||
network owns it, whether it belongs to a hosting provider or a home broadband
|
||||
line, and whether it has been abused recently. No browser fingerprint changes
|
||||
that lookup, because the address is a property of the connection, not of the
|
||||
page.
|
||||
|
||||
This is the honest boundary of any browser-side stealth. A tool like
|
||||
invisible_playwright makes the browser look like a real person's, and that is
|
||||
most of what public detection checks read. It does not, and cannot, change the
|
||||
reputation of the IP you route through. Those are two independent layers, and
|
||||
both have to be right.
|
||||
|
||||
## What the server reads before your page loads
|
||||
|
||||
Every request carries a source IP. From that one number the receiving server
|
||||
derives, with no cooperation from you:
|
||||
|
||||
- **The ASN**, the [autonomous system number](https://datatracker.ietf.org/doc/html/rfc1930),
|
||||
which identifies the network that owns the address block. Hosting and cloud
|
||||
providers have their own ASNs, and they are trivially separable from
|
||||
consumer broadband and mobile carriers.
|
||||
- **The address type**, datacenter versus residential versus mobile, which
|
||||
public and commercial datasets label directly.
|
||||
- **Reputation**, meaning whether this address or its neighbours have recently
|
||||
sent traffic that looked automated or abusive. Shared and heavily recycled
|
||||
exits accumulate this quickly.
|
||||
|
||||
None of that is a browser property. It is decided at the network layer, the same
|
||||
layer that carries the [TLS handshake no in-page test can see](how-to-test-bot-detection.md).
|
||||
A perfect fingerprint sitting on an address the server already distrusts is a
|
||||
consistent browser on a flagged IP, and the flag wins.
|
||||
|
||||
## Why the fingerprint cannot reach it
|
||||
|
||||
The fingerprint cannot reach the IP because the two are different kinds of
|
||||
value: the fingerprint is data the browser volunteers to the page, and the IP
|
||||
is decided by the network carrying the connection, which the page never
|
||||
touches.
|
||||
|
||||
A fingerprint is everything the page can measure about the client from inside
|
||||
the sandbox: the user agent, the GPU string, the canvas and audio hashes, the
|
||||
font list, the screen, the language settings. All of it is data the browser
|
||||
volunteers in response to JavaScript. That is exactly why it is spoofable, and
|
||||
why matching it to a real Windows machine is worth doing.
|
||||
|
||||
The IP is the opposite kind of value. It is not something the browser reports;
|
||||
it is where the packets came from. The browser cannot lie about it because the
|
||||
browser is not the one telling the server. The network is. You can change which
|
||||
IP you arrive on by routing through a different proxy, but you cannot make a
|
||||
given IP read as something it is not, and no amount of in-page patching touches
|
||||
it. This is the single most common misunderstanding about stealth: people expect
|
||||
a good fingerprint to cover the address, and the two never meet.
|
||||
|
||||
## Both layers, independently, with the real API
|
||||
|
||||
Because the layers are independent, you supply the IP and the tool supplies the
|
||||
browser. The proxy is passed at launch, and everything downstream is stock
|
||||
Playwright:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
proxy = {
|
||||
"server": "socks5://gate.example.com:1080",
|
||||
"username": "user",
|
||||
"password": "pass",
|
||||
}
|
||||
|
||||
with InvisiblePlaywright(seed=42, proxy=proxy) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com/")
|
||||
print(page.title())
|
||||
```
|
||||
|
||||
Two things are happening here, and they are separate. `seed=42` fixes the
|
||||
browser half: the same GPU, canvas hash, audio context, fonts and screen every
|
||||
run, so a failure is reproducible. `proxy=...` fixes the IP half: every request,
|
||||
including DNS, leaves through that exit. The `browser` object is a real
|
||||
Playwright [`Browser`](https://playwright.dev/python/docs/api/class-browser), so
|
||||
`new_page`, `goto`, `click` and the rest behave exactly as documented upstream.
|
||||
|
||||
By default, with no `timezone=` argument, the browser timezone is derived from
|
||||
the exit IP so the two stories agree. If you want to confirm the exit is what you
|
||||
think it is, read it from inside the browser rather than assuming, and check that
|
||||
[WebRTC is not reporting a second address next to the proxy's](how-to-check-proxy-ip-leak.md).
|
||||
|
||||
## Choosing the IP half so it does not undo the browser half
|
||||
|
||||
The fingerprint work is wasted if the address is one a server distrusts on sight.
|
||||
Two rules follow directly from what the server reads:
|
||||
|
||||
- **Type matters more than count.** A residential or mobile exit shares an ASN
|
||||
and an address type with ordinary human traffic; a datacenter exit does not,
|
||||
no matter how many of them you rotate through. Rotation does not change the
|
||||
type.
|
||||
- **Freshness matters as much as type.** A large share of cheaply available
|
||||
proxies are already public, which means their addresses are already on the
|
||||
lists servers consult, and they were flagged before you ever used them. The
|
||||
distinction between a clean exit and a burned one is not price, it is whether
|
||||
the address is already known. The tradeoffs between exit protocols are covered
|
||||
in [SOCKS5 versus HTTP proxies for a browser](socks5-vs-http-proxy-browser.md),
|
||||
and the reputation problem itself in
|
||||
[why scraping gets blocked even through a proxy](web-scraping-getting-blocked-proxies.md).
|
||||
|
||||
Get both halves right and the server sees a genuine Firefox arriving from an
|
||||
address that looks like a person's. Get the browser right and the IP wrong, and
|
||||
you have built a careful disguise and then signed it at the door.
|
||||
|
||||
## What this does and does not fix
|
||||
|
||||
To be explicit, because overclaiming here is both false and a real risk:
|
||||
|
||||
invisible_playwright is designed to look like a real browser driven by a real
|
||||
person, and that is why it passes most fingerprint, TLS and driver-layer checks:
|
||||
those layers read as a genuine Firefox. On its own it does not fix IP reputation,
|
||||
per-account quotas, rate limits, or behaviour and timing. Those are yours to
|
||||
supply: a clean exit for the address, human pacing for the behaviour, sane limits
|
||||
for the account. There is no setting that makes an IP undetectable, because the
|
||||
IP is not something the browser gets to describe.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Can websites detect a datacenter or proxy IP? Yes, directly and early, at a layer
|
||||
no fingerprint reaches. The browser fingerprint and the IP are independent
|
||||
signals, read by different parts of the stack, and a detector that sees a perfect
|
||||
browser on a flagged address believes the address. So match the browser, which is
|
||||
what this tool does, and pair it with an exit whose type and reputation hold up,
|
||||
which is what you bring. Neither half alone is a session; both right is.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can a browser fingerprint hide my IP?** No. The IP is where the connection
|
||||
comes from, not something the browser reports, so no in-page value or spoof
|
||||
changes it.
|
||||
|
||||
**Will a residential proxy alone get me through?** It fixes the address half. If
|
||||
the browser still looks automated, a clean IP does not save it. Both layers have
|
||||
to be right.
|
||||
|
||||
**How does a site know my IP is a datacenter?** From the ASN and address-type
|
||||
datasets tied to the IP. Hosting networks have their own autonomous system
|
||||
numbers and are labelled as such in public data.
|
||||
|
||||
**Does rotating IPs help?** It helps with rate limits and per-address velocity.
|
||||
It does not change the type: rotating datacenter exits are still datacenter
|
||||
exits.
|
||||
|
||||
**Can invisible_playwright change my ASN or reputation?** No, and nothing on the
|
||||
browser side can. It handles the fingerprint, TLS and driver layers; you supply
|
||||
the exit.
|
||||
|
||||
**Why do I pass every fingerprint test and still get blocked?** Because the
|
||||
suites do not see your address, and a consistent browser on a distrusted IP is
|
||||
still on a distrusted IP.
|
||||
|
||||
## Sources
|
||||
|
||||
- [RFC 1930](https://datatracker.ietf.org/doc/html/rfc1930), the IETF guidelines
|
||||
that define an Autonomous System as a routing policy unit and specify the ASN
|
||||
that identifies it.
|
||||
- [Playwright's `Browser` class reference](https://playwright.dev/python/docs/api/class-browser),
|
||||
for what the `browser` object in the example above exposes once the proxy is
|
||||
wired in.
|
||||
- This project's default behaviour: the proxy dict passed at launch routes every
|
||||
request and its DNS through the exit, and the browser timezone is derived from
|
||||
that exit unless an explicit zone is set.
|
||||
- The [configuration notes](configuration.md) on proxy schemes and on why roughly
|
||||
nine in ten cheap proxies are already known before first use.
|
||||
- The [testing method page](how-to-test-bot-detection.md), which lists IP
|
||||
reputation among the things no in-page suite covers.
|
||||
|
||||
**See also:** [the checklist for being detected on one site](playwright-detected-as-bot.md),
|
||||
[how to check for a proxy IP leak](how-to-check-proxy-ip-leak.md), and
|
||||
[when the timezone does not match the proxy](timezone-proxy-mismatch.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 browser half is
|
||||
what the patch does; the IP half is the one honest thing it cannot do for you.*
|
||||
@@ -0,0 +1,206 @@
|
||||
---
|
||||
title: "Can websites detect Playwright? What is actually visible"
|
||||
description: "Stock Playwright exposes a webdriver flag, protocol artifacts and mismatched OS fingerprint. Which signals catch your run, and what a patched Firefox fixes."
|
||||
parent: "The Automation Layer"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 20
|
||||
---
|
||||
|
||||
|
||||
# Can websites detect Playwright? What is actually visible
|
||||
|
||||
Yes, in principle. Stock Playwright leaves signals in the page that a script can read,
|
||||
and any one of them is enough to tell "this is automated" from "this is a person". But
|
||||
"in principle" is doing real work in that sentence. Whether a given site catches your
|
||||
specific run depends entirely on which of those signals it bothers to check, and there
|
||||
are only a handful of them.
|
||||
|
||||
This page enumerates the concrete tells a page can read, maps each to what a real-looking
|
||||
browser does about it, and shows the two-line launch that removes the browser-level ones.
|
||||
It also states plainly what that launch does not touch, because a page that promised you
|
||||
undetectability would be lying to you.
|
||||
|
||||
## The three signals a page can actually read
|
||||
|
||||
Strip away the folklore and stock Playwright exposes three families of tell to in-page
|
||||
JavaScript:
|
||||
|
||||
- **A driver flag.** `navigator.webdriver` is defined by the
|
||||
[WebDriver automation standard](https://www.w3.org/TR/webdriver2/), and a page reads it
|
||||
with one property access.
|
||||
- **Protocol and automation artifacts.** Globals left in scope by a stealth layer, a
|
||||
built-in whose `toString()` no longer says `[native code]`, an event that arrives
|
||||
without the trusted bit a real click carries.
|
||||
- **A fingerprint that contradicts itself.** The user agent claims one operating system
|
||||
while the GPU string, the font list, the audio device or the screen geometry describe a
|
||||
headless machine somewhere else.
|
||||
|
||||
Everything a page-level bot check does falls into one of those three. The rest of this
|
||||
article takes them one at a time.
|
||||
|
||||
## Signal one: the webdriver flag
|
||||
|
||||
The cheapest check there is. Under standard automation, `navigator.webdriver` returns
|
||||
`true`, and a single line of page script reads it.
|
||||
|
||||
The naive fix makes things worse. Setting the property to `false` from a script is itself
|
||||
a tell, because a genuine browser that was never automated reports `undefined`, not
|
||||
`false`. A value where there should be an absence is a signature of its own. The correct
|
||||
behaviour is the one an untouched browser produces, and getting there from JavaScript
|
||||
patching is [harder than it looks](navigator-webdriver-explained.md).
|
||||
|
||||
invisible_playwright drives a Firefox patched at the C++ level, so the flag reports the
|
||||
real-browser value without a script ever assigning it. There is no override to catch,
|
||||
because nothing overrode anything.
|
||||
|
||||
## Signal two: automation globals and protocol artifacts
|
||||
|
||||
Automation globals and protocol artifacts are what the act of driving the browser leaves
|
||||
lying around, and they exist whether or not the driver flag above was ever touched.
|
||||
|
||||
JavaScript stealth plugins reach into built-ins to hide the first signal, and in doing so
|
||||
they create the second: a redefined function whose `toString()` stops returning
|
||||
`[native code]`, a property descriptor that a real engine never has, a global that only a
|
||||
particular tooling stack defines. A tampering-oriented suite such as CreepJS does not ask
|
||||
what you report, it asks whether anything you report contradicts anything else, and a
|
||||
built-in that has been rewritten is exactly that kind of contradiction. This is
|
||||
[the native-code check](tostring-native-code-detection.md), and it is the reason stacking
|
||||
two disguises reads worse than one.
|
||||
|
||||
Because the browser is patched in the engine rather than in the page, there are no
|
||||
injected globals to enumerate and no rewritten built-ins to catch with `toString()`. The
|
||||
functions a page inspects are the genuine ones.
|
||||
|
||||
## Signal three: a fingerprint that does not match the claimed OS
|
||||
|
||||
A fingerprint that contradicts the claimed operating system is the family that catches most
|
||||
server-side automation, and it has nothing to do with the driver at all.
|
||||
|
||||
A page reads the user agent, then reads the GPU renderer string, the installed fonts, the
|
||||
audio device parameters and the screen geometry, and checks that they tell the same story.
|
||||
A headless machine in a datacenter usually fails that check without any automation flag
|
||||
being set: a software renderer under a claim of desktop hardware, a font set that belongs
|
||||
to a different operating system, an audio stack answering with defaults, a screen
|
||||
resolution no real display has. None of those are automation tells. They are
|
||||
"this is a datacenter" tells, and they survive every page-level patch because they are not
|
||||
in JavaScript's gift to change.
|
||||
|
||||
invisible_playwright derives a complete, internally consistent fingerprint from a seed:
|
||||
GPU, canvas, audio, fonts and screen, roughly 400 fields, generated to agree with each
|
||||
other and to describe a real Windows desktop rather than the host the code runs on. Same
|
||||
seed, same machine, every run, which is what makes a failure reproducible enough to bisect.
|
||||
This is the family that a real-browser fingerprint fixes and a property patch cannot, and
|
||||
it is why the launch below passes most JS detection: the driver layer, the fingerprint and
|
||||
the TLS handshake all read as a genuine Firefox.
|
||||
|
||||
## The launch that removes the browser-level tells
|
||||
|
||||
Switching from stock Playwright is two lines, and the object you get back is a real
|
||||
Playwright `Browser`, so every method you already use works unchanged.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# seed=42 makes the identity reproducible; drop it for a fresh one each run
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# navigator.webdriver reads as a real browser; the fingerprint is consistent
|
||||
print(page.evaluate("navigator.webdriver"))
|
||||
```
|
||||
|
||||
Add a proxy when you deploy, since the browser-level tells are only half the picture:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
proxy = {"server": "socks5://gate.example.com:1080", "username": "u", "password": "p"}
|
||||
with InvisiblePlaywright(seed=42, proxy=proxy) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
```
|
||||
|
||||
The async API is identical, `from invisible_playwright.async_api import InvisiblePlaywright`
|
||||
with `await` in front of the page calls. Nothing else about your Playwright code changes.
|
||||
|
||||
## What this does not fix, and why saying so matters
|
||||
|
||||
Here is the honest boundary, because a tool that removed only some of the signals and let
|
||||
you believe it removed all of them would get you blocked with more confidence, not less.
|
||||
|
||||
The launch above addresses the three browser-level families: the driver flag, the
|
||||
automation artifacts and the fingerprint, plus the TLS handshake, because the request is
|
||||
made by a real Firefox rather than something impersonating one. What it does not touch:
|
||||
|
||||
- **IP reputation.** A consistent browser on a known datacenter address is still on a
|
||||
known datacenter address. You supply a clean exit.
|
||||
- **Per-account quotas and rate limits.** A perfect fingerprint does not raise a limit the
|
||||
account already hit.
|
||||
- **Behaviour and timing.** A burst of identical requests, a form filled in eighty
|
||||
milliseconds, a session with no pointer motion. Some sites do not fingerprint at all,
|
||||
they watch, and pacing is on you.
|
||||
|
||||
So the accurate claim is narrow and true: invisible_playwright makes the browser read as a
|
||||
real one, which is why it passes most in-page detection. It does not make the session
|
||||
invulnerable, and no software can, because half the signals are about the network and the
|
||||
account rather than the browser. When a run still fails with all three browser families
|
||||
clean, the [checklist for being detected on one site](playwright-detected-as-bot.md) works
|
||||
the remaining suspects in the cheap-first order, and the network layer has
|
||||
[its own page on the handshake](ja3-ja4-tls-fingerprint.md).
|
||||
|
||||
## Conclusion
|
||||
|
||||
Can websites detect Playwright? They can detect stock Playwright whenever they check for
|
||||
one of three things: the webdriver flag, automation artifacts, or a fingerprint that
|
||||
disagrees with the claimed OS. A patched Firefox driven by stock Playwright removes all
|
||||
three at the engine level, which is why it clears most JavaScript detection. It does
|
||||
nothing for your IP, your quotas or your pacing, so the honest answer to the title is that
|
||||
it fixes the browser and leaves the rest to you. Verify it the way you would verify
|
||||
anything here: [compare against a stock browser and run it more than once](how-to-test-bot-detection.md).
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can a website tell I am using Playwright?** If it checks the webdriver flag, automation
|
||||
artifacts or fingerprint consistency, yes for stock Playwright. A patched-engine browser
|
||||
removes those browser-level tells.
|
||||
|
||||
**Does invisible_playwright make me undetectable?** No, and nothing does. It makes the
|
||||
browser read as a real Firefox, which passes most in-page checks. Your IP, account limits
|
||||
and behaviour are separate and still yours to handle.
|
||||
|
||||
**Is navigator.webdriver enough to catch me?** It is the cheapest check and stock
|
||||
automation fails it. Setting it to `false` in a script is its own tell; a real browser
|
||||
reports `undefined`.
|
||||
|
||||
**Why do I pass fingerprint tests and still get blocked?** Because those tests do not see
|
||||
your address, your request rate or your timing, and a consistent browser on a datacenter
|
||||
IP is still on a datacenter IP.
|
||||
|
||||
**Do stealth plugins help?** They fix the first signal and often create the second: a
|
||||
rewritten built-in that a tampering check flags. Running one on top of a patched engine is
|
||||
two disguises contradicting each other.
|
||||
|
||||
**How do I check what a site actually reads?** Open a detection suite in your automated
|
||||
browser and a stock browser on the same machine, and diff the reports field by field
|
||||
rather than reading the score.
|
||||
|
||||
## Sources
|
||||
|
||||
- The [W3C WebDriver specification](https://www.w3.org/TR/webdriver2/), which defines the
|
||||
`navigator.webdriver` property and the automation flag behind it.
|
||||
- This project's real API surface, `InvisiblePlaywright(seed=...)` and the returned
|
||||
Playwright `Browser`, as documented in the quickstart and configuration pages.
|
||||
- The public detection suites CreepJS, BotD, FingerprintJS, sannysoft and BrowserLeaks,
|
||||
each of which reads one or more of the three signal families described above.
|
||||
- This project's release gates, which assert the presence of a real-browser signal rather
|
||||
than the absence of a wrong one, and separate browser tells from IP and behaviour.
|
||||
|
||||
**See also:** [the webdriver flag in detail](navigator-webdriver-explained.md),
|
||||
[the checklist for a single blocking site](playwright-detected-as-bot.md), and
|
||||
[how to test whether your browser is detected](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 honest boundary in the
|
||||
last section is the one I most wish more of these pages drew.*
|
||||
@@ -0,0 +1,208 @@
|
||||
---
|
||||
title: "Can you be fingerprinted in incognito mode?"
|
||||
description: "Yes: incognito mode clears cookies and site storage but leaves canvas, WebGL, fonts, user agent, timezone and the TLS handshake fully readable and re-linkable."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 23
|
||||
---
|
||||
|
||||
|
||||
# Can you be fingerprinted in incognito mode?
|
||||
|
||||
Yes. This is the single most common misunderstanding about private browsing, and it is
|
||||
worth stating plainly before the details: incognito mode clears **state**, not
|
||||
**identity**. It empties cookies and site storage at the end of a session. It does not
|
||||
change what your browser looks like while the session is running, and that is exactly
|
||||
the part fingerprinting reads.
|
||||
|
||||
This page is what private mode actually does, why stateless fingerprinting is untouched
|
||||
by it, how a service re-links you across incognito windows anyway, and what changing the
|
||||
fingerprint values themselves looks like in practice.
|
||||
|
||||
## What private mode actually clears
|
||||
|
||||
Open a private window and the browser makes one promise: when you close it, the cookies,
|
||||
`localStorage`, `sessionStorage`, IndexedDB and cache from that session go away. History
|
||||
is not written to disk. That is the whole feature, and for its intended purpose (a shared
|
||||
family computer, not leaving a booking half-finished in your history) it does that job.
|
||||
|
||||
Notice what is on that list: all of it is **state the site wrote to your machine**. A
|
||||
cookie is a value the server set and asked you to hand back. Private mode's guarantee is
|
||||
that you stop handing those back once the window closes.
|
||||
|
||||
Nothing on that list is a property of the browser itself. And identification does not
|
||||
need you to hand anything back.
|
||||
|
||||
## Why stateless fingerprinting does not care
|
||||
|
||||
A cookie is something you were **given**. A fingerprint is something you **are**. Private
|
||||
mode only deletes the first kind.
|
||||
|
||||
When a page measures your browser, it reads values the browser exposes on request, no
|
||||
storage involved:
|
||||
|
||||
- **Canvas.** The page draws text and shapes to an offscreen canvas and
|
||||
[reads the pixels back](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL)
|
||||
as an encoded image. The exact bytes depend on your GPU, drivers and font rasterizer, and
|
||||
they are identical in a private window because it is the same GPU. See
|
||||
[why canvas output can change every run](canvas-fingerprint-changes-every-run.md) for
|
||||
what a real defense against this looks like.
|
||||
- **WebGL.** The
|
||||
[renderer and vendor string](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_debug_renderer_info)
|
||||
and the numeric limits of your graphics stack. Same machine, same values, private or not.
|
||||
- **Fonts.** The list of installed fonts, measured by rendering and comparing widths. A
|
||||
private window renders with the same fonts.
|
||||
- **User agent, platform, language, timezone.** All reported the same way in incognito.
|
||||
- **The [TLS handshake](https://datatracker.ietf.org/doc/html/rfc8446).** Decided by the
|
||||
network stack before a single line of page JavaScript runs, so no browsing mode touches
|
||||
it. [No in-page test can even see it](ja3-ja4-tls-fingerprint.md), and neither can
|
||||
incognito.
|
||||
|
||||
Read that list again against the previous section. There is no overlap. Private mode
|
||||
clears cookies and storage; fingerprinting reads GPU, fonts, TLS and the rest. The two
|
||||
sets do not intersect, which is why a fingerprint survives the mode that was supposed to
|
||||
protect it.
|
||||
|
||||
## How you get re-linked across incognito windows
|
||||
|
||||
Here is the part that surprises people. Because the fingerprint is stable and does not
|
||||
depend on stored state, a service can compute the same identifier in a normal window, in
|
||||
a private window, and in a second private window you opened an hour later to "start
|
||||
fresh". [FingerprintJS builds exactly this kind of visitor ID](fingerprintjs-visitor-id.md)
|
||||
by hashing many of those stateless components together.
|
||||
|
||||
So the common workflow of "open an incognito window to look like a new visitor" does not
|
||||
produce a new visitor. It produces the same visitor with an empty cookie jar. The site
|
||||
sets a fresh cookie, ties it to the fingerprint it just computed, and the link is
|
||||
restored on the first request. Clearing the cookie deleted the label on the folder, not
|
||||
the folder.
|
||||
|
||||
This is not a bug in private mode. Private mode never promised a new identity. It
|
||||
promised no leftover state, and it delivers that.
|
||||
|
||||
## Changing the values themselves, not clearing storage
|
||||
|
||||
If the problem is that the fingerprint values are stable and readable, the fix is to
|
||||
change the values, which is the specific thing private mode does not do. That is what
|
||||
invisible_playwright does: a Firefox patched at the C++ level so that canvas, WebGL,
|
||||
fonts, screen and the rest report seed-derived values, driven by stock Playwright.
|
||||
|
||||
Two lines to launch, and the browser you get back is a real Playwright
|
||||
[`Browser`](https://playwright.dev/python/docs/api/class-browser) with every standard
|
||||
method:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# canvas, WebGL, fonts, screen all report seed-42 values,
|
||||
# not this machine's values
|
||||
```
|
||||
|
||||
The seed is the whole point. The same seed produces the same coherent identity every
|
||||
run, and a different seed produces a different one. So where private mode gives you the
|
||||
same machine with its storage wiped, a new seed gives you a genuinely different machine
|
||||
that happens to be internally consistent:
|
||||
|
||||
```python
|
||||
# a different, self-consistent identity - a different GPU, fonts, canvas hash
|
||||
with InvisiblePlaywright(seed=7) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
```
|
||||
|
||||
You can prove the difference to yourself. Open a public fingerprinting suite with
|
||||
`seed=42`, note the visitor ID or the canvas hash, close it, reopen with `seed=42`, and
|
||||
it matches. Change to `seed=7` and it moves. That is the value changing, which is the
|
||||
axis incognito leaves fixed. For the Firefox `about:config` route to the neighbouring
|
||||
problem, [`privacy.resistFingerprinting` and what it trades away](resist-fingerprinting.md)
|
||||
is worth reading before you reach for it.
|
||||
|
||||
## The honest caveat: it does not change your IP
|
||||
|
||||
There is one thing this shares with private mode: neither touches your IP address.
|
||||
Incognito does nothing for your address, and neither does changing the fingerprint. Your
|
||||
exit IP, its reputation, and the ASN it sits in are all still exactly what they were.
|
||||
|
||||
This matters because a perfect, distinct, self-consistent browser on a datacenter IP that
|
||||
a thousand other automated sessions are using this minute is still on that IP. The
|
||||
fingerprint and the driver layer reading as a genuine Firefox is why most detection
|
||||
checks pass; it is not why a session passes. The reader supplies the rest:
|
||||
|
||||
- **A clean exit.** The fingerprint work is wasted behind an address already on a
|
||||
blocklist. See [Configuration](configuration.md) for proxy setup.
|
||||
- **Human pacing and behaviour.** Timing, pointer motion and typing rhythm are a separate
|
||||
surface that no fingerprint change addresses.
|
||||
- **Per-account quotas and rate limits.** A new fingerprint is not a new account, and it
|
||||
does not reset a counter the service keeps on its own side.
|
||||
|
||||
Changing the fingerprint fixes the fingerprint. It does not fix the network or the
|
||||
behaviour, and claiming otherwise would be false.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Can you be fingerprinted in incognito mode? Yes, identically to a normal window, because
|
||||
private mode clears the cookies and storage a site wrote to your machine and leaves every
|
||||
readable property of the browser (canvas, WebGL, fonts, user agent, timezone, TLS)
|
||||
exactly where it was. Stateless fingerprinting reads those properties, so it works the
|
||||
same in either mode, and a service can re-link you across incognito windows on the
|
||||
fingerprint alone.
|
||||
|
||||
Changing the values themselves is a different operation from clearing state, and it is
|
||||
the one incognito does not perform. invisible_playwright performs it per seed, so the
|
||||
same input gives the same consistent identity and a new input gives a new one. Pair that
|
||||
with a clean exit and human pacing, because the fingerprint is only one of the surfaces a
|
||||
session is judged on.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does incognito mode stop fingerprinting?** No. It clears cookies and site storage at
|
||||
the end of the session and changes nothing about canvas, WebGL, fonts, user agent,
|
||||
timezone or TLS, which are what fingerprinting reads.
|
||||
|
||||
**Can a site tell it is the same person across two incognito windows?** Yes. The
|
||||
fingerprint is stable and does not depend on stored state, so the same identifier is
|
||||
computed in each window and the empty cookie jar is refilled and re-linked on the first
|
||||
request.
|
||||
|
||||
**What does private mode actually protect me from?** Leaving state behind on the machine:
|
||||
history, cookies and cache from that session. That is a real feature, just not an
|
||||
anti-fingerprinting one.
|
||||
|
||||
**Does incognito change my IP address?** No, and neither does changing the fingerprint.
|
||||
The exit IP and its reputation are a separate surface you have to handle yourself.
|
||||
|
||||
**How do I actually get a different fingerprint?** Change the values the browser reports
|
||||
rather than clearing what a site stored. invisible_playwright does this per seed, so a
|
||||
new seed is a new coherent identity.
|
||||
|
||||
**Is a new seed the same as a new incognito window?** No. An incognito window is the same
|
||||
machine with its storage wiped. A new seed is a different machine, self-consistent across
|
||||
its fields.
|
||||
|
||||
## Sources
|
||||
|
||||
- Firefox's own documentation of what private browsing clears (cookies, storage, history)
|
||||
and, by omission, what it does not.
|
||||
- The specs behind each stateless signal above:
|
||||
[`HTMLCanvasElement.toDataURL()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL)
|
||||
for the canvas read-back, [`WEBGL_debug_renderer_info`](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_debug_renderer_info)
|
||||
for the GPU renderer/vendor string, and [RFC 8446](https://datatracker.ietf.org/doc/html/rfc8446)
|
||||
for where the TLS handshake sits relative to page JavaScript.
|
||||
- The public detection suites named in this set, read for how each computes an identifier
|
||||
from stateless components, each with its own page here.
|
||||
- This project's seed-to-fingerprint pipeline and release gates, which measure the same
|
||||
seed producing the same identity across runs.
|
||||
|
||||
**See also:** [how a stable visitor ID is built](fingerprintjs-visitor-id.md),
|
||||
[what canvas fingerprinting reads and how to change it](canvas-fingerprint-changes-every-run.md),
|
||||
and [the TLS handshake no browsing mode can hide](ja3-ja4-tls-fingerprint.md).
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. Private mode clears what a
|
||||
site stored on you; this project changes what the browser is, which is the axis private
|
||||
mode leaves alone.*
|
||||
@@ -0,0 +1,212 @@
|
||||
---
|
||||
title: "Can you run invisible_playwright serverless?"
|
||||
description: "Why invisible_playwright mostly does not fit serverless: size of patched-Firefox is the blocker. Containers and long-lived workers are the actual home."
|
||||
parent: "Scraping with Playwright"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 84
|
||||
---
|
||||
|
||||
|
||||
# Can you run invisible_playwright serverless?
|
||||
|
||||
Mostly no, and for a structural reason rather than a setting you have not found yet.
|
||||
The blocker is not a config flag. It is that this tool launches a full, real browser,
|
||||
and a serverless function is sized for code that does not.
|
||||
|
||||
This page is the mechanism behind that answer, the one place it does fit, and the
|
||||
container or long-lived worker that is the honest recommendation instead.
|
||||
|
||||
## The short answer, and why it is structural
|
||||
|
||||
invisible_playwright is not a JavaScript shim that patches an existing browser. It ships
|
||||
a patched Firefox, built at the C++ level, and drives it with stock Playwright. On first
|
||||
use it downloads that binary (about 238 MB compressed, roughly 544 MB once unpacked, as
|
||||
listed on the [installation](installation.md) page), verifies a sha256, and caches it.
|
||||
A real launch then needs that unpacked tree on disk plus working memory for the browser
|
||||
process itself.
|
||||
|
||||
A typical function-as-a-service runtime caps three things at once: deployment package
|
||||
size, memory, and wall-clock execution time. All three fight a cold-start browser
|
||||
launch. The download alone can exceed a package limit; the unpacked tree plus a running
|
||||
Firefox can exceed the memory limit; and downloading and starting a browser per
|
||||
invocation can exceed the time limit before your first `goto` returns.
|
||||
|
||||
So the answer is not "add a bigger timeout". The weight of a real browser is the thing
|
||||
that does not fit, and no configuration removes it.
|
||||
|
||||
## What a function actually has to do to launch this
|
||||
|
||||
Walk through a cold invocation of a function that has never run before:
|
||||
|
||||
1. Fetch the engine. If it is not baked into the image, that is a ~238 MB download on
|
||||
the critical path, before any of your code runs.
|
||||
2. Unpack and place it. Roughly 544 MB has to land somewhere writable and readable.
|
||||
3. Verify it. A sha256 pass over the cached engine.
|
||||
4. Launch Firefox and connect Playwright over its protocol.
|
||||
5. Only now open a page and do the work you came for.
|
||||
|
||||
Steps 1 through 4 are pure overhead, and on a serverless platform they can repeat on
|
||||
every cold start because the local disk and memory a function sees do not persist between
|
||||
invocations by design. You are paying browser-startup cost per request instead of once.
|
||||
|
||||
## Where the weight goes: download, unpack, and resident memory
|
||||
|
||||
Three separate limits, three separate ways this fails:
|
||||
|
||||
- **Package or layer size.** Many function platforms cap the deployed artifact well
|
||||
under the unpacked engine size. Baking Firefox into the deployment can blow past the
|
||||
limit outright.
|
||||
- **Ephemeral disk.** The engine has to be unpacked somewhere. A read-only or tiny
|
||||
scratch filesystem cannot hold it.
|
||||
- **Memory.** A real Firefox rendering a real page has a real resident-set size. Add the
|
||||
unpacked binary in page cache and a modest function memory tier is gone.
|
||||
|
||||
The download can be moved off the critical path with a cache directory, and the wrapper
|
||||
supports exactly that: `INVISIBLE_PLAYWRIGHT_CACHE_DIR` points the engine at a path your
|
||||
platform already caches between runs, and `INVPW_BINARY_PATH` skips the download entirely
|
||||
when a compatible binary is already on disk (see [Configuration](configuration.md)). That
|
||||
helps a persistent worker a great deal. It helps a stateless function much less, because
|
||||
the thing a function does not keep is exactly the local disk those variables point at.
|
||||
|
||||
## The recommendation: a container image or a long-lived worker
|
||||
|
||||
The honest home for this tool is somewhere the browser is unpacked once and reused across
|
||||
many jobs:
|
||||
|
||||
- **A container image** with the engine already inside it, run on a service that keeps
|
||||
the container warm. The unpack happens at build time, not per request. This is common
|
||||
enough to have its own walkthrough in
|
||||
[how to use invisible_playwright in Docker](how-to-use-invisible-playwright-in-docker.md),
|
||||
and the fingerprint pitfalls specific to containers are in
|
||||
[running Playwright in Docker undetected](how-to-run-playwright-docker-undetected.md).
|
||||
- **A long-lived worker or VM** that launches the browser once at startup and pulls jobs
|
||||
from a queue, reusing the same process across many pages.
|
||||
|
||||
Both share one property that a stateless function cannot: the ~238 MB download and the
|
||||
~544 MB unpack are paid once, at startup or build, and every job after that reuses a warm
|
||||
browser. That is the difference between browser cost per deployment and browser cost per
|
||||
request.
|
||||
|
||||
Here is a minimal worker that launches once and reuses the browser across a list of jobs.
|
||||
The `browser` returned is a real Playwright
|
||||
[`Browser`](https://playwright.dev/python/docs/api/class-browser), so every method is the
|
||||
stock API:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
JOBS = [
|
||||
"https://example.com/a",
|
||||
"https://example.com/b",
|
||||
"https://example.com/c",
|
||||
]
|
||||
|
||||
# seed=42 makes the identity reproducible, so a failing job replays exactly.
|
||||
with InvisiblePlaywright(seed=42) as browser: # binary unpacked once, reused below
|
||||
for url in JOBS:
|
||||
page = browser.new_page()
|
||||
page.goto(url)
|
||||
print(url, page.title())
|
||||
page.close()
|
||||
```
|
||||
|
||||
In a real worker the `for` loop is a queue consumer, and the `with` block stays open for
|
||||
the life of the process. The launch cost is amortized across every job the worker ever
|
||||
handles, which is the whole point of not being serverless.
|
||||
|
||||
If you must fetch the engine ahead of time in an image build, do it as an explicit build
|
||||
step so the download never lands on a request path:
|
||||
|
||||
```dockerfile
|
||||
FROM python:3.12-slim
|
||||
RUN pip install invisible-playwright
|
||||
# Unpack the engine at BUILD time, not per request.
|
||||
RUN python -m invisible_playwright fetch
|
||||
# ... your worker entrypoint ...
|
||||
```
|
||||
|
||||
## What the stealth actually does for you here, and what it does not
|
||||
|
||||
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 fingerprint, the TLS handshake and the
|
||||
driver layer read as a genuine Firefox rather than as automation. That property is the
|
||||
same whether the browser runs in a function, a container, or a VM - where it runs does not
|
||||
change what it looks like, which matters here because "serverless" and "undetected" get
|
||||
searched together and are different problems.
|
||||
|
||||
What it does not do, on its own and in any environment:
|
||||
|
||||
- **IP reputation.** A genuine-looking browser on a known datacenter address is still on a
|
||||
known datacenter address. You supply a clean exit.
|
||||
- **Per-account quotas and rate limits.** These are counted server-side against your
|
||||
account or key, not read off the browser.
|
||||
- **Behaviour and timing.** Pacing, pointer motion and the rhythm of a session are yours
|
||||
to shape. An automated cadence is visible no matter how real the fingerprint is.
|
||||
|
||||
Serverless makes the last one worse in a specific way: fan-out. A hundred functions firing
|
||||
at once, from a small pool of platform egress addresses, in a burst no human pace explains,
|
||||
is a velocity signal you created by the deployment shape rather than by the browser. A warm
|
||||
worker pulling jobs at a human interval is easier to keep honest. None of that is a claim of
|
||||
evasion; it is the list of things you still have to get right yourself.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Can you run invisible_playwright serverless? Technically sometimes, on a generous
|
||||
container-backed function tier with the engine baked into the image and kept warm.
|
||||
Practically, a plain stateless function that downloads and launches a full Firefox per
|
||||
invocation will be slow and fragile even where it fits, because the browser weight is
|
||||
structural and no setting removes it.
|
||||
|
||||
The tool's job is to make the browser look real, and it does that anywhere it runs. The
|
||||
deployment's job is to give that browser a warm home, a clean exit and a human pace. Put
|
||||
the browser in a container image or a long-lived worker, pay the unpack once, and reuse it.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can I deploy invisible_playwright to a serverless function?** Usually not on a plain
|
||||
stateless function. The patched Firefox is about 238 MB to download and roughly 544 MB
|
||||
unpacked, which fights typical size, memory and time limits. A container image or a warm
|
||||
worker is the real home.
|
||||
|
||||
**Why is the browser so heavy?** Because it is a real, full Firefox patched at the C++
|
||||
level, not a JavaScript patch over an existing browser. That weight is why the fingerprint
|
||||
and TLS read as genuine, and it is also why it does not fit a tiny function.
|
||||
|
||||
**Can I just make the function timeout longer?** No. Size and memory limits fail
|
||||
independently of time, and a per-request download and launch is overhead you pay on every
|
||||
cold start regardless of the timeout.
|
||||
|
||||
**Does running it in a container make it undetectable?** No tool is undetectable. A
|
||||
container is the right place to unpack the browser once and keep it warm, but it does not
|
||||
fix your IP reputation, your account quotas, or your timing. You supply those.
|
||||
|
||||
**How do I avoid downloading Firefox on every invocation?** Bake it into the image at
|
||||
build time, or point `INVPW_BINARY_PATH` at a binary already on disk. On a stateless
|
||||
function neither fully helps, because the local disk does not persist between calls.
|
||||
|
||||
**What is the smallest thing that works?** A single long-lived worker: launch once inside
|
||||
a `with InvisiblePlaywright(...) as browser:` block, then consume a job queue inside that
|
||||
block so the browser is reused for the life of the process.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's [installation](installation.md) and [configuration](configuration.md)
|
||||
pages, for the measured engine download and unpacked sizes and the cache and binary-path
|
||||
environment variables.
|
||||
- The container walkthroughs in this set, linked above, for the build-time unpack pattern.
|
||||
- Playwright's own [`Browser` class reference](https://playwright.dev/python/docs/api/class-browser),
|
||||
for the stock API this wrapper hands back unchanged.
|
||||
- General serverless platform limits on package size, memory and execution time, which are
|
||||
documented per platform and are what the browser weight runs into.
|
||||
|
||||
**See also:** [how to use invisible_playwright in Docker](how-to-use-invisible-playwright-in-docker.md)
|
||||
for the container build, [running Playwright in Docker undetected](how-to-run-playwright-docker-undetected.md)
|
||||
for the fingerprint tells a headless container adds, and
|
||||
[what a datacenter container gives away](playwright-docker-detection.md) for the machine
|
||||
signals no stealth layer touches.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The weight that keeps it out
|
||||
of a small function is the same weight that makes it look real.*
|
||||
@@ -0,0 +1,211 @@
|
||||
---
|
||||
title: "Can You Run Playwright Without Being Detected?"
|
||||
description: "An honest answer for Playwright automation: what removing browser-level tells clears, why it looks like a real browser, and the three signals it does not fix."
|
||||
parent: "Testing and Troubleshooting"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 11
|
||||
---
|
||||
|
||||
|
||||
# Can You Run Playwright Without Being Detected?
|
||||
|
||||
Not in an absolute sense, and any tool that promises otherwise is lying to you.
|
||||
|
||||
What is achievable is narrower and more useful: you can remove the browser-level
|
||||
tells so the fingerprint and the automation flags read like a real person's browser,
|
||||
and that alone clears most JavaScript-based detection. The rest of what gets a session
|
||||
flagged is not a browser problem at all, and no amount of browser work touches it.
|
||||
|
||||
This page draws that line precisely. It shows what "undetected" can honestly mean,
|
||||
what a real-browser fingerprint clears, and the three signal classes that are detected
|
||||
independently of the browser and that you, not the tool, have to supply an answer for.
|
||||
|
||||
## The honest answer: "looks like a real browser", not "invisible"
|
||||
|
||||
The useful reframing is to stop asking "can I be undetected" and start asking "does
|
||||
this look like a real browser driven by a real person". That is a question you can
|
||||
actually answer yes to, and it is the one that most detection is really asking.
|
||||
|
||||
A detector almost never has a single "is this a bot" bit. It has a pile of signals and
|
||||
a score. Some of those signals live in the page, in JavaScript: the fingerprint, the
|
||||
automation flags, whether any built-in has been tampered with. Some live below the
|
||||
page: the network handshake, the exit address. Some live in what the session does over
|
||||
time: pacing, motion, request velocity.
|
||||
|
||||
A tool that drives a genuine, unmodified-looking browser can make the first pile read
|
||||
clean. It cannot make the other two piles read clean, because they are not properties
|
||||
of the browser. Being honest about that split is the whole point of this page, and it
|
||||
is why [passing every public suite still does not mean the session passes](how-to-test-bot-detection.md).
|
||||
|
||||
## What "detected" actually means: three layers of signal
|
||||
|
||||
Before touching code, it helps to name the three layers, because a fix for one does
|
||||
nothing for the others.
|
||||
|
||||
1. **The browser layer.** The fingerprint (GPU, canvas, audio, fonts, screen), the
|
||||
automation flags ([`navigator.webdriver`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/webdriver)
|
||||
and friends), and internal consistency
|
||||
(does the platform you claim agree with the fonts you have). This is in JavaScript's
|
||||
reach, and it is the layer a stealth engine addresses.
|
||||
2. **The network layer.** The TLS handshake, the HTTP/2 settings frame, header order,
|
||||
and the reputation of the exit address. Decided before a line of page script runs,
|
||||
and [invisible to every in-page test](ja3-ja4-tls-fingerprint.md).
|
||||
3. **The behaviour layer.** Pointer motion, typing rhythm, how fast a form is filled,
|
||||
how many requests per minute from one account, and the timing shape of an
|
||||
automated agent.
|
||||
|
||||
invisible_playwright is built to solve layer 1 well, and it drives a real Firefox
|
||||
binary, which means layer 1's network handshake is a genuine Firefox handshake rather
|
||||
than an impersonation. What it deliberately does not do is manufacture a clean IP, a
|
||||
per-account quota, or human pacing. Those are yours to bring.
|
||||
|
||||
## What invisible_playwright removes: the browser layer
|
||||
|
||||
The product is a Firefox patched at the C++ level, driven by stock Playwright, with a
|
||||
fingerprint derived from a seed so it is real-browser-shaped and reproducible. Every
|
||||
session gets a coherent identity (roughly 400 fields that agree with each other)
|
||||
instead of the default automation profile that detectors are trained on.
|
||||
|
||||
Switching from plain Playwright is a two-line change, and the object you get back is a
|
||||
real Playwright `Browser`, so every method works exactly as documented upstream:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# seed=42 makes the identity reproducible; drop it for a fresh one each run
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# navigator.webdriver reads undefined, the fingerprint is internally
|
||||
# consistent, and the TLS handshake is a real Firefox handshake
|
||||
print(page.evaluate("navigator.webdriver")) # -> None
|
||||
```
|
||||
|
||||
Add a proxy and let the browser timezone follow the exit automatically, which is how
|
||||
you keep the browser and the network from telling two different stories:
|
||||
|
||||
```python
|
||||
proxy = {"server": "socks5://gate.example.com:1080", "username": "u", "password": "p"}
|
||||
|
||||
with InvisiblePlaywright(seed=42, proxy=proxy) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com/login")
|
||||
page.fill("#user", "someone")
|
||||
page.click("#submit") # the pointer arcs to the button on a curve
|
||||
```
|
||||
|
||||
The measurable result of layer 1 being clean: open the same fingerprinting page in
|
||||
this browser and in a stock Firefox on the same machine, diff the reports field by
|
||||
field, and the difference collapses to per-session noise (the IP and the random canvas
|
||||
jitter a real browser also has). The JavaScript detectors read it as a genuine Firefox
|
||||
because, at the layer they can see, it is one. That is why it passes most of them. It
|
||||
is also the ceiling of what the browser layer can do.
|
||||
|
||||
## The three signal classes it deliberately does not touch
|
||||
|
||||
This is the part most "undetectable" claims skip. These three are detected
|
||||
independently of the browser, the tool does not address them by design, and a clean
|
||||
fingerprint on top of any one of them still loses.
|
||||
|
||||
- **IP reputation.** A perfect browser on a datacenter range, or on a residential exit
|
||||
a thousand other people are sharing this minute, is still on a flagged address, and
|
||||
that is decided before your script runs. Around 90 percent of cheap proxies are
|
||||
public and already known. The fix is a clean exit, which is your input, not the
|
||||
browser's output. [WebRTC through a proxy](webrtc-leak-proxy.md) is the related
|
||||
browser-visible surface, but the reputation itself is not a browser property.
|
||||
- **Per-account rate limits and quotas.** If one account does in an hour what a person
|
||||
does in a week, no fingerprint hides it, because the signal is the account's own
|
||||
history, not the browser's identity. Spreading work across accounts and staying under
|
||||
human volume is an application-design decision the tool cannot make for you.
|
||||
- **Behaviour and timing.** Uniform keystroke intervals, a form filled in eighty
|
||||
milliseconds, a pointer that teleports, a request cadence with no human jitter, or
|
||||
[the pause shaped exactly like model latency in an agent loop](ai-browser-agents-stealth.md).
|
||||
The engine gives you curved mouse motion for clicks, but the overall rhythm of the
|
||||
session is driven by your code.
|
||||
|
||||
None of these is a gap or a bug. They are outside the browser, so they are outside what
|
||||
a browser-fingerprint tool can honestly claim. Pairing a real-browser fingerprint with
|
||||
a clean exit and human pacing is the actual recipe; the tool is one of those three
|
||||
parts.
|
||||
|
||||
## How to check what is left over
|
||||
|
||||
Because the browser layer is handled, your testing effort should go to the two layers
|
||||
that are not. The method that catches the most:
|
||||
|
||||
- **Prove it is the browser before blaming it.** Open the target by hand from the same
|
||||
machine and network. If the manual visit also gets the wrong page, this is the IP or
|
||||
the account, and no browser change helps. This ordering is the whole point of the
|
||||
[detected-on-one-site checklist](playwright-detected-as-bot.md).
|
||||
- **Compare against a stock browser, do not read a score.** Diff the fingerprint fields
|
||||
against a real Firefox on the same machine. Anything that matches is not your problem
|
||||
whatever the verdict says; anything that differs, other than the address, is a
|
||||
candidate.
|
||||
- **Assert presence, not absence.** A blocked or empty signal is itself a tell and a
|
||||
failure, not a pass. [Why a green verdict can mean the feature is broken](how-to-test-bot-detection.md)
|
||||
is the trap here.
|
||||
- **Watch the score, not just the pass line.** A [trust or confidence score](browser-trust-score-explained.md)
|
||||
tells you more than a binary verdict, and it is where residual behaviour and IP
|
||||
signals show up even when the fingerprint is clean.
|
||||
|
||||
Run any of this at least ten times, through the proxy you actually deploy with, on the
|
||||
machine you actually deploy on.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Can you run Playwright without being detected? You can make it look like a real browser
|
||||
driven by a real person, and that clears most JavaScript-based detection, which is what
|
||||
invisible_playwright is built to do: a patched Firefox, a seed-consistent real-browser
|
||||
fingerprint, and a genuine handshake because the browser is genuine. What it does not
|
||||
do, on purpose, is fix your IP reputation, your per-account quotas, or your behaviour
|
||||
and timing. Those are detected independently, and you supply the answers: a clean exit
|
||||
and human pacing. Treat "undetectable" as a slogan and you will overclaim; treat it as
|
||||
"looks like a real browser, plus the two layers I own", and you will actually pass.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can Playwright be truly undetectable?** No, and any tool that says so is lying. You
|
||||
can remove the browser-level tells so the fingerprint and flags look like a real
|
||||
person's browser, which clears most JavaScript detection. IP, account limits and
|
||||
behaviour are detected separately.
|
||||
|
||||
**Why does invisible_playwright pass most checks then?** Because at the layer those
|
||||
checks can see, it is a real Firefox: real fingerprint, no automation flags, a genuine
|
||||
handshake. Most public detection is a JavaScript check, and that is exactly the layer
|
||||
it addresses.
|
||||
|
||||
**If my fingerprint is clean, why am I still blocked?** Almost always the IP, the
|
||||
account's own request history, or the behaviour. Those are not browser properties, so a
|
||||
clean browser does not touch them.
|
||||
|
||||
**Does it fix my proxy or my IP reputation?** No. It deliberately does not touch the
|
||||
exit address. A perfect browser on a known-bad IP still loses, and you supply the clean
|
||||
exit.
|
||||
|
||||
**Does it make my automation behave like a human?** It gives you curved mouse motion
|
||||
for clicks, but the pacing, typing rhythm and request volume come from your code. That
|
||||
is the behaviour layer, and it is yours.
|
||||
|
||||
**Is a passing sannysoft or CreepJS result enough to be safe?** No. It means the
|
||||
browser layer is internally consistent and does not announce automation. The network
|
||||
and behaviour layers are not in those tests at all.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's release gates, which compare the browser's fingerprint field by field
|
||||
against a stock Firefox on the same machine and treat a suppressed signal as a
|
||||
failure rather than a pass.
|
||||
- The public detection suites named across this documentation set (sannysoft, CreepJS,
|
||||
BotD, FingerprintJS, BrowserLeaks), each read from its own source rather than its
|
||||
rendered verdict.
|
||||
|
||||
**See also:** [how to test whether your browser is detected](how-to-test-bot-detection.md),
|
||||
[the checklist for being detected on one site](playwright-detected-as-bot.md), and
|
||||
[what a browser trust score actually measures](browser-trust-score-explained.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 is built to look like
|
||||
a real browser, which is why it passes most checks and why it will never claim to make
|
||||
you invisible.*
|
||||
@@ -0,0 +1,245 @@
|
||||
---
|
||||
title: "Canvas fingerprint changes every run: use a seed"
|
||||
description: "Canvas, WebGL and audio hashes change every Playwright run because each session draws a fresh identity. Pass a fixed seed to make readbacks byte-identical."
|
||||
parent: "Testing and Troubleshooting"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 6
|
||||
---
|
||||
|
||||
|
||||
# Canvas fingerprint changes every run: use a seed
|
||||
|
||||
A canvas fingerprint that changes on every Playwright run is not a leak or a bug. Without
|
||||
a seed, each session is handed a fresh, self-consistent device, so the canvas, WebGL and
|
||||
audio readbacks are recomputed at every launch. Pass a fixed seed and all three come back
|
||||
byte-identical, run to run. That single argument is the whole fix.
|
||||
|
||||
You open a fingerprinting page twice from the same automation, and the canvas hash
|
||||
is different each time. The WebGL hash moves too, and so does the audio one. Nothing
|
||||
in your code changed between the two runs, and yet the machine looks like a different
|
||||
machine.
|
||||
|
||||
This is one of the most common confusions people hit with a fingerprint-spoofing
|
||||
browser, and it is almost always a misread rather than a bug. A hash that changes on
|
||||
every run is not noise leaking into your readback. It is a fresh identity being drawn
|
||||
for each session, exactly as designed, and the fix is one argument.
|
||||
|
||||
## What "changes every run" actually means
|
||||
|
||||
Canvas, WebGL and audio are the three surfaces that read back a rendered value: you
|
||||
draw something, then read the pixels or the samples out and hash them. On a real
|
||||
machine that hash is stable, because the same GPU, the same font stack and the same
|
||||
audio pipeline draw the same thing every time.
|
||||
|
||||
In this browser, those three readbacks are overwritten before they reach your code.
|
||||
The value you read is a pure function of one number: an internal hardware seed the
|
||||
wrapper derives from the identity seed of the session. Same seed in, same bytes out.
|
||||
Different seed, different bytes.
|
||||
|
||||
So when you launch without passing a seed, each session gets a new one, and the three
|
||||
hashes move together in a self-consistent way. That is not the spoof failing. That is
|
||||
the spoof drawing a new device for you. The trouble is that a device which looks
|
||||
brand new on every visit is its own signal, and it is usually not the signal you want.
|
||||
|
||||
## Why a per-run identity reads as a rotating device
|
||||
|
||||
A stable fingerprint is not automatically a suspicious one. What draws attention is a
|
||||
fingerprint that behaves in a way real hardware cannot.
|
||||
|
||||
Real hardware does not change its canvas hash between two visits. If a site, or a
|
||||
linkability service like [FingerprintJS, which hands you a visitor ID](fingerprintjs-visitor-id.md),
|
||||
sees the same cookie or the same login return with a different canvas hash, a
|
||||
different WebGL renderer and a different audio signature every time, that is a machine
|
||||
that is repainting itself. Very few legitimate users look like that, and a scorer that
|
||||
watches for churn will notice.
|
||||
|
||||
So the per-session default is the right behaviour for one job and the wrong one for
|
||||
another:
|
||||
|
||||
- **You want a fresh identity per session.** Many short, unrelated visits, nothing
|
||||
that should be linked, no returning account. Launch with no seed and take a new
|
||||
device each time. This is the default for a reason.
|
||||
- **You want the same identity every session.** A returning account, a persisted
|
||||
profile, or simply a bug you are trying to reproduce. Here a rotating device is a
|
||||
liability, and you pin it with a seed.
|
||||
|
||||
The mistake is not the rotation. The mistake is leaving it on when the situation calls
|
||||
for a stable machine.
|
||||
|
||||
## Pin the seed and the readbacks stop moving
|
||||
|
||||
Pass a seed explicitly and every field it implies comes back identical: the GPU
|
||||
string, the canvas hash, the WebGL hash, the audio context, the fonts, the screen.
|
||||
The browser object you get back is a real Playwright
|
||||
[`Browser`](https://playwright.dev/python/docs/api/class-browser), so the rest of your
|
||||
code does not change.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# Same seed -> same canvas / WebGL / audio hash, every run.
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# read your fingerprint page here; the readbacks are now stable
|
||||
```
|
||||
|
||||
Run that twice and the three readbacks are byte-identical between the two runs,
|
||||
because they are computed from the same seed both times. Change the number and you get
|
||||
a different, equally self-consistent machine:
|
||||
|
||||
```python
|
||||
# A different but still internally coherent device.
|
||||
with InvisiblePlaywright(seed=1001) as browser:
|
||||
...
|
||||
```
|
||||
|
||||
The async surface is the same, one keyword apart:
|
||||
|
||||
```python
|
||||
from invisible_playwright.async_api import InvisiblePlaywright
|
||||
|
||||
async with InvisiblePlaywright(seed=42) as browser:
|
||||
page = await browser.new_page()
|
||||
await page.goto("https://example.com")
|
||||
```
|
||||
|
||||
If you launched without a seed and now want to keep the identity you happened to get,
|
||||
you do not have to guess it. Every session records the seed it was generated from, so
|
||||
log it once and you can replay that exact machine later:
|
||||
|
||||
```python
|
||||
sf = InvisiblePlaywright() # no seed -> a fresh one is drawn
|
||||
with sf as browser:
|
||||
print("seed =", sf.seed) # write this down to reproduce this device
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
```
|
||||
|
||||
## Prove it: read the same hash twice
|
||||
|
||||
Do not take the determinism on faith. The whole point of the earlier troubleshooting
|
||||
pages is that you [assert the presence of the right value rather than the absence of a
|
||||
wrong one](how-to-test-bot-detection.md), and this is a case where you can measure the
|
||||
right value directly.
|
||||
|
||||
Draw to a canvas, read it back with
|
||||
[`toDataURL()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL),
|
||||
and compare the hash across two launches with the same seed:
|
||||
|
||||
```python
|
||||
import hashlib
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
DRAW = """() => {
|
||||
const c = document.createElement('canvas');
|
||||
c.width = 300; c.height = 150;
|
||||
const ctx = c.getContext('2d');
|
||||
ctx.textBaseline = 'top';
|
||||
ctx.font = '16px sans-serif';
|
||||
ctx.fillStyle = '#069';
|
||||
ctx.fillText('fingerprint probe 12345', 10, 10);
|
||||
return c.toDataURL();
|
||||
}"""
|
||||
|
||||
def canvas_hash(seed):
|
||||
with InvisiblePlaywright(seed=seed) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
data_url = page.evaluate(DRAW)
|
||||
return hashlib.sha256(data_url.encode()).hexdigest()
|
||||
|
||||
a = canvas_hash(42)
|
||||
b = canvas_hash(42)
|
||||
c = canvas_hash(1001)
|
||||
|
||||
print("same seed match:", a == b) # True: byte-identical across runs
|
||||
print("different seed differs:", a != c) # True: a different device
|
||||
```
|
||||
|
||||
The first comparison is the one that matters. `a == b` being `True` is the readback
|
||||
proving it is a stable function of the seed, not per-call randomness. This is exactly
|
||||
what the project's own consistency gate checks on every release: it launches the same
|
||||
seed more than once and requires an identical visitor ID from a linkability library,
|
||||
and it fails the build if the two runs disagree. A green gate there means the same seed
|
||||
is the same machine, run to run.
|
||||
|
||||
Because the readback is a function of the seed and not of the host, the same seed also
|
||||
holds its hash across operating systems, which is
|
||||
[why a Linux container and a Windows laptop can return the same canvas](canvas-webgl-cross-platform-consistency.md).
|
||||
If instead the two hashes for one seed disagree within a single machine, that is the
|
||||
tampering signal to chase, and reading the same value twice in one session is
|
||||
[the cheapest such check there is](canvas-fingerprint-noise.md).
|
||||
|
||||
## Match the seed to the profile
|
||||
|
||||
Pinning the seed and pinning the profile are two halves of one decision. If you keep a
|
||||
[persistent profile so cookies and storage survive between runs](persistent-profiles.md),
|
||||
give it a stable seed as well. A profile that returns with the same cookies but a
|
||||
different canvas hash is telling two stories at once: the account remembers you, the
|
||||
hardware does not, and that contradiction is easier to spot than either half alone.
|
||||
|
||||
The clean pairings are the obvious ones. A fresh throwaway profile takes a fresh seed.
|
||||
A durable identity that comes back tomorrow takes the same profile and the same seed
|
||||
it had yesterday. Keep the two in step and the machine you present stays coherent over
|
||||
its whole life instead of only within a single launch.
|
||||
|
||||
## Conclusion
|
||||
|
||||
A canvas hash that changes on every run is not a leak, it is a new device being drawn
|
||||
per session, and it is the correct default for unrelated one-off visits. When you need
|
||||
a machine that stays the same, whether for a returning account, a persisted profile or
|
||||
a reproducible bug, pass a seed. The three readbacks then become a byte-identical
|
||||
function of that seed, run to run and across operating systems, and the account and the
|
||||
hardware finally tell the same story.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Why does my canvas fingerprint change every run?** Because each session without a
|
||||
seed gets a fresh, self-consistent identity by design. The readback is a function of
|
||||
the session's seed, and a new session means a new seed.
|
||||
|
||||
**How do I make the canvas hash stable?** Pass a fixed seed at launch, for example
|
||||
`InvisiblePlaywright(seed=42)`. The canvas, WebGL and audio readbacks then come back
|
||||
identical on every run.
|
||||
|
||||
**Is a changing fingerprint a bug?** No. It is deliberate rotation. It becomes a
|
||||
problem only when you needed a stable machine, for instance behind a returning account
|
||||
or a persisted profile, and left rotation on.
|
||||
|
||||
**Does the same seed give the same hash on a different machine?** Yes. The readback is
|
||||
computed from the seed, not from the host GPU or fonts, so the same seed holds its
|
||||
hashes across operating systems.
|
||||
|
||||
**How do I reproduce the exact identity from an earlier run?** Read the session's seed
|
||||
after launch and log it. Passing that number back reproduces the same device.
|
||||
|
||||
**Should the seed match my persistent profile?** Yes. A profile that returns with the
|
||||
same cookies but a different fingerprint is a contradiction. Keep one stable seed per
|
||||
durable identity.
|
||||
|
||||
## Sources
|
||||
|
||||
- The project's fingerprint generator, in which the canvas, WebGL and audio readbacks
|
||||
are computed as a pure function of a hardware seed derived from the session seed.
|
||||
- The release consistency gate, which relaunches a fixed seed and requires an
|
||||
identical visitor ID from run to run, and fails the build otherwise.
|
||||
- The [quickstart](quickstart.md) and [configuration](configuration.md) pages in this
|
||||
documentation set for the seed argument and the API it belongs to.
|
||||
- Playwright's own [`Browser` API reference](https://playwright.dev/python/docs/api/class-browser)
|
||||
for what `new_page` returns: the object every example above drives is the standard
|
||||
Playwright API, not a fork of it.
|
||||
- MDN's [`HTMLCanvasElement.toDataURL()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL)
|
||||
reference for the readback method the proof above uses to pull bytes off the canvas.
|
||||
|
||||
**See also:** [how to test whether your browser is detected](how-to-test-bot-detection.md)
|
||||
for the assert-the-right-value method, and
|
||||
[the checklist for being detected on one site](playwright-detected-as-bot.md), whose
|
||||
last step is to pin the identity so a failure is reproducible.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The seed is the same
|
||||
lever whether you are hiding rotation or reproducing a bug: pin it and the machine
|
||||
stops moving.*
|
||||
@@ -0,0 +1,187 @@
|
||||
---
|
||||
title: "Canvas fingerprint noise: why per-call randomising fails"
|
||||
description: "Per-call canvas fingerprint noise fails a detector that reads twice and flags as masking on a second check. What a consistent canvas actually looks like."
|
||||
parent: "Canvas, WebGL, Fonts and Audio"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 1
|
||||
---
|
||||
|
||||
|
||||
# Canvas fingerprint noise: why per-call randomising fails
|
||||
|
||||
Per-call canvas fingerprint noise fails because a detector can read the same canvas
|
||||
twice. Real hardware returns an identical result both times; per-call noise returns two
|
||||
different ones, which flags the browser as tampering rather than merely unusual. The fix
|
||||
is not more noise, it is noise that stays consistent within a session and across sessions
|
||||
of the same identity.
|
||||
|
||||
The standard advice for canvas fingerprinting is to add a little noise to the pixels so
|
||||
your hash is not stable. It is the most widely deployed anti-fingerprinting technique
|
||||
there is, and against a detector that asks once it works.
|
||||
|
||||
Against a detector that asks twice it is the thing that gets you caught. This page is
|
||||
the check that catches it, the second check almost nobody knows about, and what a
|
||||
consistent alternative has to look like.
|
||||
|
||||
## The check that catches per-call noise
|
||||
|
||||
Render the same canvas twice in the same page with
|
||||
[`toDataURL()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL)
|
||||
and compare.
|
||||
|
||||
```js
|
||||
function hash() {
|
||||
const c = document.createElement('canvas');
|
||||
const ctx = c.getContext('2d');
|
||||
ctx.textBaseline = 'top';
|
||||
ctx.font = '14px Arial';
|
||||
ctx.fillText('abcdefghijklmnop', 2, 2);
|
||||
return c.toDataURL();
|
||||
}
|
||||
hash() === hash(); // real hardware: true. Per-call noise: false.
|
||||
```
|
||||
|
||||
On real hardware the answer is always identical, because drawing the same shapes with
|
||||
the same rasteriser produces the same pixels. There is no source of variation.
|
||||
|
||||
A tool that adds `Math.random()` to the pixel values on every read produces two
|
||||
different answers, and now the page knows something far more specific than your canvas
|
||||
hash: it knows your canvas is being tampered with. An unusual hash makes you rare. A
|
||||
hash that changes between two reads one millisecond apart makes you impossible.
|
||||
|
||||
This is four lines of JavaScript. Assume it is running.
|
||||
|
||||
## The second check, which is subtler
|
||||
|
||||
A detector draws a **small canvas filled with a handful of solid reference colours**,
|
||||
then reads it back with
|
||||
[`getImageData()`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/getImageData)
|
||||
and checks those exact colour values came back unchanged. Not a hash, not a comparison
|
||||
between two reads: an assertion that a flat red rectangle is still exactly that red.
|
||||
|
||||
The first check above is well known enough that better tools already seed their noise,
|
||||
so two reads agree. This second shape is subtler, and it is worth understanding because
|
||||
it caught us.
|
||||
|
||||
Real rendering does not change a solid fill. Any per-pixel noise does, even seeded
|
||||
noise, even tiny noise. And a tool that fails this is not scored as "unusual", it is
|
||||
scored as **masking detected**, which is a different and worse category.
|
||||
|
||||
The fix is a guard: before altering anything, count the distinct colours in the buffer.
|
||||
If there are only a few, the render is a reference probe rather than a fingerprint, and
|
||||
you leave it alone. Small buffers get the same treatment, for the same reason.
|
||||
|
||||
We shipped without that guard and learned it from a detector telling us so. The general
|
||||
form is the same one that appears in audio and everywhere else:
|
||||
|
||||
> A detector does not have to recognise your noise. It only has to ask a question whose
|
||||
> correct answer is already known, and check whether it still gets that answer.
|
||||
|
||||
## Additive noise versus substitution, and the cost nobody states
|
||||
|
||||
There are two ways to make a canvas read return something other than the truth.
|
||||
|
||||
| Approach | What it does | Same hash across machines? | Main cost |
|
||||
|---|---|---|---|
|
||||
| Additive noise | Perturbs each pixel slightly; the image still looks the same, the hash changes | No. The operating system's text stack still shows through the perturbation | The underlying platform signature leaks |
|
||||
| Substitution | Replaces pixel values wholesale with seed-derived values | Yes. The hash is a pure function of the seed | Real canvas work (cropping, QR decoding, a video frame) gets the substituted values too |
|
||||
|
||||
**Additive.** Perturb each pixel slightly. The image still looks like the image, the
|
||||
hash changes. This is what extensions do.
|
||||
|
||||
**Substitution.** Replace the pixel values wholesale with values derived from a seed.
|
||||
The hash is then a pure function of the seed and nothing else, which means it is
|
||||
identical on every machine running that identity, including a Linux server pretending
|
||||
to be Windows.
|
||||
|
||||
Substitution is stronger for consistency, because with additive noise the underlying
|
||||
rendering still carries the signature of
|
||||
[the operating system's text stack](bundled-fonts-cross-platform.md) under the
|
||||
perturbation. Two machines with different font backends produce different base images,
|
||||
and a small perturbation on top does not hide that -
|
||||
[this is the reasoning that gets the same seed to the same byte-identical hash on
|
||||
Windows and Linux](canvas-webgl-cross-platform-consistency.md), not just a similar one.
|
||||
|
||||
Now the cost, which is real and which most write-ups omit. A substitution applied at
|
||||
readback does not know why the page is reading the canvas. It cannot distinguish a
|
||||
fingerprinting probe from an application that is cropping a photo, decoding a QR code,
|
||||
capturing a video frame or applying a filter. Those all read pixels through the same
|
||||
API, and they all get the substituted values.
|
||||
|
||||
So if your automation does real canvas work, you have to know this is happening. It is
|
||||
a trade, not a free win, and anyone presenting per-pixel protection as costless has not
|
||||
built one.
|
||||
|
||||
## What a defensible canvas looks like
|
||||
|
||||
Working backwards from the checks above:
|
||||
|
||||
- **Stable within a session.** Two reads agree. Non-negotiable and trivially checked.
|
||||
- **Stable across sessions of the same identity.** A hash that changes every launch
|
||||
describes a machine that changed its GPU overnight.
|
||||
- **Different between identities.** Otherwise every user of the tool shares one hash,
|
||||
which is its own cohort.
|
||||
- **Solid fills come back solid.** Reference probes are untouched.
|
||||
- **Consistent with the rest of the claim.** A canvas that says one platform under a
|
||||
user agent that says another is caught by comparison, not by rarity.
|
||||
|
||||
That list is short and every item is a thing a page can verify in a few lines. That is
|
||||
the level the checks are actually at.
|
||||
|
||||
The same canvas element carries a second surface that doesn't involve reading a single
|
||||
pixel: [`measureText()` and its ten-plus numeric fields](measuretext-textmetrics-fingerprinting.md),
|
||||
which fail the same way for the same reason if the noise added to them accumulates
|
||||
instead of staying bounded.
|
||||
|
||||
## Checking your own
|
||||
|
||||
```js
|
||||
const a = hash(), b = hash();
|
||||
console.log('stable within session:', a === b);
|
||||
|
||||
// solid-fill probe
|
||||
const c = document.createElement('canvas'); c.width = 70; c.height = 5;
|
||||
const ctx = c.getContext('2d');
|
||||
ctx.fillStyle = '#ff0000'; ctx.fillRect(0, 0, 10, 5);
|
||||
const px = ctx.getImageData(0, 0, 1, 1).data;
|
||||
console.log('solid red survived:', px[0] === 255 && px[1] === 0 && px[2] === 0);
|
||||
```
|
||||
|
||||
Then relaunch with the same identity and confirm the first hash is the same value. Two
|
||||
launches, one identity, one hash.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does adding noise to canvas prevent fingerprinting?** It prevents a stable identifier
|
||||
and it announces that something is modifying the canvas. Which of those matters depends
|
||||
on whether anything is checking.
|
||||
|
||||
**Is Canvas Blocker style protection detectable?** The per-call randomisation kind is,
|
||||
in four lines. That is a statement about the technique, not about any particular tool.
|
||||
|
||||
**Why does my canvas hash change on every page load?** Because something is randomising
|
||||
per call or per session. No real machine does that; there is
|
||||
[a dedicated page on why a canvas fingerprint changes every run](canvas-fingerprint-changes-every-run.md).
|
||||
|
||||
**Should the hash be unique to me?** It should be consistent for one identity and
|
||||
different between identities. Unique-per-request is not privacy, it is a signature.
|
||||
|
||||
**Does `privacy.resistFingerprinting` solve this?** It alters canvas readings, and it
|
||||
also makes you identifiable as someone running that mode. There is
|
||||
[a longer page on that trade](resist-fingerprinting.md).
|
||||
|
||||
**Will noise break my application?** If you read pixels for anything real, yes,
|
||||
potentially. Protection applied at readback cannot tell your QR decoder from a
|
||||
fingerprinting probe.
|
||||
|
||||
**See also:** [AudioContext fingerprinting](audiocontext-fingerprinting.md), where the
|
||||
same per-call mistake has the same consequence and where our own noise turned out to be
|
||||
the thing being detected, [what sannysoft checks](sannysoft-explained.md), whose
|
||||
canvas-in-iframe rows are a consistency test rather than a fingerprint test, and
|
||||
[how BrowserLeaks reports the canvas and WebGL hash](browserleaks-canvas-webgl-hash.md).
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. The solid-fill guard exists because we shipped
|
||||
without it.*
|
||||
@@ -0,0 +1,149 @@
|
||||
---
|
||||
title: "Canvas and WebGL fingerprints, identical across OSes"
|
||||
description: "Canvas and WebGL fingerprints identical across Windows and Linux: intercept readback, not the render, so one seed produces a byte-identical hash on every OS."
|
||||
parent: "Canvas, WebGL, Fonts and Audio"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 9
|
||||
---
|
||||
|
||||
|
||||
# Canvas and WebGL fingerprints, identical across OSes
|
||||
|
||||
A GPU-backed render surface can't be read from or written to directly and safely, so
|
||||
the fix intercepts the one place JavaScript can actually see the result instead - the
|
||||
same seed then produces a byte-identical canvas and WebGL hash on Windows and Linux.
|
||||
[Why headless browsers render different fonts](headless-fonts-differ.md) and
|
||||
[how to make Linux and macOS report real Windows fonts](bundled-fonts-cross-platform.md)
|
||||
cover the same shape of problem and fix, for text instead of pixels.
|
||||
|
||||
## The surface you can't safely touch is not the surface JavaScript reads
|
||||
|
||||
A GPU-backed render target is not something you can map and rewrite freely - reading
|
||||
one directly with the ordinary in-process API can crash rather than return data,
|
||||
depending on the backend. That rules out the obvious approach of patching the render
|
||||
itself.
|
||||
|
||||
It turns out you don't need to. Content never touches the render surface directly. It
|
||||
only ever gets pixels back through a small, enumerable set of export calls:
|
||||
[`toDataURL`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL)
|
||||
and [`toBlob`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob),
|
||||
[`getImageData`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/getImageData),
|
||||
[`readPixels`](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/readPixels),
|
||||
a captured [`OffscreenCanvas`](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas),
|
||||
and the chain that runs through
|
||||
[`createImageBitmap`](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap).
|
||||
Every one of those is a **readback** call, and readback is a single choke point you
|
||||
can intercept safely, even when the surface behind it cannot be touched directly.
|
||||
|
||||
So the fix is the same shape as the font one: block the host's real value at the one
|
||||
place content can actually observe it, rather than trying to prevent the value from
|
||||
existing in the first place.
|
||||
|
||||
## What gets overwritten, and what doesn't
|
||||
|
||||
At each readback call, the real pixel buffer is rewritten with output derived from
|
||||
the session's seed and the pixel's own position, before JavaScript ever sees it - for
|
||||
both the canvas-2D path and the WebGL path, since they are separate APIs with
|
||||
separate export calls that both needed the same treatment.
|
||||
|
||||
The one thing this has to get right is not breaking the pages that read canvas
|
||||
content for a legitimate reason. A reference probe - a handful of flat colours used
|
||||
to check whether canvas output has been tampered with at all - looks nothing like a
|
||||
real rendered scene: very few distinct colours across the whole buffer. Below a
|
||||
small distinct-colour threshold, the output is left untouched; above it, the
|
||||
substitution applies in full. A solid red rectangle comes back solid red. A real
|
||||
rendered scene, which is high-entropy by construction, gets the full treatment. This
|
||||
is what keeps a masking-detection probe from immediately noticing that something
|
||||
intercepts every readback.
|
||||
|
||||
## Why substitution instead of noise, here specifically
|
||||
|
||||
[Adding noise per call is the common approach, and it fails a very cheap check](canvas-fingerprint-noise.md):
|
||||
read the canvas twice in the same page and compare. What makes substitution the
|
||||
right choice for cross-platform consistency specifically is a different property:
|
||||
substituted output is a pure function of the seed and the pixel position, with zero
|
||||
input from the actual rendering pipeline underneath. Additive noise on top of a real
|
||||
render still carries the render's own signature - two machines with different font or
|
||||
GPU backends produce different base images, and a small perturbation on top doesn't
|
||||
hide that. Substitution removes the underlying image from the equation entirely, so
|
||||
there's nothing left for the host to leak into the result.
|
||||
|
||||
There's a second, sharper way per-pixel noise fails, found on this exact surface: a
|
||||
detector doesn't need two reads to catch it, because the noise itself has a
|
||||
statistical shape that a single read can flag. A small random offset applied to a
|
||||
fraction of pixels reads as unnaturally high-frequency variation - a masking-detection
|
||||
check built to look for exactly that pattern flagged it directly, on the WebGL
|
||||
readback specifically, with the rest of the fingerprint surface clean. Replacing it
|
||||
with a per-channel remap - which looks like an ordinary colour-profile difference
|
||||
between GPUs rather than injected noise - took a measured spike count from roughly
|
||||
320 down to near zero on the same probe. Substitution inherits that property too,
|
||||
for the same reason: nothing about it resembles noise added on top of a real signal.
|
||||
|
||||
| Approach | How it hides the host | Where it fails |
|
||||
|---|---|---|
|
||||
| Additive per-call noise | Perturbs a fraction of pixels on top of the real render | Two reads in one page differ; the real render's font/GPU signature still shows through; the noise has a high-frequency shape a single read can flag |
|
||||
| Full substitution | Replaces pixels with a pure function of the seed and the pixel position, with zero input from the render underneath | Must leave low-entropy buffers untouched so it does not break legitimate canvas reads |
|
||||
|
||||
## The proof: byte-identical hashes, not just "looks similar"
|
||||
|
||||
Rendered the same seed's canvas (text plus a gradient) and WebGL scene (a
|
||||
high-entropy draw) on Windows and on Linux, hashed both in-page. The hashes matched
|
||||
byte for byte on both platforms. Run against a commercial fingerprint scanner across
|
||||
multiple seeds, zero failures on either OS.
|
||||
|
||||
That is a stronger claim than "produces a plausible fingerprint." It's the same
|
||||
identity, provably, regardless of which OS is actually running underneath - which is
|
||||
what makes a seed a real, portable identity instead of a value that happens to look
|
||||
right on the machine it was tested on.
|
||||
|
||||
## What this generalises to, and where the edges still are
|
||||
|
||||
The underlying idea applies to any surface where content can only see a value
|
||||
through a small number of export or readback calls: intercept there, and it doesn't
|
||||
matter what happens upstream. It is also, necessarily, an enumeration problem - the
|
||||
fix is only as complete as the list of export paths it covers, and browsers keep
|
||||
adding new ones (newer capture and streaming APIs, newer GPU-facing interfaces).
|
||||
Treat any such list as something that needs revisiting as the platform grows, not as
|
||||
a fact that becomes true once and stays true.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can canvas and WebGL fingerprints be made identical across operating systems?**
|
||||
Yes, if the interception happens at every point content can read the result rather
|
||||
than at the render itself, which is the part that can't be touched directly on a
|
||||
GPU-backed surface.
|
||||
|
||||
**Why substitution instead of adding noise to the real render?** Noise on top of a
|
||||
real image still carries the host's own rendering signature underneath it.
|
||||
Substitution replaces the value entirely, so nothing about the actual host reaches
|
||||
the output.
|
||||
|
||||
**Won't this break real uses of canvas, like image editing or QR decoding?** A
|
||||
masking-safe design leaves near-uniform, low-entropy output untouched and only
|
||||
substitutes high-entropy renders, which is what a fingerprinting probe looks like
|
||||
and an image editor's output usually doesn't - though the same caveat as
|
||||
[canvas fingerprint noise](canvas-fingerprint-noise.md) applies if your own use case
|
||||
happens to fall on the wrong side of that line.
|
||||
|
||||
**Is this the same fix as the font work?** The same shape - intercept at the point
|
||||
content can observe, not at the source - applied to a different surface.
|
||||
|
||||
**See also:** [canvas fingerprint noise](canvas-fingerprint-noise.md), for why
|
||||
per-call randomisation specifically fails; [how to make Linux and macOS report real
|
||||
Windows fonts](bundled-fonts-cross-platform.md), for the same architecture applied to
|
||||
fonts; [WebGL renderer strings](webgl-renderer-strings.md), for the adjacent
|
||||
surface of what the GPU claims to be rather than what it draws; and
|
||||
[how the BrowserLeaks canvas and WebGL hash is computed](browserleaks-canvas-webgl-hash.md),
|
||||
for what that hash actually measures.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's own render-readback interception work and its cross-platform
|
||||
validation (same-seed byte-identical hashes on Windows and Linux, multi-seed
|
||||
results against a commercial fingerprint scanner).
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level, on making a seed mean the same machine regardless
|
||||
of what it's actually running on.*
|
||||
@@ -0,0 +1,159 @@
|
||||
---
|
||||
title: "The ChromeDriver `cdc_` variable, and why renaming it fails"
|
||||
description: "The cdc_ variable ChromeDriver leaves on the page is a one-line Selenium test. Renaming it in the binary raises the bar but does not remove the tell."
|
||||
parent: "The Automation Layer"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 2
|
||||
---
|
||||
|
||||
|
||||
# The ChromeDriver `cdc_` variable, and why renaming it fails
|
||||
|
||||
**The `cdc_` variable is a property that ChromeDriver injects into every page it
|
||||
controls, and its presence is a one-line test for Selenium automation. Renaming the
|
||||
string in the binary hides it from a check that greps for the exact prefix, but not
|
||||
from one that looks for the pattern, because the properties are still on the page.**
|
||||
|
||||
If you have automated Chrome with Selenium and been detected, you have probably met
|
||||
this variable. This is what it is, why renaming it in the binary does not remove it,
|
||||
and what that generalises to.
|
||||
|
||||
The check looks like this:
|
||||
|
||||
```js
|
||||
Object.getOwnPropertyNames(document).find(k => k.startsWith('cdc_'))
|
||||
```
|
||||
|
||||
or the same thing scanning `window`. It is a two-line test, it is in every
|
||||
bot-detection script, and understanding why it works explains a lot about how this
|
||||
whole category of tell comes to exist.
|
||||
|
||||
## What the variable is
|
||||
|
||||
ChromeDriver, the binary Selenium talks to, needs to run its own JavaScript inside
|
||||
the page: that is how it finds elements, reads text, and executes your `execute_script`
|
||||
calls. To do that it keeps some state on the page's own objects, under names derived
|
||||
from a fixed string compiled into the binary. Historically they look like this:
|
||||
|
||||
```
|
||||
cdc_adoQpoasnfa76pfcZLmcfl_Array
|
||||
cdc_adoQpoasnfa76pfcZLmcfl_Promise
|
||||
cdc_adoQpoasnfa76pfcZLmcfl_Symbol
|
||||
```
|
||||
|
||||
The prefix is stable across installations because it is a literal in the executable,
|
||||
which is exactly what makes it a reliable signal. A page that finds one of those
|
||||
property names is not guessing: nothing else puts them there.
|
||||
|
||||
Note what this is not. It is not a flag someone forgot to remove, and it is not the
|
||||
same class of thing as `navigator.webdriver`. It is working state that the tool needs
|
||||
in order to function.
|
||||
|
||||
## Why the usual fix is a rename
|
||||
|
||||
The well-known remedy, and what [`undetected-chromedriver`](vs-undetected-chromedriver.md)
|
||||
does, is to patch the binary and replace that literal with a different random-looking
|
||||
string of the same length. Same length matters: it is an in-place patch of a compiled file, so the
|
||||
replacement has to fit.
|
||||
|
||||
That works against the check at the top of this page, because the check greps for
|
||||
`cdc_`. It does not work against a slightly better one.
|
||||
|
||||
The variables are still there, still on `document`, still a set of three related
|
||||
names appearing together, still matching a shape no page author would produce. A
|
||||
detector that looks for *the pattern* instead of the prefix, three own properties on
|
||||
`document` with a common random-looking stem and typed suffixes, finds them again.
|
||||
And because the patch has to preserve length, the shape of the replacement is
|
||||
constrained in ways that make it recognisable.
|
||||
|
||||
So: renaming raises the bar, it does not remove the surface. That distinction is the
|
||||
whole point of this page, and it applies far beyond this one variable.
|
||||
|
||||
## The general shape of the problem
|
||||
|
||||
Any automation tool that needs to run code in the page needs somewhere to keep state.
|
||||
The options are:
|
||||
|
||||
1. **Put it on page objects under a known name.** Easy, and detectable by name.
|
||||
2. **Put it on page objects under a randomised name.** Harder, and detectable by
|
||||
shape.
|
||||
3. **Do not put it on page objects at all.** Keep the state on the driver side of the
|
||||
boundary, or in an execution context the page cannot enumerate.
|
||||
|
||||
Option three is the only one that removes the surface instead of obscuring it, and
|
||||
it is a design decision made long before anyone runs a detection test. It is also why
|
||||
["which stealth plugin should I use"](playwright-stealth-levels.md) is often the wrong
|
||||
question: no plugin can move state out of the page after the fact.
|
||||
|
||||
## Where Firefox differs, and where it does not
|
||||
|
||||
Firefox's automation does not use ChromeDriver, so `cdc_` does not exist there. That
|
||||
is a fact about the protocol, not a virtue: Firefox's automation surfaces are
|
||||
simply different ones.
|
||||
|
||||
What Firefox does still do by default is set `navigator.webdriver` to `true` when a
|
||||
session is under automation control, because the
|
||||
[WebDriver specification](https://www.w3.org/TR/webdriver2/) requires it: the
|
||||
property reflects a "webdriver-active" flag the spec sets whenever the user agent
|
||||
is under remote control. So a stock Playwright Firefox is trivially detectable too,
|
||||
just by a different two-line check, and anyone claiming Firefox is inherently
|
||||
undetected is selling something.
|
||||
|
||||
The useful difference is architectural, not moral. Firefox's automation
|
||||
protocol runs in privileged code with its own execution contexts, so the state a
|
||||
driver needs does not have to live where the page can enumerate it. Whether a given
|
||||
tool takes advantage of that is a separate question from whether the engine allows
|
||||
it.
|
||||
|
||||
## What to actually check
|
||||
|
||||
If you are debugging a detection problem on a Chromium-based stack, check in this
|
||||
order:
|
||||
|
||||
1. `Object.getOwnPropertyNames(document)` and the same for `window`, looking for
|
||||
groups of related unfamiliar names, not one specific prefix.
|
||||
2. `navigator.webdriver`, remembering that `false` is not the same answer as
|
||||
`undefined`, and a clean browser gives the latter.
|
||||
3. Whether anything you loaded has patched a built-in: print
|
||||
`Function.prototype.toString.call(navigator.__lookupGetter__('webdriver'))` and
|
||||
see whether it says `[native code]`.
|
||||
4. The non-automation signals, which is usually where the real problem is by the time
|
||||
you have got this far: the GPU string, the font set, the timezone against the IP.
|
||||
|
||||
Number four catches more sessions than one to three combined, and it is the one
|
||||
nobody checks first.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What is the `cdc_` variable?** A property ChromeDriver injects into the document,
|
||||
whose name starts with `cdc_` followed by a random-looking string. Its presence is a
|
||||
one-line check for Selenium automation.
|
||||
|
||||
**Does renaming it in the binary work?** Against a check that greps for the exact
|
||||
prefix, yes. Against a check looking for the *pattern*, three unexpected own properties
|
||||
on `document`, no, because renaming does not remove them.
|
||||
|
||||
**How do I find it?** Enumerate `document`'s own properties and look for entries no
|
||||
normal document has.
|
||||
|
||||
**Does Playwright have an equivalent?** Not this one, because it does not use
|
||||
ChromeDriver, and not a comparable global either - checked directly, enumerating
|
||||
every own property on `window` in a live Playwright-driven Chromium session finds
|
||||
nothing resembling `window.__playwright` or any similarly-named global. Some
|
||||
online guides describe one anyway; it is worth checking a claim like that yourself
|
||||
before repeating it, the same way this page checks `cdc_` by opening a real
|
||||
session rather than trusting a description of one. That does not mean Playwright
|
||||
sessions have no artefacts at all - [each automation stack has its own, and each
|
||||
one is a function whose source can be printed](tostring-native-code-detection.md) -
|
||||
only that this specific one does not appear to be real.
|
||||
|
||||
**What is the real fix?** Do not add the properties at all, which means the automation
|
||||
layer has to be built differently rather than patched afterwards.
|
||||
|
||||
**See also:** [why setting `navigator.webdriver` to false is worse than leaving it alone](navigator-webdriver-explained.md), [the three levels a stealth tool can work at](playwright-stealth-levels.md), since where the state lives is a level-two decision, and [selenium-stealth's actual maintenance status](selenium-stealth-unmaintained.md), for the popular package that patches properties next to this one.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. Firefox-based, so `cdc_` was never our problem,
|
||||
but the general shape of it is everybody's.*
|
||||
@@ -0,0 +1,259 @@
|
||||
---
|
||||
title: "Chromium is not Chrome, and detectors know the difference"
|
||||
description: "Chrome for Testing, Playwright's default since 1.57, plays H.264 but still fails the Widevine DRM check - a compiled-in gap that no JavaScript patch can close."
|
||||
parent: "Comparisons"
|
||||
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.
|
||||
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
|
||||
a compiled-in capability, not a value a page reads off a string.
|
||||
|
||||
Every stealth guide for Chromium-based automation quietly assumes "Chromium" and "Chrome"
|
||||
mean the same thing, or that the gap between them is fixed and permanent. Neither is true.
|
||||
The gap is real, it moved in 2026, and one part of it is still a **compiled-in capability**
|
||||
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
|
||||
better, and why Firefox has no equivalent gap.
|
||||
|
||||
## What Playwright ships today, checked directly rather than 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.
|
||||
|
||||
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
|
||||
Playwright session with no `channel` argument and no stealth layer applied: H.264 and AAC
|
||||
both play. The codec half of this page's original argument no longer holds for a current,
|
||||
default Playwright launch - it holds for whatever version you're actually pinned to, and it
|
||||
is worth checking your own rather than assuming either answer.
|
||||
|
||||
## The Widevine gap that survives the switch
|
||||
|
||||
Checked in the same session: Widevine still rejects.
|
||||
|
||||
```js
|
||||
await navigator.requestMediaKeySystemAccess('com.widevine.alpha', [{
|
||||
initDataTypes: ['cenc'],
|
||||
videoCapabilities: [{ contentType: 'video/mp4; codecs="avc1.42E01E"' }],
|
||||
}]);
|
||||
// current default Playwright (Chrome for Testing): rejects, NotSupportedError
|
||||
```
|
||||
|
||||
Chrome for Testing carries Chrome's codecs but not its Widevine CDM (Content Decryption
|
||||
Module) - DRM distribution has its own licensing path separate from the codec libraries,
|
||||
and Google's dedicated testing distribution does not carry it. That gap is the one worth
|
||||
building an argument around, because unlike the codec question, it is not a moving target
|
||||
tied to which Playwright version happens to be pinned - it is a deliberate omission from a
|
||||
distribution built for automation in the first place.
|
||||
|
||||
Here is the part that matters for anyone building or buying a stealth tool:
|
||||
|
||||
> **This is not a value. It is a capability.** A missing DRM module is missing machine
|
||||
> code. You can lie about `navigator.userAgent` because it is a string; you cannot lie
|
||||
> about whether the build can actually negotiate a Widevine session, because the page can
|
||||
> ask it to and read the real answer.
|
||||
|
||||
This is the same distinction as
|
||||
[a renderer string against the pixels a rasteriser actually draws](renderer-string-vs-render.md),
|
||||
and it is the expensive class of problem for the same reason.
|
||||
|
||||
[The codec page](codec-fingerprinting.md) covers the wider surface; this is the sharpest
|
||||
surviving instance of it, even after the part that used to accompany it closed.
|
||||
|
||||
## Almost nobody browses with a Widevine-less build
|
||||
|
||||
Almost nobody outside development, CI and automation runs a browser without Widevine.
|
||||
|
||||
Real people use Chrome, Edge, Brave, Opera, Vivaldi, and every one of those ships Widevine,
|
||||
because a browser that cannot play protected video from a mainstream streaming service is
|
||||
not a browser anybody keeps as their daily one. A build that answers "no" to the Widevine
|
||||
check is a developer artefact, a CI image, or automation - not a real visitor's machine.
|
||||
|
||||
So the population of "sessions reporting no Widevine support" is made up overwhelmingly of
|
||||
developers and automation. That is not a fingerprint value being rare. That is **a cohort
|
||||
whose membership is almost entirely the thing being looked for.**
|
||||
|
||||
And unlike most signals in this subject, it needs no model and no scoring. It is a
|
||||
capability check with a yes or no answer.
|
||||
|
||||
## Spoofing the user agent makes this worse
|
||||
|
||||
Setting the user agent to claim Chrome does not close the Widevine gap - it turns a merely
|
||||
missing capability into a contradiction the page can check directly.
|
||||
|
||||
A stealth tool sets the user agent to claim Google Chrome. On a current, default Playwright
|
||||
launch the codec set now agrees with that claim - that particular contradiction closed along
|
||||
with the codec gap. The Widevine one didn't. Now the page has:
|
||||
|
||||
- a user agent saying **Chrome**,
|
||||
- a Widevine check saying **no such CDM**,
|
||||
- and in Chromium, `Sec-CH-UA` brands that
|
||||
[have their own copy of the same claim](client-hints-sec-fetch.md), agreeing with the
|
||||
user agent while the DRM check contradicts both.
|
||||
|
||||
Before the spoof, the browser was merely missing a capability real visitors have. After it,
|
||||
the browser is lying about being able to do something it provably cannot, and the lie is
|
||||
checkable in one line rather than inferred from a rare value. That is
|
||||
[the same mistake the user agent page is about](playwright-user-agent.md), in its most
|
||||
concrete remaining form.
|
||||
|
||||
## The `channel` escape, and what it costs
|
||||
|
||||
Playwright does let you opt into a branded browser:
|
||||
|
||||
```python
|
||||
p.chromium.launch(channel="chrome")
|
||||
```
|
||||
|
||||
That launches the real Chrome installed on the machine, with the real Widevine. It
|
||||
genuinely closes the remaining gap - the one thing a current default launch, running Chrome
|
||||
for Testing, still doesn't give you.
|
||||
|
||||
The costs are real and worth being explicit about:
|
||||
|
||||
- **You do not ship it.** It uses whatever Chrome is installed, at whatever version, so
|
||||
your fleet is only as consistent as your machine images.
|
||||
- **It updates underneath you**, on Google's schedule rather than yours.
|
||||
- **It is not available everywhere**, particularly in slim containers, which is exactly
|
||||
where automation runs.
|
||||
- **It is still Chrome with automation attached**, so every other layer of this subject
|
||||
applies unchanged.
|
||||
|
||||
It is the right call when you can take those costs. It is not a solved problem, it is a
|
||||
traded one.
|
||||
|
||||
## Firefox has no equivalent gap
|
||||
|
||||
Firefox has no capability gap like Widevine to exploit, because it has no proprietary-versus-open
|
||||
split of this kind in the first place - which is the structural reason this belongs in a
|
||||
comparison rather than a list of tips.
|
||||
|
||||
There is no "Firefox" and
|
||||
"Firefox-without-the-codecs" pair where one is what people run and the other is what
|
||||
automation runs. The build Mozilla ships and a build compiled from the same source with
|
||||
the release configuration have the same feature set.
|
||||
|
||||
So a patched Firefox is **Firefox**, in the ways a capability check can test. A patched
|
||||
Chromium is **Chromium claiming to be Chrome**, and the claim is contradicted by things
|
||||
that are not strings.
|
||||
|
||||
That is not an argument that Firefox wins overall.
|
||||
[The argument against Firefox is its share of real traffic](firefox-vs-chromium-antidetect.md),
|
||||
and it is serious. But on this specific axis the two engines are not in comparable
|
||||
positions, and most comparisons never mention it.
|
||||
|
||||
## Codec and DRM support, by build
|
||||
|
||||
| Build | H.264 / AAC playback | Widevine DRM | What it actually is |
|
||||
|---|---|---|---|
|
||||
| Bare open-source Chromium (pre-1.57 default, or an explicit unbranded build) | No | No | Missing the proprietary codec and DRM additions Google adds on top of open-source Chromium |
|
||||
| Chrome for Testing (Playwright's default since 1.57, no `channel` set) | Yes | No | Google's own automation distribution - Chrome's codecs, not Chrome's DRM licensing |
|
||||
| Real Chrome, launched via `channel="chrome"` | Yes | Yes | The actual installed browser, with the update and install costs described above |
|
||||
| Firefox, patched at the C++ level | N/A - no split | N/A - no split | One build, not two: there is no stripped variant that only automation runs |
|
||||
|
||||
## How to check your own build for the gap
|
||||
|
||||
Run this in whatever browser your automation actually launches:
|
||||
|
||||
```js
|
||||
const v = document.createElement('video');
|
||||
console.table({
|
||||
h264: v.canPlayType('video/mp4; codecs="avc1.42E01E"') || 'no',
|
||||
aac: v.canPlayType('audio/mp4; codecs="mp4a.40.2"') || 'no',
|
||||
mp3: v.canPlayType('audio/mpeg') || 'no',
|
||||
ua: navigator.userAgent,
|
||||
});
|
||||
|
||||
navigator.requestMediaKeySystemAccess('com.widevine.alpha', [{
|
||||
initDataTypes: ['cenc'],
|
||||
videoCapabilities: [{ contentType: 'video/mp4; codecs="avc1.42E01E"' }],
|
||||
}]).then(() => console.log('widevine: yes'), () => console.log('widevine: no'));
|
||||
```
|
||||
|
||||
Then compare against the browser you are claiming to be, on the same machine.
|
||||
|
||||
- If the user agent says Chrome and H.264 comes back empty, your build predates the
|
||||
Chrome for Testing default, or you launched with an explicit bare-Chromium build, and you
|
||||
have the codec-level version of the contradiction described above.
|
||||
- If Widevine rejects while the user agent says Chrome, that is the gap that survives even
|
||||
on a current, default launch.
|
||||
- If both are consistent with the claim, this particular problem is not yours - but check
|
||||
which one actually changed before assuming why.
|
||||
|
||||
## Conclusion
|
||||
|
||||
The most repeated advice in Chromium-based stealth is to make the browser look like
|
||||
Chrome. As of Playwright 1.57's switch to Chrome for Testing as the default, the browser
|
||||
got measurably closer to actually being Chrome on the codec axis - that part of the old
|
||||
advice is less wrong than it used to be. Widevine did not follow, and it remains a
|
||||
capability rather than a value, which puts it out of reach of every technique that works
|
||||
on the others.
|
||||
|
||||
The choices that actually address the remaining gap are to run real Chrome through a
|
||||
branded channel and accept that you no longer control the binary, or to use an engine that
|
||||
does not have the gap in the first place.
|
||||
|
||||
What does not address it is a better user agent string, which converts a browser that is
|
||||
merely missing one capability into one that is provably lying about it.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does Playwright use Chrome or Chromium?** As of Playwright 1.57, the default managed
|
||||
binary (no `channel` set) is Chrome for Testing - Google's own dedicated automation
|
||||
distribution, carrying Chrome's codecs but not its Widevine CDM. Earlier Playwright
|
||||
versions, or an explicit bare-Chromium build, still lack the codecs too. Branded channels
|
||||
remain available as an opt-in for the rest.
|
||||
|
||||
**How can a website tell an automated Chromium-family browser from real Chrome today?**
|
||||
Mostly by asking for Widevine DRM support, which the codec-carrying default still lacks.
|
||||
The codec check that used to work for this closed as of the 1.57 default switch.
|
||||
|
||||
**Can I patch Widevine support in?** Not from JavaScript. A missing DRM module is missing
|
||||
code, not a missing property.
|
||||
|
||||
**Is using a Widevine-less build suspicious?** Yes, specifically: almost the only sessions
|
||||
answering "no" to that one check are developers, CI, and automation.
|
||||
|
||||
**Should I spoof the user agent to say Chrome?** No. On a current default launch it no
|
||||
longer contradicts the codec check, but it still contradicts the Widevine one, and that
|
||||
contradiction is checkable in one line.
|
||||
|
||||
**What about `channel="chrome"`?** It closes the remaining gap and hands you a browser you
|
||||
do not ship, do not version and cannot always install.
|
||||
|
||||
**Does Firefox have the same problem?** No. There is no widely-used stripped Firefox that
|
||||
automation runs and people do not.
|
||||
|
||||
**See also:** [Codec fingerprinting](codec-fingerprinting.md) for the wider surface,
|
||||
[why you should not set the user agent](playwright-user-agent.md),
|
||||
[Client Hints and Sec-Fetch](client-hints-sec-fetch.md) for the third copy of the same
|
||||
claim, and
|
||||
[Firefox or Chromium for anti-detect](firefox-vs-chromium-antidetect.md) for the argument
|
||||
in both directions.
|
||||
|
||||
## Sources
|
||||
|
||||
- [Playwright's release notes](https://playwright.dev/docs/release-notes), on the switch
|
||||
from custom-compiled open-source Chromium to Chrome for Testing as the default managed
|
||||
binary.
|
||||
- Direct capability checks run in a live Playwright session, 2026-07-30: H.264 and AAC
|
||||
playable, Widevine (`com.widevine.alpha`) rejected with `NotSupportedError`, on the
|
||||
default managed binary with no `channel` argument set.
|
||||
- [The Encrypted Media Extensions API](https://developer.mozilla.org/en-US/docs/Web/API/Encrypted_Media_Extensions_API), for the Widevine capability check above.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. This is the argument for the engine choice that we
|
||||
find most convincing, and it is the one most comparisons leave out.*
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
title: "CLI reference"
|
||||
description: "The invisible-playwright command line: two commands, fetch and version, and what each one covers."
|
||||
parent: "Documentation"
|
||||
nav_order: 5
|
||||
---
|
||||
|
||||
|
||||
# CLI reference
|
||||
|
||||
The installed command is `invisible-playwright`, with a hyphen. `python -m
|
||||
invisible_playwright` works identically and needs nothing on `PATH`.
|
||||
|
||||
```bash
|
||||
invisible-playwright fetch # download the engine if missing, check every cached
|
||||
# one against the seal, print the path
|
||||
invisible-playwright version # wrapper, core and engine versions, and where the
|
||||
# engine is cached
|
||||
```
|
||||
|
||||
## `fetch`
|
||||
|
||||
Makes the engine present and correct, then prints where it is.
|
||||
|
||||
It checks every cached engine tree against the seal shipped inside
|
||||
`invisible-core` **before** downloading anything. That ordering is the point: a
|
||||
tree that no longer matches the seal is the case worth catching, and it is
|
||||
invisible to a plain "download if missing" that only looks at whether a file is
|
||||
there. Anything that does not match is reported on stderr and left alone; the
|
||||
sealed engine is fetched and verified against its sha256.
|
||||
|
||||
The last line on stdout is the absolute path, by itself, so this is the scripting
|
||||
form:
|
||||
|
||||
```bash
|
||||
FIREFOX="$(invisible-playwright fetch)"
|
||||
```
|
||||
|
||||
which is better than asking for a path separately, because it guarantees the
|
||||
thing it names actually exists and matches the seal.
|
||||
|
||||
Running it when everything is already correct is cheap and does nothing.
|
||||
|
||||
## `version`
|
||||
|
||||
```
|
||||
invisible_playwright 0.6.0
|
||||
invisible_core 18.12.0 (declared: ==18.12.0)
|
||||
engine firefox-18 Firefox 151.0 build 20260724001949
|
||||
seal f294a96ae4ec [.../invisible_core/seal.json]
|
||||
cache /home/you/.cache/invisible-playwright
|
||||
```
|
||||
|
||||
This is the output to paste into a bug report. Two lines are worth knowing about:
|
||||
|
||||
- if the installer's record disagrees with the core that will actually run, a
|
||||
`STALE RECORD` line appears between them. That is the state pip and `pip check`
|
||||
both call healthy, because both read the record and neither reads the files.
|
||||
- `cache` is where the engine trees live. Deleting a directory there is how you
|
||||
reclaim the space; there is no subcommand for it, on purpose - see below.
|
||||
|
||||
## What happened to the other four
|
||||
|
||||
The command line used to have six entries: `fetch`, `fetch --force`, `path`,
|
||||
`version`, `clear-cache`, `doctor`. Each was a step somebody had to know to take,
|
||||
in a package whose whole promise is that the browser handles itself. None of the
|
||||
behaviour was lost:
|
||||
|
||||
| gone | where it went |
|
||||
|---|---|
|
||||
| `doctor` | `fetch` does it on every run. It was the thing most worth doing and the thing least likely to be typed, which is the worst combination a subcommand can have. |
|
||||
| `fetch --force` | unnecessary once every run verifies. A tree is replaced because it does not match the seal, not because a flag was passed. |
|
||||
| `path` | `fetch` prints it as its last line, and unlike `path` it guarantees the tree is there and correct. |
|
||||
| `clear-cache` | deliberately not folded in. The cache root belongs to `invisible_core`, not to this package, so pruning "trees no seal points at" would delete an engine this package did not put there. `version` prints the location. |
|
||||
|
||||
The `tag` argument went with them. The seal decides which engine a given build
|
||||
runs, and the engine check refuses anything else, so a tag on the command line
|
||||
could only ever name something that would then be rejected.
|
||||
|
||||
## See also
|
||||
|
||||
[Installation](installation.md) for the initial `fetch`, and
|
||||
[Configuration](configuration.md) for the environment variables that change where
|
||||
the engine is cached or which binary gets used.
|
||||
@@ -0,0 +1,213 @@
|
||||
---
|
||||
title: "Client Hints and Sec-Fetch: headers that must agree"
|
||||
description: "Client Hints (Sec-CH-UA) and Sec-Fetch headers come from the browser's own state, so they are cheap to compare and hard to fake. Why Firefox sits differently."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 6
|
||||
---
|
||||
|
||||
|
||||
# Client Hints and Sec-Fetch: headers that must agree
|
||||
|
||||
[Client Hints](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Client_hints) and
|
||||
Sec-Fetch are two families of request headers the browser generates from
|
||||
its own internal state, not from the page and not from anything you configure. That makes
|
||||
them awkward to fake and very cheap to check, which is a combination detectors like.
|
||||
|
||||
They also catch a specific mistake: changing the user agent string and nothing else.
|
||||
|
||||
This page is what each family carries, the mismatches that get caught, why Firefox and
|
||||
Chromium are in structurally different positions here, what automation can and cannot
|
||||
control, and how to check your own.
|
||||
|
||||
## Client Hints: one identity in three places
|
||||
|
||||
Modern Chromium reports its identity in three places that come from the same internal
|
||||
state:
|
||||
|
||||
```
|
||||
Sec-CH-UA: "Chromium";v="141", "Not?A_Brand";v="8", "Google Chrome";v="141"
|
||||
Sec-CH-UA-Mobile: ?0
|
||||
Sec-CH-UA-Platform: "Windows"
|
||||
```
|
||||
|
||||
```js
|
||||
navigator.userAgentData.brands // the same brands and versions
|
||||
navigator.userAgentData.platform // the same platform
|
||||
await navigator.userAgentData.getHighEntropyValues(['platformVersion', 'architecture'])
|
||||
```
|
||||
|
||||
```
|
||||
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) ... Chrome/141.0.0.0 ...
|
||||
```
|
||||
|
||||
In a real browser those three agree by construction, because one piece of state produces
|
||||
all of them. Comparing them is a few lines on the server and it needs no fingerprinting
|
||||
library at all.
|
||||
|
||||
### The mismatches that get caught
|
||||
|
||||
- **A spoofed user agent with untouched Client Hints.** You set the string to Chrome 141
|
||||
and the headers still describe whatever the browser really is. This is the single most
|
||||
common version of the mistake, because changing the string is the thing every guide
|
||||
tells you to do.
|
||||
- **A version that differs between the two.** A current version in the user agent and an
|
||||
older one in the hints is a straight contradiction.
|
||||
- **A platform that differs.** Claiming Windows in the string while the hint reports the
|
||||
host operating system.
|
||||
- **The JavaScript API disagreeing with the headers.** Patching
|
||||
[`navigator.userAgentData`](https://developer.mozilla.org/en-US/docs/Web/API/NavigatorUAData)
|
||||
in the page does nothing to the headers, which were sent before your script existed.
|
||||
|
||||
That last one is worth sitting with. The headers travel with the request. A page-level
|
||||
override cannot reach them, ever, because they were already sent.
|
||||
|
||||
## Firefox is in a different position, in both directions
|
||||
|
||||
Firefox does not implement User Agent Client Hints. It sends no `Sec-CH-UA` headers and
|
||||
has no `navigator.userAgentData`.
|
||||
|
||||
That cuts two ways and both are worth being explicit about.
|
||||
|
||||
**In your favour, if you are actually Firefox.** There is no second identity pipeline to
|
||||
keep synchronised. The absence is correct, expected, and matches every other real Firefox
|
||||
on the internet. The whole class of mismatch above simply does not apply.
|
||||
|
||||
**Against you, if you claim to be Chrome.** A request whose user agent says Chrome and
|
||||
which carries no Client Hints at all is contradicted by its own headers. There is no way
|
||||
to fix that from inside a Firefox, because you would have to implement the pipeline.
|
||||
|
||||
So "which browser should I claim" is not a free choice. Claim the one you are running.
|
||||
[Which is the argument for not setting the user agent at all](playwright-user-agent.md).
|
||||
|
||||
## Sec-Fetch: how the request was initiated
|
||||
|
||||
[Sec-Fetch](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-Fetch-Site)
|
||||
is a separate family of headers, present in every modern browser including
|
||||
Firefox, that describes how a request was initiated rather than what the browser is. It is
|
||||
much less discussed than Client Hints, and just as cheap for a server to check.
|
||||
|
||||
```
|
||||
Sec-Fetch-Site: same-origin | same-site | cross-site | none
|
||||
Sec-Fetch-Mode: navigate | cors | no-cors | same-origin
|
||||
Sec-Fetch-Dest: document | image | script | style | empty
|
||||
Sec-Fetch-User: ?1 (only present when a user activated the navigation)
|
||||
```
|
||||
|
||||
These describe **the circumstances of the request**, not the browser. The browser fills
|
||||
them in from what it knows: where the request came from, what it is for, and whether a
|
||||
user gesture triggered it.
|
||||
|
||||
Why that is interesting for automation:
|
||||
|
||||
- A top-level navigation typed into the address bar carries `Sec-Fetch-Site: none`. One
|
||||
that came from clicking a link on the same site carries `same-origin`. A request
|
||||
fabricated outside the normal flow can easily carry the wrong one.
|
||||
- `Sec-Fetch-User: ?1` appears only when the navigation was user activated. Automation
|
||||
that clicks properly produces it; automation that navigates programmatically does not,
|
||||
and a page that expected a click can notice the difference.
|
||||
- `Sec-Fetch-Dest` has to match what the request is actually for. A document request that
|
||||
claims to be an image is not a browser.
|
||||
|
||||
The connection to the rest of this subject: user activation is also readable in the page,
|
||||
through `navigator.userActivation`, and it is the value that
|
||||
[an automation driver can announce by accident](debugger-timing-detection.md). Getting
|
||||
that wrong in either direction, claiming a gesture nobody made or lacking one a real flow
|
||||
would have, is the same class of inconsistency as everything else here.
|
||||
|
||||
## What automation can and cannot control
|
||||
|
||||
The practical division:
|
||||
|
||||
**Cannot be set from the page.** All of it. These headers are constructed by the network
|
||||
stack when the request is made. Anything you do in JavaScript happens after.
|
||||
|
||||
**Can be set by the automation layer**, badly. Most frameworks let you add or override
|
||||
request headers. Overriding these by hand is how you produce a set that no real browser
|
||||
sends, because you are now maintaining by hand something the browser was maintaining
|
||||
correctly.
|
||||
|
||||
**Should be left alone.** That is the whole recommendation. If the browser is real and
|
||||
you have not overridden its identity, both families are correct for free.
|
||||
|
||||
The one legitimate case is adding headers a site requires for its own API, which is
|
||||
unrelated to identity and does not touch either family.
|
||||
|
||||
## Checking your own
|
||||
|
||||
Send a request to any service that echoes headers back and read the full set, then
|
||||
compare against what the same page reports in JavaScript.
|
||||
|
||||
```js
|
||||
// in the page
|
||||
console.log(navigator.userAgent);
|
||||
console.log(navigator.userAgentData); // undefined in Firefox, and that is correct
|
||||
if (navigator.userAgentData) {
|
||||
console.log(await navigator.userAgentData.getHighEntropyValues(
|
||||
['platformVersion', 'architecture', 'model', 'uaFullVersion']));
|
||||
}
|
||||
```
|
||||
|
||||
What you want:
|
||||
|
||||
- If `navigator.userAgentData` exists, its brands, version and platform match both the
|
||||
user agent string and the `Sec-CH-UA` headers on the request.
|
||||
- If it does not exist, no `Sec-CH-UA` headers are being sent either, and the user agent
|
||||
claims a browser that genuinely does not send them.
|
||||
- `Sec-Fetch-Site` matches how you actually navigated.
|
||||
- `Sec-Fetch-User` is present when you clicked and absent when you navigated
|
||||
programmatically.
|
||||
- Header **order** matches a real browser's, [a separate surface](http2-fingerprint-detection.md)
|
||||
one layer down, and one more reason not to hand-assemble any of this.
|
||||
|
||||
## Conclusion
|
||||
|
||||
These headers are hard to fake for a good reason: the browser generates them from state
|
||||
it already has, so a real browser is consistent without trying and a spoofed one has to
|
||||
maintain three copies of an identity by hand.
|
||||
|
||||
The practical advice is short. Do not override the user agent, so there is nothing to
|
||||
keep in sync. Do not hand-set these headers. Claim the browser you are actually running,
|
||||
because Firefox not sending Client Hints is correct for Firefox and damning for something
|
||||
claiming to be Chrome.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What is `Sec-CH-UA`?** A request header carrying the browser's brand and version,
|
||||
generated from the same internal state as the user agent string.
|
||||
|
||||
**Why do Client Hints give away a spoofed user agent?** Because changing the string does
|
||||
not change the headers, so the two describe different browsers.
|
||||
|
||||
**Does Firefox send Client Hints?** No, and it has no `navigator.userAgentData`. That is
|
||||
correct for Firefox and a contradiction for anything claiming to be Chrome.
|
||||
|
||||
**Can I set Client Hints from JavaScript?** No. The headers are sent before your script
|
||||
runs.
|
||||
|
||||
**What is `Sec-Fetch-User`?** A header present only when a user gesture triggered the
|
||||
navigation.
|
||||
|
||||
**Should I override these headers in my automation?** No. A real browser fills them in
|
||||
correctly, and hand-maintaining them is how you produce a combination that does not
|
||||
exist.
|
||||
|
||||
**See also:** [why you should not set the user agent](playwright-user-agent.md), which is
|
||||
the same argument from the other end,
|
||||
[JA3 and JA4](ja3-ja4-tls-fingerprint.md), for the layer below these headers, and
|
||||
[how to test whether your browser is detected](how-to-test-bot-detection.md).
|
||||
|
||||
## Sources
|
||||
|
||||
- The User Agent Client Hints headers and `navigator.userAgentData`, as implemented in
|
||||
Chromium and absent in Firefox.
|
||||
- The Fetch Metadata request headers, `Sec-Fetch-Site`, `-Mode`, `-Dest` and `-User`.
|
||||
- This project's handling of user activation, which is described on
|
||||
[the debugger page](debugger-timing-detection.md).
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. Running a real Firefox means the Client Hints
|
||||
question answers itself, which is the kind of advantage you only get by not lying in the
|
||||
first place.*
|
||||
@@ -0,0 +1,199 @@
|
||||
---
|
||||
title: "Codec fingerprinting: canPlayType and MediaCapabilities"
|
||||
description: "Codec fingerprinting: the formats a browser claims to play reveal its build and platform; whether decoding is power efficient reveals the machine behind it."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 7
|
||||
---
|
||||
|
||||
|
||||
# Codec fingerprinting: canPlayType and MediaCapabilities
|
||||
|
||||
Codec fingerprinting identifies a browser by which media formats it claims it can
|
||||
decode, and identifies the machine underneath by how efficiently it decodes them. Ask a
|
||||
browser what video formats it can play and the answer is not about the person using it.
|
||||
It is about the build, the operating system underneath, and increasingly the hardware,
|
||||
which makes it three separate fingerprinting surfaces wearing one API.
|
||||
|
||||
It is also one of the surfaces nobody checks after spoofing everything else, which is
|
||||
what makes it worth a page.
|
||||
|
||||
## What the two APIs actually return
|
||||
|
||||
Two APIs answer the "what can you play" question, from two different eras of the
|
||||
platform: the old `canPlayType()` returns a vague string, the modern
|
||||
`mediaCapabilities.decodingInfo()` returns a structured verdict including whether
|
||||
decoding is power efficient. The old one is deliberately vague:
|
||||
|
||||
```js
|
||||
const v = document.createElement('video');
|
||||
v.canPlayType('video/mp4; codecs="avc1.42E01E"'); // "probably", "maybe", or ""
|
||||
v.canPlayType('video/webm; codecs="vp9"');
|
||||
v.canPlayType('audio/mpeg');
|
||||
```
|
||||
|
||||
Three possible answers: `probably`, `maybe`, or an empty string. The vagueness is
|
||||
historical, and it does not reduce the information much, because what matters is the
|
||||
**pattern across a list of types**, not any single verdict.
|
||||
|
||||
The modern one is far more revealing:
|
||||
|
||||
```js
|
||||
await navigator.mediaCapabilities.decodingInfo({
|
||||
type: 'file',
|
||||
video: { contentType: 'video/mp4; codecs="avc1.42E01E"',
|
||||
width: 1920, height: 1080, bitrate: 3000000, framerate: 30 }
|
||||
});
|
||||
// { supported: true, smooth: true, powerEfficient: true }
|
||||
```
|
||||
|
||||
Note the third field. That is the interesting one and the rest of this page is largely
|
||||
about it.
|
||||
|
||||
## Codec support identifies the build and the platform
|
||||
|
||||
Which codecs a browser supports depends on how it was compiled and what the operating
|
||||
system provides. Some formats are handled by the browser's own decoders, others are
|
||||
delegated to the platform, and licensing means builds differ.
|
||||
|
||||
The practical consequences:
|
||||
|
||||
- **Different browsers give different patterns**, which is how codec probing is used for
|
||||
plain browser identification, independently of the user agent.
|
||||
- **The same browser version on different operating systems gives different patterns**,
|
||||
because the platform decoders differ. A Linux build and a Windows build of the same
|
||||
Firefox are not identical here.
|
||||
- **Stripped builds differ from consumer builds.** A minimal container image may lack
|
||||
system codecs that a desktop install has.
|
||||
|
||||
That third point is the one that bites automation. Claiming Windows while returning the
|
||||
codec profile of a slim Linux container is the same class of contradiction as
|
||||
[claiming Windows with a Linux font set](headless-fonts-differ.md), and it is checked
|
||||
the same way: by comparison, not by rarity.
|
||||
|
||||
## powerEfficient is a hardware question, not a codec question
|
||||
|
||||
`powerEfficient` reports whether decoding a given stream would use hardware
|
||||
acceleration, which is what turns this from a browser-identification surface into a
|
||||
machine one. On a desktop with a modern GPU, common formats decode in dedicated silicon
|
||||
and the answer is `true`. On a machine with no GPU, everything decodes on the CPU and the
|
||||
answer is `false` for formats a real desktop would accelerate.
|
||||
|
||||
So this API answers, in one field, the same question as
|
||||
[a software WebGL renderer](webgl-renderer-strings.md),
|
||||
[an empty speech voice list](speech-synthesis-voices.md) and
|
||||
[a missing audio device](audiocontext-fingerprinting.md): is this a person's computer or
|
||||
a server.
|
||||
|
||||
And `smooth` adds a second dimension, since it reflects whether the machine can decode
|
||||
that resolution and framerate in real time.
|
||||
|
||||
Nobody lists `decodingInfo` in a stealth checklist. It costs one `await`.
|
||||
|
||||
## Why randomising codec support is the wrong instinct
|
||||
|
||||
The reflex is to vary the answers per session. That is the same
|
||||
mistake as
|
||||
[randomising WebGL numeric parameters](webgl-parameters-are-identical.md), and it fails
|
||||
for the same reason.
|
||||
|
||||
Codec support is not a per-user setting. Everyone running a given browser build on a
|
||||
given platform reports the same pattern, which means the pattern is a **cohort**, and the
|
||||
crowd is the disguise. A browser reporting a combination of supported and unsupported
|
||||
formats that no real build produces is not blending in, it has invented a build that does
|
||||
not exist.
|
||||
|
||||
Nor should the values move between page loads. A browser that supports AV1 on one load
|
||||
and not the next is describing software that reinstalled itself mid-session.
|
||||
|
||||
The defensible approach is the one used for the other hardware-shaped values in this
|
||||
project: sample the codec profile **together with the machine class**, from combinations
|
||||
that occur, so a low-end integrated-graphics identity does not claim the codec profile of
|
||||
a workstation. It is one of four dimensions sampled jointly rather than independently,
|
||||
alongside the audio profile, the storage quota and the antialiasing level, precisely so
|
||||
they cannot contradict each other.
|
||||
|
||||
## Checking your own
|
||||
|
||||
```js
|
||||
const v = document.createElement('video');
|
||||
const types = [
|
||||
'video/mp4; codecs="avc1.42E01E"',
|
||||
'video/mp4; codecs="hev1.1.6.L93.B0"',
|
||||
'video/webm; codecs="vp8"',
|
||||
'video/webm; codecs="vp9"',
|
||||
'video/mp4; codecs="av01.0.05M.08"',
|
||||
'audio/mpeg', 'audio/ogg; codecs="opus"', 'audio/mp4; codecs="mp4a.40.2"',
|
||||
];
|
||||
console.table(Object.fromEntries(types.map(t => [t, v.canPlayType(t) || 'no'])));
|
||||
|
||||
const info = await navigator.mediaCapabilities.decodingInfo({
|
||||
type: 'file',
|
||||
video: { contentType: 'video/mp4; codecs="avc1.42E01E"',
|
||||
width: 1920, height: 1080, bitrate: 3000000, framerate: 30 },
|
||||
});
|
||||
console.log(info); // watch powerEfficient
|
||||
```
|
||||
|
||||
What you want to see:
|
||||
|
||||
- The pattern matches a stock browser of the same version **on the platform you claim**,
|
||||
not on the platform you are running.
|
||||
- `powerEfficient` is `true` for mainstream formats if you are claiming a desktop.
|
||||
- The answers are identical on a reload and on a relaunch of the same identity.
|
||||
- Nothing exotic is supported that the claimed build does not support.
|
||||
|
||||
The first and second are the ones that fail on a server, and neither is fixed by anything
|
||||
at the JavaScript layer.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Codec probing is cheap, unglamorous and rarely audited. It carries three different kinds
|
||||
of information at once: which browser you are, which platform you are on, and whether
|
||||
your machine has a video decoder.
|
||||
|
||||
The first two are fixed by making the answers match the build and platform you claim.
|
||||
The third is the familiar one: a machine with no GPU says so, in yet another place, and
|
||||
the only real fixes are the same as everywhere else.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Is `canPlayType` used for fingerprinting?** Yes, as a pattern across a list of types
|
||||
rather than as a single answer. It identifies the browser and the platform.
|
||||
|
||||
**What does `powerEfficient` reveal?** Whether decoding would be hardware accelerated,
|
||||
which is a statement about the machine rather than the codec.
|
||||
|
||||
**Should I spoof codec support?** Match it to the build and platform you claim. Do not
|
||||
randomise it, and do not let it vary between page loads.
|
||||
|
||||
**Why do Linux and Windows builds differ?** Because some decoding is delegated to the
|
||||
platform, and the platforms provide different things.
|
||||
|
||||
**Does `privacy.resistFingerprinting` cover this?** Firefox has worked on standardising
|
||||
these answers under that mode, which is one more way of being identifiable as someone
|
||||
running that mode. There is
|
||||
[a longer page on that trade](resist-fingerprinting.md).
|
||||
|
||||
**Is this checked in practice?** It is cheap enough that assuming it is checked costs you
|
||||
nothing, and it is one `await` to verify on your own setup.
|
||||
|
||||
**See also:** [screen size and viewport tells](screen-size-headless-tells.md),
|
||||
[hardwareConcurrency, deviceMemory and storage quota](hardware-concurrency-device-memory.md)
|
||||
and [Playwright in Docker](playwright-docker-detection.md), which are the rest of the
|
||||
"what the machine says about itself" family.
|
||||
|
||||
## Sources
|
||||
|
||||
- MDN, [`HTMLMediaElement.canPlayType`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/canPlayType)
|
||||
and the [Media Capabilities API](https://developer.mozilla.org/en-US/docs/Web/API/MediaCapabilities_API).
|
||||
- Firefox's own tracking of standardising these answers under resist-fingerprinting.
|
||||
- This project's codec profile, sampled jointly with the machine class rather than
|
||||
independently, for the reason given above.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. The joint sampling is the same decision made for
|
||||
audio, storage quota and antialiasing, and for the same reason: independently sampled
|
||||
dimensions contradict each other.*
|
||||
@@ -0,0 +1,215 @@
|
||||
---
|
||||
title: "Color-gamut and HDR media queries as a fingerprint"
|
||||
description: "Color-gamut and HDR media features expose display capability without JavaScript. Why they must align with screen.colorDepth and what misalignment reveals."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 28
|
||||
---
|
||||
|
||||
# Color-gamut and HDR media queries as a fingerprint
|
||||
|
||||
Most of the fingerprint surfaces people worry about live in JavaScript: `navigator`,
|
||||
canvas, WebGL, audio. This one does not. The [`color-gamut`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/color-gamut), [`dynamic-range`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/dynamic-range) and
|
||||
[`video-dynamic-range`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/video-dynamic-range) media features describe what a display can show, and a page can
|
||||
read them from CSS alone, before a single line of script runs. That makes them a
|
||||
quiet consistency check: they have to agree with everything your JavaScript says about
|
||||
the same screen, and nothing you set in code touches them.
|
||||
|
||||
This page is what those features report, why they are read from a different code path
|
||||
than `screen.colorDepth`, the disagreement that gives a browser away, and how
|
||||
invisible_playwright keeps the two sides telling one story. It answers the question in
|
||||
the title honestly: matching these features helps you look like a real display, and it
|
||||
does nothing for your IP or your pacing.
|
||||
|
||||
## What color-gamut and dynamic-range actually report
|
||||
|
||||
Three CSS media features describe a display's color and brightness capability:
|
||||
|
||||
- `color-gamut` reports the range of color the output can render, as one of `srgb`,
|
||||
`p3` or `rec2020`. A page tests it with `@media (color-gamut: srgb) { ... }` or from
|
||||
script with `matchMedia("(color-gamut: p3)")`.
|
||||
- `dynamic-range` reports whether the display and the browser can show high dynamic
|
||||
range content, as `standard` or `high`.
|
||||
- `video-dynamic-range` is the same question aimed specifically at video output, and
|
||||
can differ from `dynamic-range` on hardware that treats the two paths separately.
|
||||
|
||||
None of these needs JavaScript to be readable. A stylesheet can branch on them and a
|
||||
detector can observe which branch applied, so they are live even on a page that runs
|
||||
no script at all. This puts them in the same family as the
|
||||
[CSS media features documented for dark mode and pointer type](css-media-query-fingerprinting.md),
|
||||
and distinct from them in what they describe: not a user preference, but a hardware
|
||||
property of the panel.
|
||||
|
||||
The values are not free-floating. A real Windows laptop with a standard sRGB panel
|
||||
reports `color-gamut: srgb` and `dynamic-range: standard`, and it reports a
|
||||
`screen.colorDepth` of 24 to match. Those two facts come from the same physical
|
||||
display, so on real hardware they never contradict each other. That is the whole
|
||||
point of the surface for a detector.
|
||||
|
||||
## Why this is read from a different code path than colorDepth
|
||||
|
||||
Here is the trap. `screen.colorDepth` is a JavaScript property. The color-gamut media
|
||||
feature is resolved by the CSS engine when it evaluates a media query. A page can read
|
||||
both, and it can compare them, but they arrive through two entirely separate paths
|
||||
inside the browser.
|
||||
|
||||
That separation is exactly what a consistency detector wants. If a stealth layer
|
||||
overrides `screen.colorDepth` in JavaScript to report a plausible 24-bit display, but
|
||||
the CSS side still resolves `color-gamut` against whatever the underlying environment
|
||||
actually has, the two disagree. One code path was patched and the other was not. A
|
||||
real browser cannot produce that disagreement, because both values are read off the
|
||||
same panel. So a page that finds `screen.colorDepth: 24` next to a `color-gamut` that
|
||||
resolves to something else has found a browser whose two halves were configured
|
||||
independently, which is a tell that no single value would have given up.
|
||||
|
||||
The same shape shows up in
|
||||
[the platform and oscpu strings that have to agree with the user agent](navigator-platform-oscpu-consistency.md):
|
||||
individually every value is plausible, and the fingerprint is in whether they line up.
|
||||
A JavaScript-only spoof can set the property a page reads first, and miss the second
|
||||
surface that reports the same underlying fact through CSS.
|
||||
|
||||
## Why a page-level override cannot fix this
|
||||
|
||||
If your approach to fingerprinting is injecting JavaScript, this surface is a problem,
|
||||
because there is nothing in JavaScript's gift to change here. You can redefine
|
||||
`matchMedia` to lie about `color-gamut`, but redefining a built-in is itself one of
|
||||
the loudest tells there is: [CreepJS](how-to-test-bot-detection.md) walks descriptors
|
||||
and prototypes and records a patched built-in by name. And even if you patch
|
||||
`matchMedia`, the pure-CSS path that applies a `@media (color-gamut: ...)` rule
|
||||
without ever calling script is still resolving against the real value. You cannot
|
||||
intercept a stylesheet branch from a `matchMedia` override.
|
||||
|
||||
The only place this can be made consistent is below JavaScript, where the CSS engine
|
||||
and the `screen` object read the same display description. invisible_playwright is a
|
||||
Firefox patched at the C++ level rather than a script injected into a stock browser,
|
||||
so the display it presents is a single coherent object: the color-gamut media feature,
|
||||
`dynamic-range`, `video-dynamic-range` and `screen.colorDepth` all resolve from one
|
||||
plausible Windows sRGB display, the way they do on the real Firefox it is built from.
|
||||
There is no second code path left unpatched, because the value is not being faked at
|
||||
the property level at all.
|
||||
|
||||
This is the same reason [an impossible screen geometry](screen-size-headless-tells.md)
|
||||
survives every page-level spoofer: the surfaces that describe the physical display are
|
||||
not the ones a script can reach.
|
||||
|
||||
## Reading it yourself
|
||||
|
||||
The `browser` returned by invisible_playwright is a real Playwright `Browser`, so you
|
||||
read these features the same way you would in any Playwright script. Launch, open a
|
||||
page, and evaluate the media queries plus the property they have to agree with:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
|
||||
report = page.evaluate("""() => ({
|
||||
colorGamut:
|
||||
matchMedia('(color-gamut: rec2020)').matches ? 'rec2020' :
|
||||
matchMedia('(color-gamut: p3)').matches ? 'p3' :
|
||||
matchMedia('(color-gamut: srgb)').matches ? 'srgb' : 'unknown',
|
||||
dynamicRange:
|
||||
matchMedia('(dynamic-range: high)').matches ? 'high' : 'standard',
|
||||
videoDynamicRange:
|
||||
matchMedia('(video-dynamic-range: high)').matches ? 'high' : 'standard',
|
||||
colorDepth: screen.colorDepth,
|
||||
pixelDepth: screen.pixelDepth,
|
||||
})""")
|
||||
|
||||
print(report)
|
||||
# {'colorGamut': 'srgb', 'dynamicRange': 'standard',
|
||||
# 'videoDynamicRange': 'standard', 'colorDepth': 24, 'pixelDepth': 24}
|
||||
```
|
||||
|
||||
The check that matters is not any single line of that output. It is that
|
||||
`colorGamut: 'srgb'` and `colorDepth: 24` describe the same display, and would still
|
||||
describe the same display if you read them again in the next session. Because the
|
||||
identity is derived from the seed, passing `seed=42` gives you the same display every
|
||||
run, so this is a value you can assert on in a test rather than a moving target. The
|
||||
[reproducible-fingerprint workflow](quickstart.md) is what makes that assertion stable.
|
||||
|
||||
Run it against a stock Firefox on the same machine and diff the two reports field by
|
||||
field. On a real desktop panel they match. The point of the exercise is to confirm the
|
||||
patched build sits on the same side of that diff as the real browser, not on the
|
||||
overcorrected side where a spoof reports a `p3` display no one asked for.
|
||||
|
||||
## The honest limit
|
||||
|
||||
This makes your browser's display self-consistent. It is worth being precise about
|
||||
what that does and does not buy you.
|
||||
|
||||
Color-gamut and dynamic-range are properties of the browser and its claimed hardware.
|
||||
Getting them right removes one way a page distinguishes a real display from a patched
|
||||
one, and it removes it at the layer where it actually lives rather than papering over
|
||||
it in script. That is a real part of why invisible_playwright reads as a genuine
|
||||
Firefox to fingerprint, TLS and driver-layer checks.
|
||||
|
||||
It is not the whole session. These media features say nothing about where your traffic
|
||||
exits or how fast you send it. A perfectly consistent sRGB display on a datacenter
|
||||
address that a scoring service already knows is still on a known address. A browser
|
||||
that fills a form in eighty milliseconds still moves like no human, whatever its
|
||||
color-gamut reports. invisible_playwright does not touch IP reputation, per-account
|
||||
quotas, rate limits, or the timing of your actions, and it does not claim to. Those
|
||||
you supply: a clean residential proxy, human pacing, one account doing one plausible
|
||||
amount of work. The fingerprint is the part that is hard to get right by hand, and it
|
||||
is the part this tool owns; the rest of the session is still yours.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Color-gamut, dynamic-range and video-dynamic-range are a display fingerprint that
|
||||
lives in CSS, readable with no JavaScript, and they have to agree with the
|
||||
`screen.colorDepth` a page reads from script through a completely separate code path.
|
||||
A page-level override touches one path and leaves the other reporting the real
|
||||
environment, which is a contradiction a real browser never produces. invisible_playwright
|
||||
presents a single coherent Windows sRGB display across both paths because it is patched
|
||||
below JavaScript, and it keeps that display stable across runs when you pin the seed.
|
||||
That is worth exactly what it is worth: a browser that looks real, on top of an exit
|
||||
and a rhythm you still have to get right yourself.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can a website read my display's color gamut without JavaScript?** Yes. The
|
||||
`color-gamut` media feature is resolved by the CSS engine, so a stylesheet can branch
|
||||
on it and observe the result before any script runs.
|
||||
|
||||
**What is the trap with color-gamut and screen.colorDepth?** They describe the same
|
||||
physical display but are read through different code paths. If a spoof patches one and
|
||||
not the other, they disagree, which a real browser never does.
|
||||
|
||||
**Can I fix this by overriding matchMedia?** No. Redefining a built-in is itself a
|
||||
loud tell, and it still does not touch the pure-CSS path that applies a
|
||||
`@media (color-gamut: ...)` rule without calling script.
|
||||
|
||||
**What does invisible_playwright report for these features?** A plausible, consistent
|
||||
Windows sRGB display: `color-gamut: srgb`, `dynamic-range: standard`, and a matching
|
||||
24-bit `screen.colorDepth`, the same as the real Firefox it is built from.
|
||||
|
||||
**Does matching these features make me undetectable?** No. It makes your display
|
||||
self-consistent. It does nothing for your IP reputation, your rate limits or your
|
||||
behaviour, which you still have to handle with a clean proxy and human pacing.
|
||||
|
||||
**Will the same seed give the same color-gamut every run?** Yes. The display is derived
|
||||
from the seed, so `seed=42` reports the same values every session, which is what lets
|
||||
you assert on them in a test.
|
||||
|
||||
## Sources
|
||||
|
||||
- The [Media Queries Level 5 specification](https://www.w3.org/TR/mediaqueries-5/),
|
||||
which defines `color-gamut`, `dynamic-range` and `video-dynamic-range` and their
|
||||
resolution from the output device.
|
||||
- This project's fingerprint gates, which cross-check the CSS-resolved display
|
||||
features against `screen.colorDepth` and the canvas and WebGL persona for the same
|
||||
seed.
|
||||
|
||||
**See also:** [CSS media features as a fingerprint surface](css-media-query-fingerprinting.md),
|
||||
[keeping navigator.platform and oscpu consistent](navigator-platform-oscpu-consistency.md),
|
||||
and [screen sizes that give a headless machine away](screen-size-headless-tells.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 color-gamut and
|
||||
colorDepth disagreement is one I would rather find in my own diff than have a page find
|
||||
for me.*
|
||||
@@ -0,0 +1,211 @@
|
||||
---
|
||||
title: "Combine invisible_playwright with httpx for speed"
|
||||
description: "Clear the fingerprint-gated entry in a real browser, export storage_state, then hand the cookies to httpx for cheap high-volume follow-up requests - and the sharp limit."
|
||||
parent: "Scraping with Playwright"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 89
|
||||
---
|
||||
|
||||
|
||||
# Combine invisible_playwright with httpx for speed
|
||||
|
||||
A browser is expensive. It starts a process, renders a page, runs the site's
|
||||
JavaScript, and holds memory the whole time. If you need one page a minute that is fine.
|
||||
If you need a thousand JSON responses from an endpoint the site already exposes, paying
|
||||
browser cost for each one is the slow way to do it.
|
||||
|
||||
The fast way is a split: use the browser for the part that needs a browser, and use a
|
||||
bare HTTP client for the part that does not. This page shows the handoff concretely -
|
||||
export the session the browser established, hand it to `httpx`, and let `httpx` do the
|
||||
bulk - and it is equally clear about the one boundary where the trick stops working,
|
||||
because that boundary is the whole skill.
|
||||
|
||||
## Why the browser clears the door and httpx does not
|
||||
|
||||
`invisible_playwright` is a Firefox patched at the C++ level and driven by stock
|
||||
Playwright. It is built to look like a real browser driven by a real person: the
|
||||
fingerprint, the TLS handshake and the driver layer all read as a genuine Firefox, which
|
||||
is why it clears the checks that turn plain automation away at the door. That is the
|
||||
part you cannot fake with a bare HTTP client. An endpoint that inspects the JavaScript
|
||||
fingerprint, or reads the TLS handshake, expects a browser to be on the other end.
|
||||
|
||||
`httpx` is the opposite tool on purpose. It is a fast, async-capable Python HTTP client
|
||||
with no JavaScript engine and no browser TLS stack. It sends a plain client handshake and
|
||||
whatever headers you give it, and nothing else. That is exactly why it is cheap, and
|
||||
exactly why it cannot pass a fingerprint check. It has no fingerprint to present.
|
||||
|
||||
So the division is not a hack, it is the honest shape of the problem. The browser is for
|
||||
the fingerprint-gated fetches. `httpx` is for the unguarded bulk. Knowing which endpoint
|
||||
is which is the entire exercise, and most of this page is about telling them apart.
|
||||
|
||||
## Establish the session in the browser
|
||||
|
||||
First, do the guarded part properly: launch the real browser, clear whatever gates the
|
||||
entry (a login, a challenge page, a first navigation that sets a session cookie), and let
|
||||
it settle. Switching from plain Playwright is two lines, and the object you get back is a
|
||||
real Playwright `Browser`, so every method below is the stock API:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42, proxy={
|
||||
"server": "socks5://gate.example.com:1080",
|
||||
"username": "u", "password": "p",
|
||||
}) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com/app")
|
||||
# ... do whatever establishes the session: submit a form, pass an
|
||||
# interactive check, land on the page that issues the session cookie ...
|
||||
page.wait_for_load_state("networkidle")
|
||||
```
|
||||
|
||||
The seed is not decoration here. It pins the identity, so the fingerprint that created
|
||||
this session is reproducible - which matters the moment you reuse the session, because a
|
||||
reused session is still tied to the machine that created it. That coupling is the subject
|
||||
of [why reusing a session beats re-automating the login form](automating-login-vs-session-reuse.md).
|
||||
|
||||
## Export storage_state and hand it to httpx
|
||||
|
||||
Playwright already has the export you need.
|
||||
[`context.storage_state()`](https://playwright.dev/python/docs/api/class-browsercontext#browser-context-storage-state)
|
||||
returns the cookies and local storage the session accumulated, in a plain dict. Capture it
|
||||
while the browser is still open:
|
||||
|
||||
```python
|
||||
state = page.context.storage_state()
|
||||
# state == {"cookies": [{"name": ..., "value": ..., "domain": ...}, ...],
|
||||
# "origins": [{"origin": ..., "localStorage": [...]}, ...]}
|
||||
```
|
||||
|
||||
Now the browser has done its job. Everything after this can happen in a cheap client. Map
|
||||
the cookies into an `httpx.Client` and fire the follow-up requests concurrently:
|
||||
|
||||
```python
|
||||
import httpx
|
||||
|
||||
cookies = httpx.Cookies()
|
||||
for c in state["cookies"]:
|
||||
cookies.set(c["name"], c["value"], domain=c["domain"], path=c.get("path", "/"))
|
||||
|
||||
# route httpx through the SAME exit the browser used, see the caveat below
|
||||
proxy = "socks5://u:p@gate.example.com:1080"
|
||||
|
||||
with httpx.Client(cookies=cookies, proxy=proxy, http2=True,
|
||||
headers={"User-Agent": page.evaluate("navigator.userAgent")}) as client:
|
||||
for page_num in range(1, 200):
|
||||
r = client.get(f"https://example.com/api/items?page={page_num}")
|
||||
r.raise_for_status()
|
||||
handle(r.json())
|
||||
```
|
||||
|
||||
Two hundred JSON pages just came back without starting two hundred browsers. If the bulk
|
||||
endpoint returns the same data the page renders, this is also the moment to stop parsing
|
||||
HTML and read the response directly, the same idea covered in
|
||||
[capturing XHR and API responses](how-to-capture-xhr-api-responses-playwright.md).
|
||||
|
||||
## The boundary: any endpoint that re-checks the fingerprint rejects the httpx leg
|
||||
|
||||
Here is the sharp edge, and it is not negotiable. `httpx` carries the cookies but sends
|
||||
no browser fingerprint. It presents a plain TLS handshake and no JavaScript surface at
|
||||
all. So the handoff works on exactly one kind of endpoint: one that trusts the cookie and
|
||||
does not re-inspect the caller.
|
||||
|
||||
Plenty of endpoints are like that. A paginated data API behind a session cookie, a
|
||||
download URL, an internal JSON route the page itself calls - these usually check that you
|
||||
hold a valid session and nothing more. The `httpx` leg sails through.
|
||||
|
||||
But some endpoints re-run the check on every request. They read the TLS handshake, or
|
||||
require a token that only the site's JavaScript can mint, or expect a browser-shaped
|
||||
request signature alongside the cookie. Against those, the cookie is necessary but not
|
||||
sufficient, and the bare client is refused - often with a `403` or a challenge page
|
||||
where the browser got JSON. There is no client-side trick that gives `httpx` a browser
|
||||
handshake; if the endpoint re-checks the fingerprint, that endpoint stays in the browser.
|
||||
|
||||
The way you find the boundary is empirical and cheap: send one `httpx` request to the
|
||||
target endpoint with the exported cookies. If it returns the same body the browser got,
|
||||
that endpoint is safe to bulk. If it returns a challenge, an error, or a suspiciously
|
||||
short body, it is a re-checked endpoint and it belongs in the browser leg. Test one
|
||||
before you loop over a thousand.
|
||||
|
||||
## What this speeds up, and what it does not touch
|
||||
|
||||
The split is a cost optimization, not a stealth upgrade. It makes a workload cheaper by
|
||||
moving the unguarded requests off the browser. It does nothing for the four things that
|
||||
block sessions independently of the fingerprint, and moving traffic to `httpx` can make
|
||||
some of them worse if you are not careful:
|
||||
|
||||
- **IP reputation.** Route `httpx` through the same clean exit the browser used. If the
|
||||
bulk requests go out from your datacenter host directly while the browser used a
|
||||
residential proxy, you have split the session across two addresses, which is its own
|
||||
signal. Same exit for both legs.
|
||||
- **Rate limits and per-account quotas.** Two hundred requests in two seconds from one
|
||||
session is a velocity signal no fingerprint hides. Pace the `httpx` loop. The browser
|
||||
being invisible does not raise the account's quota.
|
||||
- **Timezone and locale consistency.** The session was created with a browser identity
|
||||
tied to the exit; keep the follow-up on the same exit so the story stays coherent, the
|
||||
same failure mode described in [timezone and proxy mismatch](timezone-proxy-mismatch.md).
|
||||
- **Behaviour on the guarded leg.** The browser still has to pass the guarded entry
|
||||
convincingly. The speed trick only applies after that door is open.
|
||||
|
||||
`invisible_playwright` gives you the browser that looks real. You supply the clean exit,
|
||||
the human pacing, and the judgement about which endpoints can leave the browser. The tool
|
||||
does one job well and is honest about the rest.
|
||||
|
||||
## Conclusion
|
||||
|
||||
The hybrid pattern is simple once the boundary is clear. The browser establishes the
|
||||
session because only a browser presents a real fingerprint and TLS handshake. You export
|
||||
`storage_state`, hand the cookies to `httpx`, and let the cheap client do the
|
||||
high-volume follow-up - but only against endpoints that trust the cookie and do not
|
||||
re-inspect the caller. The moment an endpoint re-checks the fingerprint, that request
|
||||
goes back into the browser, where the fingerprint lives. Test one request before you loop,
|
||||
keep both legs on the same clean exit, and pace the bulk. That is the whole method.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can I do all my scraping with httpx and skip the browser?** Only for endpoints that do
|
||||
not check a fingerprint. The browser exists to clear the ones that do; `httpx` has no
|
||||
fingerprint to present, so anything that re-checks one will refuse it.
|
||||
|
||||
**How do I move a logged-in session from the browser to httpx?** Call
|
||||
`page.context.storage_state()` while the browser is open, then set its cookies on an
|
||||
`httpx.Client`. The cookies carry the session; the handshake does not.
|
||||
|
||||
**Why does httpx get a 403 where the browser got JSON?** That endpoint re-checks the
|
||||
caller, not just the cookie. It reads the TLS handshake or wants a browser-minted token.
|
||||
Keep that request in the browser.
|
||||
|
||||
**Do I need the same proxy for both legs?** Yes. Split the session across two exit
|
||||
addresses and you have created a mismatch signal. Route `httpx` through the same exit the
|
||||
browser used.
|
||||
|
||||
**Does this make me undetectable?** No, and nothing does. It is a speed optimization. It
|
||||
does not fix IP reputation, account quotas, rate limits, or behaviour - you supply a
|
||||
clean exit and human pacing for those.
|
||||
|
||||
**How do I know which endpoints are safe to bulk?** Send one `httpx` request with the
|
||||
exported cookies and compare the body to what the browser got. Same body, safe to loop.
|
||||
Challenge or short body, keep it in the browser.
|
||||
|
||||
## Sources
|
||||
|
||||
- The real `invisible_playwright` API as documented in
|
||||
[Quickstart](quickstart.md) and [Configuration](configuration.md): the two-line launch,
|
||||
the reproducible seed, and the proxy dict both legs must share.
|
||||
- Playwright's own
|
||||
[`context.storage_state()`](https://playwright.dev/python/docs/api/class-browsercontext#browser-context-storage-state),
|
||||
which returns cookies and local storage as a plain dict, working exactly as documented
|
||||
upstream because the object handed back is a real Playwright `Browser`.
|
||||
- This project's own practice of testing one request against the boundary before looping,
|
||||
the same empirical habit the rest of these notes are built on.
|
||||
|
||||
**See also:** [why reusing a session beats re-automating the login](automating-login-vs-session-reuse.md)
|
||||
and [how to capture XHR and API responses](how-to-capture-xhr-api-responses-playwright.md)
|
||||
for reading the JSON the page already fetches.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The browser is for the
|
||||
fingerprint-gated fetches, httpx is for the unguarded bulk, and telling them apart is the
|
||||
whole job.*
|
||||
@@ -0,0 +1,68 @@
|
||||
---
|
||||
title: "Comparisons"
|
||||
description: "invisible_playwright against the closest alternatives at each layer - Camoufox, Patchright, nodriver, playwright-stealth - plus the engine question underneath all of them: Firefox or Chromium."
|
||||
has_children: true
|
||||
nav_order: 4
|
||||
---
|
||||
|
||||
# Comparisons
|
||||
|
||||
Most comparisons in this space put tools side by side that are not actually
|
||||
comparable: a page-level script against a patched binary, a Chromium tool against a
|
||||
Firefox one. These pages try not to do that. Each one names the layer the comparison
|
||||
actually happens at, states plainly where the other tool covers more, and does not
|
||||
claim an advantage it could not verify against the other project's own source or
|
||||
documentation.
|
||||
|
||||
Start with [Three ways to make Playwright undetected](playwright-stealth-levels.md)
|
||||
if you want the map before the individual matchups - it's the frame every comparison
|
||||
below sits inside.
|
||||
|
||||
## Concepts and the map
|
||||
|
||||
- [Three ways to make Playwright undetected](playwright-stealth-levels.md) - The three levels stealth tools work at - page, driver, engine - and what each reaches.
|
||||
- [Firefox or Chromium for anti-detect automation](firefox-vs-chromium-antidetect.md) - No CDP surface and one identity, traded against Firefox's smaller traffic share.
|
||||
- [Chromium is not Chrome, and detectors know the difference](chromium-is-not-chrome.md) - Chrome for Testing plays H.264 but fails a Widevine DRM check no patch closes.
|
||||
- [WebDriver BiDi vs CDP: does the new protocol hide you](bidi-vs-cdp-detection.md) - BiDi standardizes the control wire, but automation leaks live in the page, not the protocol.
|
||||
- [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.
|
||||
|
||||
## Patched-engine, driver-patch and stealth-plugin tools
|
||||
|
||||
- [invisible_playwright vs Camoufox: two patched Firefoxes](vs-camoufox.md) - Both patch Firefox in C++; how each builds its fingerprint and whether a run replays.
|
||||
- [invisible_playwright vs Patchright: driver vs engine](vs-patchright.md) - Patchright patches the Playwright driver on Chromium; this patches Firefox itself. Often you need both.
|
||||
- [invisible_playwright vs rebrowser-patches: the same CDP fix](vs-rebrowser-patches.md) - Fixes the Runtime.enable CDP leak on Chromium; reaches neither Firefox nor fonts, GPU, canvas, audio.
|
||||
- [undetected-playwright vs a patched Firefox binary](vs-undetected-playwright.md) - Hides Playwright's init-script and bindings tells; a patched Firefox closes the fingerprint layer.
|
||||
- [invisible_playwright vs playwright-stealth: page vs engine](vs-playwright-stealth.md) - playwright-stealth patches the page in about four lines; this rebuilds the engine.
|
||||
- [playwright-extra stealth plugins vs a patched browser](vs-playwright-extra-stealth.md) - Applies stealth plugins as injected JavaScript a detector reads back; a patched engine compiles them in.
|
||||
- [invisible_playwright vs fingerprint-suite: injection vs engine](vs-fingerprint-suite.md) - fingerprint-suite injects a generated fingerprint into a page; this sets it in the engine.
|
||||
- [invisible_playwright vs playwright-with-fingerprints](vs-playwright-with-fingerprints.md) - Injects remote-service fingerprints into a Windows-only, ageing Chromium build, and what that trade costs.
|
||||
- [puppeteer-real-browser vs invisible_playwright](vs-puppeteer-real-browser.md) - Node plus real Chrome with runtime property patches vs Python plus Firefox with compiled spoofs.
|
||||
|
||||
## CDP and driverless Chrome tools
|
||||
|
||||
- [invisible_playwright vs nodriver and undetected-chromedriver](vs-nodriver.md) - Chrome-only tools, not Playwright forks; neither hides IP or fingerprint, by their own docs.
|
||||
- [pydoll vs invisible_playwright: CDP without a driver](vs-pydoll.md) - pydoll drives Chrome over CDP with no chromedriver; this ships seed-consistent Firefox surfaces.
|
||||
- [zendriver vs invisible_playwright: Chrome CDP vs Firefox](vs-zendriver.md) - zendriver drives Chrome over CDP; this drives a patched Firefox with cross-checked surfaces.
|
||||
- [selenium-driverless vs invisible_playwright stealth](vs-selenium-driverless.md) - Drops chromedriver by driving Chrome over raw CDP but leaves rendering and TLS stock.
|
||||
- [invisible_playwright vs SeleniumBase UC Mode](vs-seleniumbase-uc-mode.md) - UC Mode detaches chromedriver but never changes the engine, GPU, fonts, canvas or TLS.
|
||||
- [undetected-chromedriver vs a patched Firefox browser](vs-undetected-chromedriver.md) - Strips the driver's cdc_ and webdriver leaks but ships a stock Chromium fingerprint.
|
||||
- [invisible_playwright vs Ulixee Hero](vs-ulixee-hero.md) - Replayed emulation on stock Chromium vs a fingerprint decided natively in patched Firefox.
|
||||
|
||||
## Non-Playwright frameworks and HTTP-client libraries
|
||||
|
||||
- [botasaurus vs invisible_playwright: framework vs library](vs-botasaurus.md) - Batteries-included Chrome scraping framework vs a patched-Firefox engine driven with stock Playwright.
|
||||
- [invisible_playwright vs Scrapling](vs-scrapling.md) - Scrapling is an adaptive parser, not a stealth engine; its ceiling is whichever browser it wraps.
|
||||
- [scrapy-playwright vs a patched Firefox for stealth](vs-scrapy-playwright.md) - Runs stock Playwright inside Scrapy; point the handler at a patched Firefox and keep the scheduler.
|
||||
- [invisible_playwright vs DrissionPage](vs-drission-page.md) - Fuses an HTTP session mode and a CDP browser mode, each failing a different check half.
|
||||
- [curl_cffi vs invisible_playwright: TLS client vs browser](vs-curl-cffi.md) - Replays a browser's TLS and HTTP/2 at byte level but runs no JavaScript.
|
||||
- [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.
|
||||
|
||||
## 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.
|
||||
- [pyppeteer's own maintainer says to switch to Playwright](pyppeteer-unmaintained-playwright.md) - Its README calls it unmaintained and points to playwright-python; what switching does not fix.
|
||||
- [selenium-stealth hasn't been updated since December 2021](selenium-stealth-unmaintained.md) - Last commit December 2021; what its property patches still do and what to check today.
|
||||
- [Splash is unmaintained, and it was never a real browser](splash-unmaintained-qtwebkit.md) - A QtWebKit render service reporting an engine no real browser ships, which no spoof reaches.
|
||||
@@ -0,0 +1,199 @@
|
||||
---
|
||||
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."
|
||||
parent: "AI Agents and Frameworks"
|
||||
grand_parent: "Guides"
|
||||
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 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.
|
||||
|
||||
## Why the driver flags stop mattering
|
||||
|
||||
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`, 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`, 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-browser-agents-stealth.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 Computer-Using Agent and Anthropic's computer-use tool, 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:** [AI browser agents and stealth](ai-browser-agents-stealth.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.*
|
||||
@@ -0,0 +1,139 @@
|
||||
---
|
||||
title: "Configuration"
|
||||
description: "Proxy schemes, DNS handling, and timezone auto-derived from egress IP. Every environment variable the wrapper reads, what each does, and when you need it."
|
||||
parent: "Documentation"
|
||||
nav_order: 3
|
||||
---
|
||||
|
||||
|
||||
# Configuration
|
||||
|
||||
Configuration covers three independent surfaces: proxy schemes and credentials, how
|
||||
the browser's timezone is derived from the egress IP, and the environment variables
|
||||
that change caching, binary selection and download behavior. None of it is required
|
||||
for a first run - `InvisiblePlaywright()` works with defaults - but each setting below
|
||||
exists because a specific situation needs it.
|
||||
|
||||
## Proxies
|
||||
|
||||
```python
|
||||
proxy = {
|
||||
"server": "socks5://gate.example.com:1080",
|
||||
"username": "user",
|
||||
"password": "pass",
|
||||
}
|
||||
with InvisiblePlaywright(proxy=proxy) as browser:
|
||||
...
|
||||
```
|
||||
|
||||
Schemes supported: `socks5`, `socks4`, `http`, `https`. DNS is routed through the
|
||||
proxy by default, no local leak - the SOCKS5-authentication and DNS-resolution
|
||||
details, including the parts most guides get wrong, are in
|
||||
[Playwright SOCKS5 proxy with authentication](playwright-socks5-proxy-authentication.md).
|
||||
The endpoint needs an explicit port. `socks5://gate.example.com` with no `:1080` is
|
||||
refused with a `ValueError` rather than launched unproxied, which is what it used to
|
||||
do silently. If you are driving `firefox.launch()` yourself instead of using this
|
||||
class, pass the same dict to `get_default_stealth_prefs(proxy=...)` so the SOCKS
|
||||
preferences are written.
|
||||
|
||||
Around 90% of proxies are public, so their IPs are already known and blocked before
|
||||
you ever use them. A perfect browser on a known IP still loses. For the clean 10%,
|
||||
residential IPs that aren't already known, we recommend
|
||||
[sx.org](https://sx.org/?c=invisible_playwright), who filter for and serve only IPs
|
||||
that aren't already on those lists.
|
||||
|
||||
## Timezone
|
||||
|
||||
The browser timezone follows `timezone=`:
|
||||
|
||||
```python
|
||||
# default: timezone is auto-derived from the egress IP (proxy egress if a
|
||||
# proxy is set, otherwise the host's own public IP)
|
||||
with InvisiblePlaywright(proxy=proxy) as browser:
|
||||
...
|
||||
|
||||
# explicit IANA zone always wins, the only way to force a specific zone
|
||||
with InvisiblePlaywright(proxy=proxy, timezone="America/New_York") as browser:
|
||||
...
|
||||
```
|
||||
|
||||
Timezone is not one value - it is several surfaces that a detector cross-checks
|
||||
against each other and against your exit IP, which is why
|
||||
[setting `timezone_id` and still getting flagged for a mismatch](timezone-proxy-mismatch.md)
|
||||
is common enough to have its own page.
|
||||
|
||||
## Environment variables
|
||||
|
||||
The engine downloads itself on first use, verifies a sha256 shipped inside
|
||||
`invisible-core`, and caches it - the size is on the [installation](installation.md)
|
||||
page and it happens once per engine version. None of these are a required step; each
|
||||
row is for a specific situation.
|
||||
|
||||
| Variable | When you need it |
|
||||
|---|---|
|
||||
| `INVISIBLE_PLAYWRIGHT_CACHE_DIR` | Put the cached engine somewhere else - another drive, a shared location, a path your CI already caches |
|
||||
| `INVPW_BINARY_PATH` | Point at a binary you already have, and skip the download |
|
||||
| `STEALTHFOX_GITHUB_TOKEN` | A rate-limited or corporate network that refuses anonymous GitHub downloads |
|
||||
| `INVISIBLE_PLAYWRIGHT_SKEW=allow` | Run a Playwright version outside the tested range anyway |
|
||||
| `INVPW_CURSOR_ENGINE` | `python` (default), `binary`, or `off` |
|
||||
| `INVISIBLE_DOWNLOAD_DEADLINE` | Seconds allowed for one engine download, default `1800`. Raise it on a very slow link; `0` removes the bound |
|
||||
|
||||
```bash
|
||||
export INVISIBLE_PLAYWRIGHT_CACHE_DIR=/mnt/big/engines
|
||||
```
|
||||
|
||||
### Why the download has a deadline at all
|
||||
|
||||
`requests` timeouts are per socket operation, not per transfer. A connection
|
||||
that delivers one byte every 59 seconds satisfies a 60-second timeout forever,
|
||||
so before `invisible-core` 18.13.0 the engine download had no upper limit: it
|
||||
could sit there as long as whatever was above it allowed. A CI job did exactly
|
||||
that for 39 minutes and was killed by its own limit; on a laptop the same thing
|
||||
is a launch that never returns and writes nothing to a log.
|
||||
|
||||
The bound is checked between chunks and the refusal names the deadline, how long
|
||||
it had been running and how many bytes arrived, so a genuinely slow link is
|
||||
distinguishable from a stalled one. The engine archives are 217 to 238 MB
|
||||
depending on platform, so the default finishes anything above roughly 140 KB/s.
|
||||
If your connection is honestly slower than that, raise the number rather than
|
||||
removing the bound - `0` is there for the case where you are downloading over
|
||||
something too unusual to put a number on, and it restores the old behaviour of
|
||||
waiting indefinitely.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What proxy schemes does invisible_playwright support?** `socks5`, `socks4`, `http`
|
||||
and `https`. DNS resolves through the proxy by default, and an endpoint given
|
||||
without an explicit port raises a `ValueError` instead of launching unproxied.
|
||||
|
||||
**How is the browser's timezone chosen?** By default it is derived from the egress
|
||||
IP - the proxy's exit if one is set, otherwise the host's own public IP. Pass an
|
||||
explicit IANA zone such as `timezone="America/New_York"` to override it; an explicit
|
||||
zone always wins.
|
||||
|
||||
**Do I need to set any environment variables to use invisible_playwright?** No. Every
|
||||
one in the table above addresses a specific situation - moving the cache directory,
|
||||
pointing at a binary you already have, a network that blocks anonymous downloads -
|
||||
and the defaults work without touching any of them.
|
||||
|
||||
**Why does the engine download have a deadline, and can I remove it?** Because a
|
||||
per-socket timeout does not bound a slow transfer: a connection delivering one byte
|
||||
every 59 seconds satisfies a 60-second timeout forever. The default of 1800 seconds
|
||||
covers any link above roughly 140 KB/s; set `INVISIBLE_DOWNLOAD_DEADLINE=0` to remove
|
||||
the bound entirely if your connection is genuinely slower than that.
|
||||
|
||||
**What happens if I pass a proxy server with no port?** The constructor raises a
|
||||
`ValueError` rather than launching the browser unproxied. That is a deliberate change
|
||||
from older behavior, which used to launch silently without the proxy.
|
||||
|
||||
**See also:** [Installation](installation.md) for the one-time engine download these
|
||||
environment variables configure, [Pinning fingerprint fields](pinning.md) for forcing
|
||||
specific values like GPU or screen size, and
|
||||
[Playwright SOCKS5 proxy with authentication](playwright-socks5-proxy-authentication.md)
|
||||
for the full detail behind the proxy schemes above.
|
||||
|
||||
## Next
|
||||
|
||||
[Pinning fingerprint fields](pinning.md) covers forcing specific values - a GPU
|
||||
model, a screen size, a hardware concurrency count - while leaving everything else
|
||||
seed-derived, and what breaks if you pin one field without its correlated neighbours.
|
||||
@@ -0,0 +1,193 @@
|
||||
---
|
||||
title: "crawl4ai stealth mode and custom browser engines"
|
||||
description: "crawl4ai accepts browser_type firefox but has no executable_path, so you get Playwright's managed build. Where the adapter seam is and what stealth misses."
|
||||
parent: "AI Agents and Frameworks"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 3
|
||||
---
|
||||
|
||||
|
||||
# crawl4ai stealth mode and custom browser engines
|
||||
|
||||
crawl4ai cannot launch a custom (patched) browser binary today, because its
|
||||
`BrowserConfig` has no `executable_path` field, so `browser_type="firefox"` always gets
|
||||
Playwright's own managed Firefox build. crawl4ai ships two anti-detection features and a
|
||||
browser abstraction, which makes it look like a patched engine should drop straight in.
|
||||
It does not, and the reason is that single missing field rather than an architectural one.
|
||||
|
||||
This page is what its configuration actually exposes, what its stealth mode reaches,
|
||||
where the adapter seam is, the workaround that works today, and the part that no
|
||||
configuration changes.
|
||||
|
||||
## What BrowserConfig exposes, and the field that is missing
|
||||
|
||||
`BrowserConfig` exposes the browser choice, headless mode, a user data directory, a proxy
|
||||
and extra arguments, but not the path to a binary. Read from
|
||||
`crawl4ai/async_configs.py`:
|
||||
|
||||
| Field | Default |
|
||||
|---|---|
|
||||
| `browser_type` | `"chromium"` |
|
||||
| `chrome_channel` / `channel` | `"chromium"` |
|
||||
| `headless` | `True` |
|
||||
| `user_data_dir` | `None` |
|
||||
| `proxy_config` | `None` |
|
||||
| `extra_args` | `None` |
|
||||
|
||||
`browser_type` genuinely accepts `"firefox"`, and Firefox is referenced throughout the
|
||||
project, so this is not a Chromium-only tool at the configuration level.
|
||||
|
||||
What is **not** there is `executable_path`. There is no field that says which binary to
|
||||
launch, so `browser_type="firefox"` gets you Playwright's own managed Firefox build and
|
||||
nothing else. A patched engine has no supported way in.
|
||||
|
||||
`extra_args` does not close the gap either: it passes command-line arguments to a browser
|
||||
that has already been chosen, not the choice of browser.
|
||||
|
||||
## What crawl4ai's stealth mode actually reaches
|
||||
|
||||
crawl4ai's stealth mode reaches only page-level JavaScript, and on Firefox it is largely
|
||||
inert because its evasion modules target Chromium APIs. There are two separate features
|
||||
here, and it is worth knowing which is which.
|
||||
|
||||
**Stealth mode** applies `playwright-stealth`, which is the page-level approach: scripts
|
||||
injected into the document that redefine properties before the page's own code runs.
|
||||
crawl4ai's own documentation is straight about the limitation, and it is the same one
|
||||
that library states itself: **the evasion modules target Chromium APIs and do not support
|
||||
Firefox or WebKit.**
|
||||
|
||||
So on `browser_type="firefox"` the stealth layer is largely inert, which is a genuinely
|
||||
important thing to know before choosing that combination.
|
||||
|
||||
**The undetected browser adapter** is the heavier option, aimed at sites that look at
|
||||
more than `navigator.webdriver`.
|
||||
|
||||
Both operate above the browser.
|
||||
[The three levels page](playwright-stealth-levels.md) explains what that layer can and
|
||||
cannot reach; the short version is that everything the machine reports about itself is
|
||||
untouched by either.
|
||||
|
||||
## Where the seam actually is
|
||||
|
||||
The extension point exists and it is not `BrowserConfig`. It is on the crawler strategy:
|
||||
|
||||
```python
|
||||
undetected_adapter = UndetectedAdapter()
|
||||
crawler_strategy = AsyncPlaywrightCrawlerStrategy(
|
||||
browser_config=browser_config,
|
||||
browser_adapter=undetected_adapter,
|
||||
)
|
||||
```
|
||||
|
||||
`browser_adapter` takes an adapter object, and the project ships `PlaywrightAdapter` and
|
||||
`UndetectedAdapter`. The documentation describes the pattern as allowing switching
|
||||
between browser implementations, and then gives no guidance on writing your own.
|
||||
|
||||
That is where a different engine would belong: an adapter that owns the launch and hands
|
||||
back a browser, which is exactly the shape
|
||||
[scrapy-playwright's browser provider takes](integrations/scrapy-playwright.md) and the
|
||||
reason that integration is clean. Here the seam is present but undocumented, so anything
|
||||
built on it is building against a private interface.
|
||||
|
||||
**The one-field change that would fix it properly** is `executable_path` on
|
||||
`BrowserConfig`, passed through to `launch()`. That is a small, well-scoped upstream
|
||||
change, and until it exists there is no supported route.
|
||||
|
||||
## The workaround that works today, with its cost
|
||||
|
||||
Playwright resolves its managed browsers from a directory, and that directory is
|
||||
configurable through [`PLAYWRIGHT_BROWSERS_PATH`](https://playwright.dev/docs/browsers#managing-browser-binaries).
|
||||
Put a build where Playwright expects to find one, and `p.firefox.launch()` uses it, with
|
||||
no crawl4ai change at all.
|
||||
|
||||
Be clear-eyed about what that is:
|
||||
|
||||
- It depends on Playwright's internal directory layout, which is version-stamped and not
|
||||
a public contract.
|
||||
- It applies process-wide, so everything else in that process gets the substituted
|
||||
browser too.
|
||||
- It will break on a Playwright upgrade, silently, by falling back to the managed build.
|
||||
|
||||
It works, and it is a workaround rather than an integration. If you use it, pin your
|
||||
Playwright version and check the engine at runtime rather than assuming.
|
||||
|
||||
```python
|
||||
# after launch, confirm you got the engine you meant to get
|
||||
ua = await page.evaluate("() => navigator.userAgent")
|
||||
```
|
||||
|
||||
## What no configuration changes
|
||||
|
||||
Everything the machine reports, which on a server is a consistent set of answers all
|
||||
saying the same thing:
|
||||
|
||||
- **No GPU**, so WebGL reports a software renderer.
|
||||
[What those strings mean](webgl-renderer-strings.md).
|
||||
- **A container font set** under whatever platform you claim.
|
||||
[Why more fonts is not the fix](headless-fonts-differ.md).
|
||||
- **No audio device**, and no speech voices.
|
||||
[The audio values](audiocontext-fingerprinting.md) and
|
||||
[the voice list](speech-synthesis-voices.md).
|
||||
- **A screen with no taskbar.**
|
||||
[The relationships that have to hold](screen-size-headless-tells.md).
|
||||
- **The TLS handshake**, decided before any page-level layer exists.
|
||||
[Which nothing in JavaScript can reach](ja3-ja4-tls-fingerprint.md).
|
||||
|
||||
If crawl4ai works on your laptop and fails in a container, this list is where to look
|
||||
first, and no stealth setting in the library addresses any of it.
|
||||
[The container walkthrough](playwright-docker-detection.md) goes through it in order.
|
||||
|
||||
## Conclusion
|
||||
|
||||
crawl4ai is closer to supporting a patched engine than most tools its size: it already
|
||||
abstracts the browser behind an adapter and already accepts Firefox as a browser type.
|
||||
What it lacks is the one field that says which binary to run.
|
||||
|
||||
Until that exists, the honest options are a private adapter, a process-wide directory
|
||||
substitution with the caveats above, or accepting the managed build and spending the
|
||||
effort on the machine instead, which is where most container-based failures actually
|
||||
originate.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does crawl4ai support a custom browser binary?** Not through `BrowserConfig`. There is
|
||||
no `executable_path` field.
|
||||
|
||||
**Can crawl4ai use Firefox?** Yes, `browser_type="firefox"`, with Playwright's own
|
||||
managed build.
|
||||
|
||||
**Does crawl4ai's stealth mode work with Firefox?** Largely not. It applies
|
||||
`playwright-stealth`, whose evasion modules target Chromium APIs.
|
||||
|
||||
**What is the undetected browser adapter?** A heavier built-in adapter aimed at stronger
|
||||
detection, passed as `browser_adapter` to the crawler strategy. It still operates above
|
||||
the browser.
|
||||
|
||||
**Why does crawl4ai work locally and fail in Docker?** Because the container answers
|
||||
differently about the machine, and none of the library's settings change that.
|
||||
|
||||
**Is there any way to use a patched engine today?** A process-wide
|
||||
`PLAYWRIGHT_BROWSERS_PATH` substitution, with the fragility described above, or a custom
|
||||
adapter written against an undocumented interface.
|
||||
|
||||
**See also:** [three ways to make Playwright undetected](playwright-stealth-levels.md),
|
||||
for what the page level can reach,
|
||||
[scrapy-playwright](integrations/scrapy-playwright.md), for what a documented provider
|
||||
seam looks like, and
|
||||
[Playwright in Docker](playwright-docker-detection.md).
|
||||
|
||||
## Sources
|
||||
|
||||
- `crawl4ai/async_configs.py`, for the `BrowserConfig` fields listed above, read
|
||||
2026-07-27.
|
||||
- crawl4ai's own documentation for stealth mode and the undetected browser adapter,
|
||||
including its statement that the underlying evasion modules do not support Firefox.
|
||||
- Playwright's own [browser-management
|
||||
documentation](https://playwright.dev/docs/browsers#managing-browser-binaries), for
|
||||
the `PLAYWRIGHT_BROWSERS_PATH` behaviour the workaround depends on.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. We would rather document the missing field than
|
||||
publish an integration guide for a seam that is not there.*
|
||||
@@ -0,0 +1,151 @@
|
||||
---
|
||||
title: "How CreepJS decides you are lying"
|
||||
description: "CreepJS asks whether a browser is telling the truth, not just what it reports. Read from its own source: how it detects a lie and why spoofing scores worse."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 2
|
||||
---
|
||||
|
||||
|
||||
# How CreepJS decides you are lying
|
||||
|
||||
Most fingerprinting tests ask what your browser reports. CreepJS mostly asks whether
|
||||
your browser is *telling the truth*, which is a different question and a much harder
|
||||
one to pass by spoofing.
|
||||
|
||||
Read from the source on 2026-07-27 ([`abrahamjuliot/creepjs`](https://github.com/abrahamjuliot/creepjs),
|
||||
`src/lies/index.ts` and the module layout) and not from the rendered page, because
|
||||
the interesting part is the method instead of the numbers it prints.
|
||||
|
||||
## The shape of it
|
||||
|
||||
The project is organised into modules that map onto surfaces: `canvas`, `webgl`,
|
||||
`audio`, `fonts`, `screen`, `timezone`, `intl`, `media`, `speech`, `webrtc`,
|
||||
`navigator`, `window`, `worker`, `css`, `cssmedia`, `svg`, `domrect`, `math`,
|
||||
`engine`, `features`.
|
||||
|
||||
Then there are four that are not surfaces at all, and they are the point:
|
||||
|
||||
- **`lies`**, which detects tampering.
|
||||
- **`trash`**, which collects values that are junk or impossible.
|
||||
- **`errors`**, which records what threw when it should not have.
|
||||
- **`resistance`**, which identifies privacy tooling, including Firefox's own
|
||||
`resistFingerprinting` mode.
|
||||
|
||||
A high score is not "your fingerprint is rare". It is "nothing here contradicts
|
||||
anything else here, and nothing looks tampered with".
|
||||
|
||||
## How it finds tampering
|
||||
|
||||
Four techniques, all visible in `src/lies/index.ts`.
|
||||
|
||||
**A pristine reference.** It creates fresh iframes and reaches into
|
||||
[`contentWindow`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/contentWindow)
|
||||
to get a copy of the built-ins that your page-level patches never
|
||||
touched, because the patch ran in the parent document. Then it compares. This is the
|
||||
single most effective move against injected stealth scripts, and it is about fifteen
|
||||
lines of code.
|
||||
|
||||
**Stack-trace inspection.** It matches against `/at Function\.toString /` and
|
||||
`/at Object\.toString/`. When you replace a native function and then patch
|
||||
[`Function.prototype.toString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/toString)
|
||||
to hide it, the way your replacement is called leaves a
|
||||
different frame in the stack than a genuine native call would. The disguise is
|
||||
detected by how the disguise itself behaves.
|
||||
|
||||
**Descriptor and prototype walking.** For each API it takes
|
||||
[`Object.getOwnPropertyDescriptor(proto, name)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor),
|
||||
checks whether `descriptor.value` is
|
||||
unexpectedly `undefined`, pulls the getter out, and compares
|
||||
[`Object.getPrototypeOf(apiFunction)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf)
|
||||
against the native prototype. An override moved
|
||||
from the prototype to the instance, or a getter that is a plain function rather than
|
||||
a native one, shows up here without any cleverness.
|
||||
|
||||
**Blocking the probe is itself recorded.** Among the lie names in the source are
|
||||
`client blocked phantom iframe` and `client blocked behemoth iframe`. If your
|
||||
environment prevents CreepJS from creating its reference iframes, that prevention is
|
||||
written down as a lie.
|
||||
|
||||
That last one is the principle worth taking away, and it generalises far beyond this
|
||||
tool: **suppressing a signal is a signal**. A browser that refuses to answer is not
|
||||
quieter than one that answers plainly, it is louder, because refusing is rare and
|
||||
answering is universal.
|
||||
|
||||
## Why uniform spoofing scores badly
|
||||
|
||||
Consider the two ways people try to pass this.
|
||||
|
||||
**Override everything from JavaScript.** Every override is a candidate for all four
|
||||
techniques above. The more surfaces you patch, the more lie records you generate, and
|
||||
a page with many detected lies scores worse than one with an unusual but honest
|
||||
fingerprint. Effort spent hiding actively hurts.
|
||||
|
||||
**Turn on maximum privacy protection.** The `resistance` module exists precisely to
|
||||
identify this. Firefox's `resistFingerprinting` produces a recognisable pattern, and
|
||||
being identified as a privacy-tool user is its own classification.
|
||||
[There is a longer page on why that is the wrong tool for automation](resist-fingerprinting.md).
|
||||
|
||||
There is a third option that scores well and is much more work: do not lie in
|
||||
JavaScript at all. If a value is decided below the JavaScript layer, in the engine,
|
||||
then there is no override to find, no prototype moved, no `toString` to hide, and no
|
||||
difference between what the page sees and what a fresh iframe sees. The lie detector
|
||||
finds nothing because nothing lied.
|
||||
|
||||
That is not a claim about any particular tool being undetectable. It is a claim about
|
||||
where the detection pressure lands: on the seam between the patch and the runtime.
|
||||
Remove the seam and this whole category of check has nothing to bite on. Everything
|
||||
else, the plausibility of your GPU, your fonts, your timezone against your IP,
|
||||
remains exactly as hard as it was.
|
||||
|
||||
## What one real, unmodified session actually scored
|
||||
|
||||
Run directly against a live Playwright-driven Chromium session with no stealth
|
||||
layer of any kind applied - no injected patches, no engine-level work, nothing
|
||||
this project or any comparable tool does. CreepJS's own headless module returned
|
||||
0% headless and 0% stealth, with a 25% "like headless" partial-similarity score
|
||||
alongside them. Worth stating plainly what that does and does not mean: it says
|
||||
this one specific, directly-checked session did not trip CreepJS's headless
|
||||
heuristics that day, not that headless or automation detection in general is
|
||||
solved, and not that every Playwright launch configuration scores the same way.
|
||||
The rest of the report - the parts covered throughout this page, the lie
|
||||
detection, the consistency checks, the machine-level surfaces - is where the
|
||||
actual work happens regardless of what this one narrow module reports.
|
||||
|
||||
## Reading your own report
|
||||
|
||||
Two things worth doing when you open it:
|
||||
|
||||
1. **Read the lies section before the score.** A number tells you where you landed.
|
||||
The lie list tells you what to fix, and it names the API.
|
||||
2. **Compare the same session twice, and two sessions with the same configuration.**
|
||||
Consistency across a reload and across a fresh launch is what a real browser has.
|
||||
If your fingerprint moves between reloads, something is adding noise per call
|
||||
rather than per identity, and that is its own signature.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What does the CreepJS score actually mean?** Not "your fingerprint is rare". It means
|
||||
nothing here contradicts anything else here, and nothing looks tampered with.
|
||||
|
||||
**Why does it detect my stealth plugin?** Four ways, and each is cheap: a pristine copy
|
||||
of the built-ins from a fresh iframe, stack-trace inspection, descriptor and prototype
|
||||
walking, and recording a blocked probe as a lie.
|
||||
|
||||
**Should I block CreepJS from creating its iframes?** No. Blocking is written down as a
|
||||
lie, by name, in its source. Suppressing a signal is a signal.
|
||||
|
||||
**Why does more patching score worse?** Because every override is another candidate for
|
||||
those four techniques. A page with many detected lies scores worse than one with an
|
||||
unusual but honest fingerprint.
|
||||
|
||||
**What passes it?** Not lying in JavaScript at all. If the value is decided below the
|
||||
JavaScript layer there is no override to find and no seam to detect.
|
||||
|
||||
**See also:** [what sannysoft checks](sannysoft-explained.md), whose canvas-in-iframe test is the same idea in miniature, [the three levels](playwright-stealth-levels.md), and [AudioContext fingerprinting](audiocontext-fingerprinting.md), where its silent-buffer check is worked through in detail.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright).
|
||||
CreepJS is a release gate here. The lie names above are quoted from its source and
|
||||
not paraphrased, because the exact strings are what you will see in a report.*
|
||||
@@ -0,0 +1,144 @@
|
||||
---
|
||||
title: "Why content_frame() returns None for a cross-origin iframe"
|
||||
description: "content_frame() returns None on a cross-origin iframe, frame.evaluate() throws, frame_locator times out - one shared cause: process isolation, not a permissions bug."
|
||||
parent: "The Automation Layer"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 9
|
||||
---
|
||||
|
||||
# Why content_frame() returns None for a cross-origin iframe
|
||||
|
||||
`content_frame()` returns `None` for a cross-origin iframe when Firefox's
|
||||
site-isolation feature puts that iframe in a separate OS process: the automation
|
||||
driver's frame tree holds only an empty placeholder for it, so there is no real frame
|
||||
reference to hand back. It is not a permissions bug, and the same single cause is why
|
||||
`frame.evaluate()` throws and `frame_locator` times out on the same iframe.
|
||||
|
||||
That cluster of symptoms all lands on the same page, all against the same cross-origin
|
||||
iframe: [`element_handle.content_frame()`](https://playwright.dev/python/docs/api/class-elementhandle)
|
||||
returns `None`, [`frame.evaluate()`](https://playwright.dev/python/docs/api/class-frame)
|
||||
throws a permission error naming a cross-origin object, and
|
||||
[`frame_locator(...).click()`](https://playwright.dev/python/docs/api/class-framelocator)
|
||||
times out with `force=True` changing nothing. Disabling JavaScript works around it and
|
||||
defeats the point of automating the page at all.
|
||||
|
||||
These read like three unrelated bugs. They are one bug, and it isn't a permissions
|
||||
problem. If the iframe you are after is same-origin instead, none of this applies and
|
||||
[scraping it is a short job with `frame_locator`](how-to-scrape-iframe-content-playwright.md).
|
||||
|
||||
## What's actually different about that iframe
|
||||
|
||||
The common thread is that the iframe is cross-origin from the page embedding it -
|
||||
the shape a third-party widget almost always has: a consent banner, a payment form, a
|
||||
support chat, anything served from a different domain than the page around it.
|
||||
|
||||
Firefox's site-isolation feature can put a cross-origin iframe in an entirely
|
||||
separate OS process from the page that embeds it, as a security boundary between
|
||||
origins. That boundary is exactly right for security and exactly wrong for an
|
||||
automation driver that assumed it could reach into every frame from one process.
|
||||
|
||||
## Why the driver's own frame tracking breaks
|
||||
|
||||
The frame tracking breaks because it is built from a single process while the iframe
|
||||
lives in another. Playwright drives Firefox through
|
||||
[Juggler, an internal automation protocol](playwright-protocol-drift.md), which keeps
|
||||
a tree of every frame on the page so `page.frames`, `content_frame()` and friends can
|
||||
find them. That tree is built and maintained from the parent process.
|
||||
|
||||
When the iframe's browsing context lives in a different, isolated process, the
|
||||
parent-side frame tree registers a placeholder for it instead of the real thing: no
|
||||
URL, no docShell reference, no execution context that actually wraps the iframe's
|
||||
global object. Every one of the three failing operations needs exactly the piece
|
||||
that placeholder doesn't have, which is why fixing one never fixed the others - they
|
||||
were never three separate problems to fix.
|
||||
|
||||
## Why this is easy to misdiagnose the first time
|
||||
|
||||
The first fix attempt targeted the wrong layer entirely, and it's worth walking
|
||||
through why, because the failure mode generalises.
|
||||
|
||||
The instinct was to wrap the suspect property read in a try/catch, on the theory that
|
||||
a security exception was firing and needed handling. It wasn't. The property in
|
||||
question simply isn't exposed to page-level script at all, so reading it from that
|
||||
scope returns `undefined` rather than throwing - there was never an exception to
|
||||
catch, and the code silently did nothing.
|
||||
|
||||
A second attempt tried comparing two identifiers to detect the isolated case
|
||||
directly. Both sides of that comparison turned out to be unreachable from the
|
||||
context the check ran in, so the comparison was comparing two things that were
|
||||
always going to be equal (or always going to be absent) regardless of whether the
|
||||
real bug was present.
|
||||
|
||||
Neither fix was tested against a reproduction that failed on the broken binary and
|
||||
passed on a fixed one - both were committed on the strength of a plausible-sounding
|
||||
theory. [The general version of that mistake, and the discipline that catches it,](how-to-test-bot-detection.md)
|
||||
is worth reading before trusting your own first hypothesis on a bug like this one.
|
||||
|
||||
## The actual fix, and why it's a single preference
|
||||
|
||||
The fix is a single preference forcing the non-isolating strategy, so every
|
||||
cross-origin iframe loads into the same process as the page around it instead of a
|
||||
separate one. That is a real trade: the security boundary the isolating strategy adds
|
||||
is gone, in exchange for an automation driver whose frame tree actually reaches every
|
||||
frame on the page. For a stealth-automation engine that already assumes a fully
|
||||
trusted, single-purpose session, that trade is the right one; it would not be for a
|
||||
general-purpose browser handling untrusted content by default.
|
||||
|
||||
Once the site-isolation strategy was identified as the actual variable, confirming it
|
||||
took one controlled comparison: the same URL, loaded once with the isolating strategy
|
||||
active and once with it set to keep same-process handling for every origin. Four
|
||||
frame-tree entries with empty URLs and no reachable content frame in the first case;
|
||||
five entries with full URLs and a working `content_frame()` in the second. The
|
||||
strategy setting was the only thing that differed between the two runs.
|
||||
|
||||
## What to check in your own setup
|
||||
|
||||
```python
|
||||
frames = page.frames
|
||||
for f in frames:
|
||||
print(f.url or "(empty - possibly isolated)", f.name)
|
||||
```
|
||||
|
||||
An entry with an empty URL and no name, sitting where a real iframe should be, is the
|
||||
shape of this exact problem. Confirm it by toggling Firefox's site-isolation strategy
|
||||
preference and re-running the same check: if the empty entry gains a real URL, that
|
||||
preference is the cause, not a permissions or timing issue anywhere in your own code.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Why does `content_frame()` return `None` for an iframe that clearly has content?**
|
||||
The iframe's browsing context is very likely running in a separate, isolated process,
|
||||
and the driver's frame tree only has a placeholder for it rather than the real
|
||||
reference.
|
||||
|
||||
**Why does `frame.evaluate()` throw a cross-origin permission error here specifically?**
|
||||
Same root cause. The evaluation target the driver is trying to reach isn't actually
|
||||
wired to the real execution context.
|
||||
|
||||
**Does `force=True` fix a `frame_locator` timeout on a cross-origin iframe?** No,
|
||||
because the element genuinely isn't reachable through the frame tree the driver is
|
||||
using; forcing the click doesn't change what frame tree exists.
|
||||
|
||||
**Is this a permissions bug?** No. Nothing was denied in the security sense; the
|
||||
property being read simply isn't exposed to the scope trying to read it, and the
|
||||
underlying frame reference the driver needs was never populated in the first place.
|
||||
|
||||
**See also:** [why an attached debugger makes automation detectable](debugger-timing-detection.md),
|
||||
for another case where the automation layer itself was the actual surface; and
|
||||
[how to test whether your setup is actually working](how-to-test-bot-detection.md),
|
||||
for the reproduction discipline that caught the two wrong fixes here.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's own patch history for the root-cause diagnosis, the two earlier
|
||||
incorrect fixes and why each one failed to address anything, the single-preference
|
||||
fix, and the regression test suite that locks the fixed behaviour in.
|
||||
- Playwright's own API reference for the three calls involved: [`ElementHandle.content_frame`](https://playwright.dev/python/docs/api/class-elementhandle),
|
||||
[`Frame.evaluate`](https://playwright.dev/python/docs/api/class-frame), and
|
||||
[`FrameLocator`](https://playwright.dev/python/docs/api/class-framelocator).
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level, on a bug that took two wrong committed fixes before
|
||||
the actual cause was reproduced.*
|
||||
@@ -0,0 +1,228 @@
|
||||
---
|
||||
title: "CSS fingerprinting: what media queries reveal"
|
||||
description: "Media queries and CSS system colours fingerprint a machine with no JavaScript, beyond page-level stealth. What they expose, and the two consistency traps."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 9
|
||||
---
|
||||
|
||||
|
||||
# CSS fingerprinting: what media queries reveal
|
||||
|
||||
**CSS fingerprinting identifies a machine using only stylesheet media queries and system
|
||||
colours, with no JavaScript at all.** Media queries reveal the pointer type, the
|
||||
operating-system dark-mode setting, display resolution and colour gamut, the screen size,
|
||||
and accessibility preferences; CSS system colours reveal the operating system itself. Each
|
||||
is read by loading a different resource per branch, so the server learns the answer from
|
||||
which request arrives.
|
||||
|
||||
Almost everything written about [what a browser fingerprint is](what-is-a-browser-fingerprint.md)
|
||||
assumes JavaScript. Disable it, block it, patch it, and the discussion is about what a
|
||||
script can read.
|
||||
|
||||
CSS does not need a script. A stylesheet can ask what kind of pointer you have, whether
|
||||
your system is in dark mode, how many colours your display shows, and how large it is,
|
||||
and it can report the answer by loading a different background image per branch. No
|
||||
JavaScript runs, so **no page-level stealth layer is involved at all**.
|
||||
|
||||
This page covers what the features expose, the two places where CSS and JavaScript can
|
||||
disagree about the same machine, the system-colour surface almost nobody knows about,
|
||||
and what a consistent answer looks like.
|
||||
|
||||
## How a stylesheet exfiltrates without a script
|
||||
|
||||
**A stylesheet exfiltrates data with no JavaScript at all by loading a different image
|
||||
per media-query branch, so the browser that requests one image rather than another has
|
||||
answered the query.** The pattern is a few lines of CSS and has been known for years:
|
||||
|
||||
```css
|
||||
@media (pointer: fine) { body { background-image: url("/p?fine"); } }
|
||||
@media (pointer: coarse) { body { background-image: url("/p?coarse"); } }
|
||||
@media (prefers-color-scheme: dark) { body { border-image: url("/c?dark"); } }
|
||||
```
|
||||
|
||||
Only the matching branch loads its image, so the server learns the answer from which
|
||||
request arrives. Repeat across a dozen features and you have a fingerprint assembled
|
||||
entirely from network requests.
|
||||
|
||||
Two consequences worth being explicit about:
|
||||
|
||||
- **Blocking or patching JavaScript does nothing here.** There is no function to
|
||||
override and no object to inspect.
|
||||
- **It works on the first paint**, before any script you inject has a chance to run,
|
||||
which sidesteps the timing problem that
|
||||
[page-level patches have anyway](navigator-webdriver-explained.md).
|
||||
|
||||
Estimates of how much entropy this reaches vary, and the useful number is not the total.
|
||||
It is that these values are *free* to collect and are rarely part of anyone's checklist.
|
||||
|
||||
## The media features that actually carry information
|
||||
|
||||
Not every media feature carries useful entropy. The ones that identify a machine fall into
|
||||
five groups: pointer and hover capabilities, colour scheme, display characteristics,
|
||||
accessibility preferences, and size.
|
||||
|
||||
| Media feature | What it reveals |
|
||||
|---|---|
|
||||
| `pointer`, `any-pointer`, `hover`, `any-hover` | Input devices: mouse vs touch, and whether the device has both |
|
||||
| `prefers-color-scheme` | OS dark-mode setting, close to a coin flip across real users |
|
||||
| `resolution`, `color-gamut` | Display panel class (`p3` marks a modern, wide-gamut display) |
|
||||
| `prefers-reduced-motion`, `prefers-contrast`, `forced-colors`, `inverted-colors` | Accessibility preferences; a non-default value is rare and identifying |
|
||||
| `width`, `height`, `device-width`, `device-height` | Screen and viewport size, and the CSS/JavaScript consistency trap below |
|
||||
|
||||
**Pointer and hover.**
|
||||
[`pointer`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/pointer),
|
||||
`any-pointer`, `hover`, `any-hover`. A desktop with a
|
||||
mouse reports `fine` and `hover`. A phone reports `coarse` and `none`. A touchscreen
|
||||
laptop reports both, through the `any-` variants, which is how a device with two input
|
||||
methods is distinguished from one with a single method.
|
||||
|
||||
**Colour scheme.**
|
||||
[`prefers-color-scheme`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme)
|
||||
is the operating system's dark mode setting,
|
||||
and it is close to a coin flip across real users, so it is a genuine bit rather than a
|
||||
constant.
|
||||
|
||||
**Display characteristics.** `resolution` and `color-gamut` describe the panel.
|
||||
`color-gamut: p3` says a modern, better-than-average display; see
|
||||
[color-gamut as a display fingerprint](color-gamut-hdr-media-query-fingerprint.md) for how
|
||||
that one media query alone narrows the field.
|
||||
|
||||
**Accessibility preferences.** `prefers-reduced-motion`, `prefers-contrast`,
|
||||
`forced-colors`, `inverted-colors`. Almost everyone leaves these at the default, which
|
||||
is exactly why a non-default value is informative: it is rare.
|
||||
|
||||
**Size.** `width`, `height`, `device-width`, `device-height`, and the interaction with
|
||||
`resolution`. Which brings us to the trap.
|
||||
|
||||
## Trap one: CSS and JavaScript can disagree about the screen
|
||||
|
||||
**In Firefox, the size a media query resolves against and the size `screen.width`
|
||||
reports come from different code inside the browser** - two separate paths to the same
|
||||
physical fact. Patch only the JavaScript side and the two disagree about the same
|
||||
machine; this is a mistake specific to spoofing, and it is invisible unless you look
|
||||
for it directly.
|
||||
|
||||
Concretely, spoofing only the JavaScript side produces a browser where:
|
||||
|
||||
```js
|
||||
screen.width // 1920
|
||||
matchMedia('(device-width: 1920px)').matches // false, the real panel is something else
|
||||
```
|
||||
|
||||
One line of CSS and one line of JavaScript, and they disagree about the machine they are
|
||||
running on. That is not an unusual value, it is a contradiction, and contradictions are
|
||||
what the checks in this whole subject are built on.
|
||||
|
||||
The same applies to the pointer capabilities: a touchscreen laptop reporting `coarse` to
|
||||
CSS while the JavaScript side claims a desktop persona is the same class of mismatch.
|
||||
|
||||
This project handles both in the browser's own media-feature code, so the CSS device
|
||||
size comes from the same profile as `screen`, and the pointer capabilities report a
|
||||
mouse rather than whatever hardware the host happens to have.
|
||||
|
||||
### How to check it yourself
|
||||
|
||||
```js
|
||||
console.log(screen.width, screen.height);
|
||||
console.log(matchMedia(`(device-width: ${screen.width}px)`).matches); // want true
|
||||
console.log(matchMedia('(pointer: fine)').matches,
|
||||
matchMedia('(any-pointer: coarse)').matches);
|
||||
```
|
||||
|
||||
If the second line is `false`, something is spoofing one side only.
|
||||
|
||||
## Trap two: CSS system colours give away the operating system
|
||||
|
||||
**[CSS system colour keywords](https://developer.mozilla.org/en-US/docs/Web/CSS/system-color) -
|
||||
`ButtonFace`, `ButtonText`, `Canvas`, `CanvasText`, `Highlight`, `HighlightText`,
|
||||
`Menu`, `Field`, and a few dozen more - resolve to the operating system's own interface
|
||||
palette, readable with no permission and one function call.** This surface is
|
||||
genuinely obscure, and it is checked in production:
|
||||
|
||||
```js
|
||||
const d = document.createElement('div');
|
||||
d.style.color = 'ButtonText';
|
||||
d.style.backgroundColor = 'ButtonFace';
|
||||
document.body.appendChild(d);
|
||||
getComputedStyle(d).color; // an RGB triple from the OS theme
|
||||
```
|
||||
|
||||
Those values are the actual theme colours. On Windows they come from the Win32 palette.
|
||||
On Linux they resolve through the desktop theme, and the RGB values are different, even
|
||||
when the user agent says Windows.
|
||||
|
||||
So a browser claiming Windows and returning a Linux theme's palette has answered the
|
||||
platform question twice with two different answers, from a surface most people have
|
||||
never enumerated. A commercial fingerprinting service hashes exactly this set.
|
||||
|
||||
This project pins the full palette to the Windows default so it matches the claimed
|
||||
platform, with one exception worth knowing: when the persona is a dark-theme user, the
|
||||
palette is skipped and the dark-mode preference is set instead, because pinning a light
|
||||
palette onto a dark-mode profile would create the contradiction it exists to prevent.
|
||||
|
||||
## What a consistent CSS answer looks like
|
||||
|
||||
Working from all of the above:
|
||||
|
||||
- **Pointer and hover describe one plausible input device**, and agree between the
|
||||
`any-` variants and the plain ones.
|
||||
- **The CSS device size matches `screen`**, exactly.
|
||||
- **`prefers-color-scheme` matches the system-colour palette.** Dark mode with a light
|
||||
palette is a contradiction.
|
||||
- **Accessibility preferences are at their defaults** unless you have a reason, because
|
||||
non-default values are rare and therefore identifying.
|
||||
- **`color-gamut` and `resolution` suit the display you claim.**
|
||||
- **Everything is stable for the session.** A colour scheme that flips mid-session is a
|
||||
browser nobody has.
|
||||
|
||||
## Conclusion
|
||||
|
||||
CSS fingerprinting matters not because it is the strongest signal but because it is the
|
||||
one that operates below every layer people normally work at. There is no script to
|
||||
patch, so the values have to be right at the source or not at all.
|
||||
|
||||
The two traps are the practical takeaway. CSS and JavaScript reach the screen size by
|
||||
different routes inside the browser, and the system-colour palette is a platform tell
|
||||
sitting in plain sight, readable with one `getComputedStyle` call.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can a website fingerprint me with CSS alone?** Yes. Media queries can load different
|
||||
resources per branch, so the server learns the answer without any script running.
|
||||
|
||||
**Does blocking JavaScript stop CSS fingerprinting?** No. That is the point of it.
|
||||
|
||||
**What is `prefers-color-scheme` worth to a tracker?** Roughly one bit, and a reliable
|
||||
one, because real users are split between the two settings.
|
||||
|
||||
**Why would CSS and `screen.width` disagree?** Because the browser resolves them through
|
||||
different code, so spoofing one and not the other leaves them inconsistent.
|
||||
|
||||
**Are CSS system colours really used for fingerprinting?** Yes, by hashing the resolved
|
||||
values of the system keywords. They also reveal the operating system independently of
|
||||
the user agent.
|
||||
|
||||
**Should I set unusual accessibility preferences?** No. Almost everyone is at the
|
||||
default, so anything else narrows you down rather than hiding you.
|
||||
|
||||
**See also:** [screen size and viewport tells](screen-size-headless-tells.md), which is
|
||||
the JavaScript half of the size question,
|
||||
[why headless browsers render different fonts](headless-fonts-differ.md), another
|
||||
platform tell that no script controls, and
|
||||
[the checklist for being detected on one site](playwright-detected-as-bot.md).
|
||||
|
||||
## Sources
|
||||
|
||||
- MDN's [reference for the `@media` at-rule](https://developer.mozilla.org/en-US/docs/Web/CSS/@media)
|
||||
and the individual media features named above.
|
||||
- Published work on CSS-based fingerprinting, which is where the load-an-image-per-branch
|
||||
technique is described.
|
||||
- This project's own media-feature and system-colour handling, and the reason the palette
|
||||
is skipped for dark-theme personas.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. The system-colour palette is pinned here because a
|
||||
commercial detector was hashing it and catching the host operating system through it.*
|
||||
@@ -0,0 +1,200 @@
|
||||
---
|
||||
title: "Why an attached debugger makes automation detectable"
|
||||
description: "A fingerprinting service reported developer_tools true with no devtools open. The cause was the automation framework's attached debugger, four separate leaks."
|
||||
parent: "The Automation Layer"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 3
|
||||
---
|
||||
|
||||
|
||||
# Why an attached debugger makes automation detectable
|
||||
|
||||
An attached JavaScript debugger makes automation detectable because it measurably
|
||||
changes how fast the page runs, and that timing difference shows up even when every
|
||||
property on the page looks normal. **Attaching a debugger, which is how automation
|
||||
frameworks evaluate code and track execution, puts the JavaScript engine into debug
|
||||
mode - and debug mode is slower in ways a page can time.**
|
||||
|
||||
That is what caught us. A commercial fingerprinting service was reporting
|
||||
`developer_tools: true` on our sessions. No devtools window was open. Nothing was
|
||||
inspecting anything. The browser looked, by every property-level check we could run,
|
||||
completely normal. It was right anyway.
|
||||
|
||||
This page is what that means, the four separate leaks it turned out to be, and the one
|
||||
that mattered most, which had nothing to do with timing at all.
|
||||
|
||||
## The mechanism
|
||||
|
||||
Playwright drives Firefox through a component that needs to evaluate code in the page,
|
||||
track promises and manage execution contexts. The natural way to do that is the
|
||||
engine's own `Debugger` API. [The same frame-tracking machinery has its own separate
|
||||
failure mode against cross-origin iframes](cross-origin-iframe-unreachable.md), for a
|
||||
different reason than anything covered here.
|
||||
|
||||
Attaching one calls `setIsDebuggee()` on every realm it touches, and that flag is not
|
||||
cosmetic. It puts the JavaScript engine into debug mode:
|
||||
|
||||
- **The optimising JIT is disabled**, so JavaScript runs several times slower.
|
||||
- A slow path runs **on every native function call**.
|
||||
- A slow path runs **on every frame exit**.
|
||||
- A slow path runs **on every exception**.
|
||||
|
||||
None of that is visible as a property. There is no `navigator.isBeingDebugged`. But it
|
||||
is trivially visible as *time*.
|
||||
|
||||
Run 50,000 iterations of something and measure. A normal Firefox and a debug-mode
|
||||
Firefox produce different distributions, not just different totals, and a model trained
|
||||
on real browsers separates them easily. That is what the service was doing, and
|
||||
`developer_tools: true` was its conclusion.
|
||||
|
||||
**The general point, which is bigger than this bug:** [a browser fingerprint](what-is-a-browser-fingerprint.md)
|
||||
is not only the set of values a browser reports. It includes how the browser behaves, and performance is a
|
||||
behaviour. You can spoof every string on the page and still be running measurably
|
||||
differently from the thing you claim to be - [the same value-versus-output gap](renderer-string-vs-render.md)
|
||||
that cost us a WebGL renderer flag before it cost us this one.
|
||||
|
||||
## Fix one: attach without entering debug mode
|
||||
|
||||
The debugger does not actually need debug mode for what an automation driver uses it
|
||||
for. Evaluating code in a realm and holding references to values work without it; what
|
||||
needs it is stepping, breakpoints and the hooks that fire on every call.
|
||||
|
||||
So the engine gained a flag. When it is set, the realm is never marked as a debuggee:
|
||||
the JIT stays on, the slow paths stay off, and evaluation still works because that path
|
||||
never consulted the flag in the first place.
|
||||
|
||||
Result: `developer_tools: false`, on every session we measured afterwards.
|
||||
|
||||
## Fix two: the stack traces said too much
|
||||
|
||||
Two separate leaks, both readable from ordinary JavaScript by anyone who throws an
|
||||
error and reads [`Error.stack`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/stack).
|
||||
|
||||
**Frames belonging to the automation layer.** The driver's own code lived at
|
||||
`chrome://juggler/...`, and when the stack was built those frames were in it. A page
|
||||
that captures a stack sees frames from a source no ordinary browsing produces. The fix
|
||||
is to skip frames whose source belongs to the automation layer while the stack string is
|
||||
built.
|
||||
|
||||
**The name of evaluated code.** When the driver evaluated something, the engine labelled
|
||||
it `debugger eval code`, with an introduction type of `debugger eval`. Both strings are
|
||||
visible in stacks. They now say `eval code` and `eval`, which is what ordinary
|
||||
evaluation is called.
|
||||
|
||||
Neither of these needs a fingerprinting library. `try { null.f() } catch (e) { e.stack }`
|
||||
is the whole technique.
|
||||
|
||||
## Fix three: attached but invisible
|
||||
|
||||
Even with debug mode skipped, the debugger was still being registered in the realm's
|
||||
internal list of debuggers, which meant `hasDebuggers()` was true.
|
||||
|
||||
That state is not readable from JavaScript. It did, however, keep two engine paths alive
|
||||
that are not gated on debug mode: a notification on every major garbage collection, and
|
||||
allocation sampling. So a page realm remained distinguishable from one that had never
|
||||
been debugged, on an axis nobody was looking at yet.
|
||||
|
||||
The fix registers the debugger everywhere it is needed for the driver to work and not in
|
||||
the list that flips that flag. The realm is now indistinguishable from a never-debugged
|
||||
one.
|
||||
|
||||
This is the sort of thing that is easy to dismiss as theoretical. We fixed it because
|
||||
the previous three had all been theoretical right up until something measured them.
|
||||
|
||||
## Fix four, and this is the one that mattered
|
||||
|
||||
The others were about how the engine behaved. This one was about something the driver
|
||||
did to the page, and it was the load-bearing fix.
|
||||
|
||||
Every execution context, when created, immediately ran a small helper in **the page's own
|
||||
realm**, so that serialisation would be fast later. It ran before any of the page's
|
||||
scripts.
|
||||
|
||||
That helper touched `JSON`, `Date.prototype` and `Array.prototype`. In the page's realm.
|
||||
Before the page existed.
|
||||
|
||||
A page that has been automated therefore started with built-in prototypes that had been
|
||||
touched by something else first, and that is observable. In a controlled experiment,
|
||||
this was the difference between being blocked and not being blocked by a commercial
|
||||
protection stack, with everything else held constant.
|
||||
|
||||
The fix is unglamorous: build the helper lazily, on first use, which is always after the
|
||||
page has loaded and always in response to something the client asked for. The page realm
|
||||
is now untouched until the page's own first script runs.
|
||||
|
||||
If you take one thing from this page, take that shape:
|
||||
|
||||
> The most expensive leak was not a value the browser reported. It was code that ran in
|
||||
> the page's world before the page did.
|
||||
|
||||
## The related one: every evaluate was a user gesture
|
||||
|
||||
While looking at the same file we found that evaluating script was announcing itself
|
||||
another way. Before running your code, the driver was telling the browser that a user
|
||||
gesture was in progress, presumably so that gesture-gated APIs would work from
|
||||
automation.
|
||||
|
||||
The side effect is that [`navigator.userActivation`](https://developer.mozilla.org/en-US/docs/Web/API/UserActivation)`.isActive` and `hasBeenActive` became
|
||||
true as a result of `page.evaluate()`. A page that reads user activation therefore saw a
|
||||
user gesture that no user made, at a moment no user could have made one. The same theme
|
||||
runs through [synthetic clicks and the `isTrusted` flag](playwright-clicks-istrusted.md):
|
||||
automation announcing an interaction that no human performed.
|
||||
|
||||
It is now off by default, and available behind a preference for the cases that genuinely
|
||||
need gesture-gated APIs.
|
||||
|
||||
## What to check in your own setup
|
||||
|
||||
```js
|
||||
// 1. does the automation layer appear in stacks?
|
||||
try { null.f() } catch (e) { console.log(e.stack) }
|
||||
|
||||
// 2. is anything claiming a user gesture I did not make?
|
||||
console.log(navigator.userActivation.isActive, navigator.userActivation.hasBeenActive);
|
||||
|
||||
// 3. rough timing sanity, compared against a normal browser on the same machine
|
||||
const t = performance.now();
|
||||
for (let i = 0; i < 5e6; i++) Math.sqrt(i);
|
||||
console.log(performance.now() - t);
|
||||
```
|
||||
|
||||
For the third one the absolute number means nothing. Run it in your automated browser
|
||||
and in a normal browser on the same machine and compare the ratio. A large gap is the
|
||||
JIT being off, and no property-level fix addresses it.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Why does a fingerprinting service report devtools when nothing is open?** Because an
|
||||
attached debugger changes engine behaviour, and that is measurable through timing even
|
||||
with no window and no property to read.
|
||||
|
||||
**Can a page detect that the JIT is disabled?** Not directly, and it does not need to.
|
||||
It measures how long things take and compares against what a normal browser does.
|
||||
|
||||
**Is `Error.stack` really used for detection?** Yes, and it is one of the cheapest
|
||||
techniques available. It costs one thrown error, and it exposes both the source of every
|
||||
frame and the label the engine gave to evaluated code.
|
||||
|
||||
**Does `page.evaluate()` leave traces?** It can. Ours announced a user gesture, and it
|
||||
warmed a helper in the page realm before the page loaded. Both were fixed, and both
|
||||
would have been invisible to any property-level audit.
|
||||
|
||||
**Does this affect Chromium-based automation?** The specific fixes are Firefox-side. The
|
||||
category is not: any driver that attaches to the JavaScript engine or runs code in the
|
||||
page's world before the page has the same class of problem.
|
||||
|
||||
**How would I have found this myself?** By comparing against a stock browser on the same
|
||||
machine, on timing and on stack contents, rather than on values. Every one of these was
|
||||
invisible in a property dump.
|
||||
|
||||
**See also:** [Function.prototype.toString and the native code check](tostring-native-code-detection.md),
|
||||
for the property-level half of the same story, and
|
||||
[three ways to make Playwright undetected](playwright-stealth-levels.md), where the
|
||||
driver layer is the one this page is about.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. All four fixes are in this project's engine and
|
||||
driver, and the fourth one was found by controlled experiment after the first three did
|
||||
not fully close it.*
|
||||
@@ -0,0 +1,263 @@
|
||||
---
|
||||
title: "Detecting installed fonts in JavaScript by width"
|
||||
description: "Detect installed fonts in JavaScript with no enumeration API: how the width-comparison probe tells present from absent, and why headless browsers fail it."
|
||||
parent: "Canvas, WebGL, Fonts and Audio"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 11
|
||||
---
|
||||
|
||||
|
||||
# Detecting installed fonts in JavaScript by width
|
||||
|
||||
There is a font-detection technique that needs no font-enumeration API, no
|
||||
permission, and no privileged surface. It draws a short string in a candidate
|
||||
font, draws the same string in a known fallback, and compares the two rendered
|
||||
widths. If they differ, the candidate font is present. If they match to the
|
||||
pixel, the browser fell back, so the font is absent.
|
||||
|
||||
That single comparison is old, cheap, and still in wide use, because it is hard
|
||||
to disable without breaking real pages. This page is what the width-comparison
|
||||
probe actually measures, why it is a different thing from hashing [`measureText`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/measureText)
|
||||
output, what it returns on a bare headless browser, and how a browser that ships
|
||||
its own font set answers it the same way on Windows, Linux and macOS.
|
||||
|
||||
## How the width-comparison probe works
|
||||
|
||||
The mechanism is a fallback trick. Set an element to a font stack whose only
|
||||
entry is a generic family the platform is guaranteed to resolve, measure a test
|
||||
string, and record that width as the baseline. Then prepend a candidate family
|
||||
to the same stack and measure again. The browser uses the candidate if it can
|
||||
resolve it, and falls back to the generic if it cannot. A different width means
|
||||
the candidate rendered; an identical width means it did not exist.
|
||||
|
||||
```javascript
|
||||
// The classic width-comparison presence probe, no enumeration API involved.
|
||||
function fontIsPresent(family) {
|
||||
const probe = "mmmmmmmmmmlli wwww 0123456789";
|
||||
const canvas = document.createElement("canvas");
|
||||
const ctx = canvas.getContext("2d");
|
||||
|
||||
ctx.font = "72px monospace";
|
||||
const baseline = ctx.measureText(probe).width;
|
||||
|
||||
ctx.font = `72px "${family}", monospace`;
|
||||
const candidate = ctx.measureText(probe).width;
|
||||
|
||||
// Present if the candidate changed the width away from the fallback.
|
||||
return candidate !== baseline;
|
||||
}
|
||||
```
|
||||
|
||||
The same idea works with a hidden DOM element and [`offsetWidth`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetWidth) instead of a
|
||||
canvas; the width number comes from the same text-shaping path either way. A
|
||||
detector then runs this over a list of a few hundred font names and turns the
|
||||
present/absent bits into a vector. Two facts about that vector are what make it
|
||||
useful to a detector: it is stable for one machine, and it varies between
|
||||
machines, because the installed-font set is one of the more distinctive things
|
||||
about a device.
|
||||
|
||||
## Why this is different from hashing measureText
|
||||
|
||||
It is easy to lump this in with `measureText` fingerprinting, but the two probe
|
||||
different things and a browser can answer one well and the other badly.
|
||||
|
||||
A `measureText` hash reads the exact sub-pixel width of one string in one font
|
||||
and treats the fractional part as entropy. It does not care whether a font is
|
||||
present; it cares that the same font renders to a slightly different width on
|
||||
two machines because of the rasterizer behind it.
|
||||
|
||||
The width-comparison probe on this page throws that precision away. It only
|
||||
asks a yes-or-no question: did the width move at all. A font that renders one
|
||||
pixel wider than the fallback is just as "present" as one that renders forty
|
||||
pixels wider.
|
||||
|
||||
That distinction matters for a disguise. Hiding from the hash means making the
|
||||
fractional width deterministic and detached from the host rasterizer, which is
|
||||
[what a bounded per-run offset on the text-shaping path does](measuretext-textmetrics-fingerprinting.md).
|
||||
Hiding from the presence probe means controlling which families resolve at all,
|
||||
which is a font-set problem, not a metrics problem.
|
||||
|
||||
Get the first right and the second wrong and you have a clean width hash sitting
|
||||
on top of a font list that screams "Linux server". The two have to be solved
|
||||
together, and this is one reason [headless browsers render a different set of fonts than a desktop](headless-fonts-differ.md).
|
||||
|
||||
## What the probe reads on a bare headless browser
|
||||
|
||||
Run the probe on stock headless Chrome or Firefox in a container and the result
|
||||
is not "no fonts". It is a font set that belongs to the base image.
|
||||
|
||||
A default Linux container answers "present" for DejaVu, Liberation and a handful
|
||||
of Noto families, and "absent" for every family a Windows desktop ships: no
|
||||
Segoe UI, no Calibri, no Cambria, no Consolas. The probe does not need to know
|
||||
those names to score you. It runs its whole list, gets a vector that matches no
|
||||
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)
|
||||
records as a lie.
|
||||
|
||||
The same probe list produces a different vector in each of these three cases:
|
||||
|
||||
| Environment | Fonts that resolve (present) | Windows desktop fonts (absent) |
|
||||
|---|---|---|
|
||||
| Default Linux container | DejaVu, Liberation, a few Noto families | Segoe UI, Calibri, Cambria, Consolas |
|
||||
| Real Windows desktop | Segoe UI, Calibri, Cambria, Consolas and the rest of the Windows set | none, they are installed |
|
||||
| Bundled font set (this project) | the same fixed Windows set on every host | none, shipped inside the binary |
|
||||
|
||||
The reverse failure is just as visible. A build that tries to suppress the probe
|
||||
by forcing every candidate to fall back returns "absent" for everything,
|
||||
including the generic families a real browser always has. An all-absent vector
|
||||
is not a real machine either. A suppressed signal is itself a tell, so the goal
|
||||
is not to answer "no" to everything, it is to answer the way a specific real
|
||||
desktop would.
|
||||
|
||||
## Running the probe against a bundled font set
|
||||
|
||||
The approach this project takes is to stop borrowing the host's fonts at all.
|
||||
The patched Firefox carries a fixed set of real Windows font files inside the
|
||||
binary and builds the family list from a single manifest, so the same set is
|
||||
present whether the process runs on a Windows laptop, a Linux server or a macOS
|
||||
runner. The width-comparison probe sees that set and nothing from the machine
|
||||
underneath.
|
||||
|
||||
Here is the probe run end to end against a reproducible identity. It measures a
|
||||
list of families, splits them into present and absent, and prints the vector the
|
||||
detector would score.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
CANDIDATES = [
|
||||
"Segoe UI", "Calibri", "Cambria", "Consolas", "Arial", "Tahoma",
|
||||
"Times New Roman", "Verdana", "Georgia", "Trebuchet MS",
|
||||
"DejaVu Sans", "Liberation Sans", "Ubuntu", "Noto Sans CJK SC",
|
||||
]
|
||||
|
||||
PROBE_JS = """
|
||||
(families) => {
|
||||
const probe = "mmmmmmmmmmlli wwww 0123456789";
|
||||
const ctx = document.createElement("canvas").getContext("2d");
|
||||
const widthIn = (stack) => { ctx.font = `72px ${stack}`; return ctx.measureText(probe).width; };
|
||||
const baseline = widthIn("monospace");
|
||||
const present = [], absent = [];
|
||||
for (const f of families) {
|
||||
(widthIn(`"${f}", monospace`) !== baseline ? present : absent).push(f);
|
||||
}
|
||||
return { present, absent };
|
||||
}
|
||||
"""
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
result = page.evaluate(PROBE_JS, CANDIDATES)
|
||||
print("present:", result["present"])
|
||||
print("absent :", result["absent"])
|
||||
```
|
||||
|
||||
The Windows families resolve and the Linux-only families fall back, on every
|
||||
host, because the resolution is decided by the bundled manifest and not by
|
||||
whatever fonts the container happens to have. `browser` here is a real Playwright
|
||||
`Browser`, so this is ordinary `page.evaluate` against a live page, nothing the
|
||||
wrapper had to add.
|
||||
|
||||
## Why the answer is identical across operating systems
|
||||
|
||||
The reason this holds up is that both halves of the probe are host-independent by
|
||||
construction.
|
||||
|
||||
The present/absent half is settled by the manifest. The family list is built
|
||||
from the same checked-in data on all three platforms, so the set of names that
|
||||
resolve is a property of the build, not of the OS font directory. There is no
|
||||
path where the host's DejaVu or the host's system UI font leaks into the list
|
||||
that content can enumerate.
|
||||
|
||||
The width half is where a naive bundle would still leak. If the widths came
|
||||
straight from the platform rasterizer, the same bundled font would measure a
|
||||
little differently under DirectWrite on Windows than under FreeType on Linux, and
|
||||
the fractional widths would sort the machines back into OS buckets even with an
|
||||
identical font set.
|
||||
|
||||
Instead the width for a run gets one bounded sub-pixel offset, applied once to
|
||||
the last glyph of the run and derived from the session seed, rather than from
|
||||
the host text engine. It is length-independent, so it does not grow with the
|
||||
string, and it is deterministic, so the same seed gives the same width every
|
||||
time. The result is that the width-comparison probe, and the finer width-hash
|
||||
probe layered on it, both answer from the seed rather than from the operating
|
||||
system.
|
||||
|
||||
You can watch that directly: run the block above with `seed=42` on two different
|
||||
machines and the present/absent split and the measured widths match. Change the
|
||||
seed and the widths shift together while the present/absent split stays fixed,
|
||||
because the font set is the same identity and only the metrics jitter is
|
||||
per-seed. That is the difference between a font disguise that is [consistent
|
||||
across platforms](bundled-fonts-cross-platform.md) and one that merely looks
|
||||
right on the machine you built it on.
|
||||
|
||||
## Conclusion
|
||||
|
||||
The width-comparison probe is durable precisely because it is simple: a fallback,
|
||||
two measurements, a subtraction. You cannot answer it by patching a property,
|
||||
because there is no property, only the rendered width of a string. The only way
|
||||
to give it a coherent answer is to control the font set it resolves and the
|
||||
widths it reads, together, and to make both come from the identity rather than
|
||||
from the host.
|
||||
|
||||
That is the test to hold any stealth setup to. Enumerate the presence vector,
|
||||
confirm it matches a real desktop instead of a base image, then read the widths
|
||||
twice and confirm they are stable and detached from the OS underneath. A vector
|
||||
that is all-present, all-absent, or quietly shaped like the server it runs on has
|
||||
failed, whatever the headline verdict says.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can JavaScript detect installed fonts without an enumeration API?** Yes. It
|
||||
draws a test string in a candidate font and in a generic fallback and compares
|
||||
the two widths; a difference means the font is installed. No permission or
|
||||
special API is required.
|
||||
|
||||
**How does the width comparison actually tell present from absent?** The browser
|
||||
uses the candidate font if it can resolve it and the fallback if it cannot. The
|
||||
same string in a resolved font measures a different width than in the fallback,
|
||||
so a width that moves means present and a width that matches means absent.
|
||||
|
||||
**Is this the same as measureText fingerprinting?** No. `measureText`
|
||||
fingerprinting reads the exact fractional width as entropy. The presence probe
|
||||
only checks whether the width moved at all. A browser can hide from one and leak
|
||||
the other, so both have to be handled.
|
||||
|
||||
**Why does a headless browser fail this probe?** Because its font set belongs to
|
||||
the base image, not to the platform it claims. A Linux container answers
|
||||
"absent" for every Windows desktop font, and that vector matches no real
|
||||
consumer OS.
|
||||
|
||||
**Does hiding fonts by making them all absent work?** No. An all-absent vector is
|
||||
not a real machine either, and a suppressed signal is its own tell. The aim is to
|
||||
answer the way a specific real desktop would, not to answer no to everything.
|
||||
|
||||
**Why do the widths come out the same on Windows and Linux here?** Because the
|
||||
font set is built from one manifest on every OS, and the width for a run carries a
|
||||
single bounded, seed-derived offset instead of the host rasterizer's metrics, so
|
||||
the numbers track the seed rather than the operating system.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's font architecture notes: a bundled Windows font set built from a
|
||||
single manifest, exposing the same families on all three operating systems, and
|
||||
a bounded per-run width offset on the text-shaping path that replaces the host
|
||||
rasterizer's metrics.
|
||||
- The width-comparison presence technique as it appears in public detection
|
||||
suites, read as the fallback-and-subtract mechanism described above rather than
|
||||
from any one implementation.
|
||||
|
||||
**See also:** [why a bundled font set stays identical across platforms](bundled-fonts-cross-platform.md),
|
||||
[how the measureText width hash is handled](measuretext-textmetrics-fingerprinting.md),
|
||||
and [why headless browsers render a different font set](headless-fonts-differ.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 font set is the
|
||||
same on every host by construction, which is the only reason this probe answers
|
||||
the same way whether the process runs on a laptop or a container.*
|
||||
@@ -0,0 +1,199 @@
|
||||
---
|
||||
title: "window.devicePixelRatio: the pref that spoofs it"
|
||||
description: "Set window.devicePixelRatio in Firefox with the layout.css.devPixelsPerPx string pref, why plausible pref keys do nothing, and the three values it must match."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 22
|
||||
---
|
||||
|
||||
|
||||
# window.devicePixelRatio: the pref that spoofs it
|
||||
|
||||
In Firefox, [`window.devicePixelRatio`](https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio) is spoofed by one about:config pref,
|
||||
`layout.css.devPixelsPerPx`, set as a string such as `"1.25"`. The keys that live in a
|
||||
`screen` or a `dpr` namespace look right but are never read, so setting one changes
|
||||
nothing. Getting the value to move is the easy half; keeping it consistent with the two
|
||||
other places a device pixel ratio shows up is what keeps a session unremarkable.
|
||||
|
||||
There is a whole class of Firefox device-pixel-ratio spoofs that share one property:
|
||||
they set a pref, the code runs without error, and `window.devicePixelRatio` does not
|
||||
change. The value stays at whatever the machine reports, the spoof is announced nowhere,
|
||||
and the only way you find out is by reading the property back.
|
||||
|
||||
This page is about the one pref that does move it, the reason the plausible-looking keys
|
||||
do not, and the three values that have to tell the same story once you get it moving.
|
||||
|
||||
## Why a dpr spoof can run and change nothing
|
||||
|
||||
Firefox reads a fixed set of preferences at startup. A pref name that is not declared in
|
||||
the build is not an error: you can set it, it lands in the profile, and no code ever asks
|
||||
for it. It is a note left in a room nobody visits.
|
||||
|
||||
Device pixel ratio is the surface where this bites hardest, because the name that
|
||||
suggests itself is almost never the name the engine reads. People reach for something in a
|
||||
`screen` or a `dpr` namespace, set it, and move on without reading the value back. We did
|
||||
a version of this ourselves in an earlier build: the wrapper wrote a dpr value to a key
|
||||
that Firefox does not read, so it was a silent no-op for every session until we noticed
|
||||
the property had never actually moved. We removed the dead write and kept only the pref
|
||||
below. The lesson outlived the bug: a pref you set is not a pref that took effect, and
|
||||
[the general version of that trap has its own page](firefox-prefs-not-applying.md).
|
||||
|
||||
## The pref Firefox actually reads
|
||||
|
||||
`window.devicePixelRatio` in Firefox is driven by the native about:config pref
|
||||
`layout.css.devPixelsPerPx`. It is a string pref, and the value is the ratio written as
|
||||
text:
|
||||
|
||||
```python
|
||||
from playwright.sync_api import sync_playwright
|
||||
|
||||
with sync_playwright() as p:
|
||||
browser = p.firefox.launch(firefox_user_prefs={
|
||||
# a STRING, not a bare float: "1.25", not 1.25
|
||||
"layout.css.devPixelsPerPx": "1.25",
|
||||
})
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
print(page.evaluate("window.devicePixelRatio")) # 1.25
|
||||
browser.close()
|
||||
```
|
||||
|
||||
Two things about this pref that catch people out. It is a string, so pass the number as
|
||||
text; a bare numeric value is a different kind of pref value and the parser will not treat
|
||||
it the same way. And it is a global scale for the whole browser, not a per-context knob,
|
||||
which is exactly why it has to be kept consistent with the per-context values Playwright
|
||||
sets separately. That is the next section.
|
||||
|
||||
## The three values that must tell the same story
|
||||
|
||||
Setting the pixel ratio is the easy half. The half that gets a session flagged is
|
||||
consistency, because a device pixel ratio shows up in three places that a detector can
|
||||
read independently and compare:
|
||||
|
||||
1. `window.devicePixelRatio`, driven by the pref above.
|
||||
2. Playwright's per-context [`device_scale_factor`](https://playwright.dev/python/docs/api/class-browser#browser-new-context), which scales the rendered viewport.
|
||||
3. The CSS [resolution media feature](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/resolution), for example `matchMedia("(resolution: 1.25dppx)")`,
|
||||
which the browser answers from its own scaling.
|
||||
|
||||
If the pref says 1.25 and the context was created with `device_scale_factor=1.0`, the
|
||||
number reported by `devicePixelRatio` and the geometry the page actually renders at
|
||||
disagree. A real display never does that. The media query is the third witness: it has to
|
||||
resolve to the same ratio the property reports, or a script that reads both has found a
|
||||
contradiction that no real machine produces.
|
||||
|
||||
This is the same failure mode as a user agent claiming one platform on an engine
|
||||
reporting another. The individual value is plausible; the disagreement is the tell. It is
|
||||
also why [an impossible screen geometry is a datacenter signal](screen-size-headless-tells.md)
|
||||
rather than an automation one, and why
|
||||
[the CSS resolution query is worth reading directly](css-media-query-fingerprinting.md)
|
||||
instead of trusting the single property.
|
||||
|
||||
## Measuring the agreement with a seed
|
||||
|
||||
The point of a seed-reproducible browser is that you stop hand-tuning these values and
|
||||
start reading them back. With `invisible_playwright` the pixel ratio, the context scale
|
||||
factor and the media-query answer are all derived from one seed and kept in agreement,
|
||||
so the useful thing to write is not a setter but a check that the three witnesses match:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
CHECK = r"""
|
||||
() => {
|
||||
const dpr = window.devicePixelRatio;
|
||||
// does the CSS resolution query agree with the property?
|
||||
const mq = matchMedia(`(resolution: ${dpr}dppx)`).matches;
|
||||
return {
|
||||
devicePixelRatio: dpr,
|
||||
resolutionQueryAgrees: mq,
|
||||
screen: `${screen.width}x${screen.height}`,
|
||||
// physical pixels implied by the scale
|
||||
physical: `${Math.round(screen.width * dpr)}x${Math.round(screen.height * dpr)}`,
|
||||
};
|
||||
}
|
||||
"""
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
report = page.evaluate(CHECK)
|
||||
print(report)
|
||||
assert report["resolutionQueryAgrees"], "dpr and the resolution media query disagree"
|
||||
```
|
||||
|
||||
Run it twice with the same seed and every field comes back identical, which is what makes
|
||||
a failure reproducible: if a page reacts to the pixel ratio, you can replay the exact same
|
||||
ratio rather than hoping the next random draw lands on it. Run it against a stock browser
|
||||
on the same machine and diff the report field by field; anything that differs other than
|
||||
the address is a candidate, and `resolutionQueryAgrees` being `false` on either side is a
|
||||
straight fail, not a score to weigh.
|
||||
|
||||
## What a mismatch looks like from the outside
|
||||
|
||||
It helps to picture what a script sees when the three values are not aligned, because it
|
||||
explains why "just set devicePixelRatio to a normal number" is not enough.
|
||||
|
||||
A common real-display pairing is a 1920x1080 screen at a device pixel ratio of 1.0, or a
|
||||
scaled laptop panel at 1.25 or 1.5. A detector does not check whether your number is one
|
||||
of those. It checks whether the number, the rendered geometry and the media query point
|
||||
at the same display. A browser reporting 2.0 while rendering at 1.0 scale, or answering
|
||||
the resolution query as if it were 1.0 while `devicePixelRatio` says 2.0, has described a
|
||||
screen that cannot exist. That is a positive signal of tampering, and it is worse than
|
||||
reporting a boring, honest 1.0, because an inconsistency is information a plain value is
|
||||
not. The whole reason to read the value back after setting it is to be sure you produced a
|
||||
real display and not an impossible one.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Device pixel ratio is a small field with a large blast radius. The pref that moves it in
|
||||
Firefox is `layout.css.devPixelsPerPx`, set as a string; the plausible-sounding keys in
|
||||
other namespaces are notes in an empty room. Getting the value to change is the easy part.
|
||||
The part that keeps a session unremarkable is making the property, the context scale
|
||||
factor and the CSS resolution media query agree, and then reading all three back to prove
|
||||
they do, against a stock browser, more than once.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**How do I set window.devicePixelRatio in Firefox?** Set the about:config string pref
|
||||
`layout.css.devPixelsPerPx` to the ratio as text, for example `"1.25"`. It is the only
|
||||
pref that actually drives the property.
|
||||
|
||||
**I set a dpr pref and nothing changed. Why?** Almost certainly you set a pref name the
|
||||
engine does not read. A pref that is not declared in the build is accepted silently and
|
||||
never consulted. Read `window.devicePixelRatio` back to confirm it moved.
|
||||
|
||||
**Does device_scale_factor set devicePixelRatio?** It scales the rendered viewport for a
|
||||
context, and it must match the pref, but it is a separate value. If they disagree the
|
||||
browser reports a display that cannot exist.
|
||||
|
||||
**What device pixel ratio should I use?** One that a real display has, like 1.0, 1.25 or
|
||||
1.5, and the same value in all three places. The specific number matters less than the
|
||||
three witnesses agreeing.
|
||||
|
||||
**Can a site detect a spoofed dpr?** Not from a plausible value on its own. It detects the
|
||||
contradiction when the property, the render geometry and the resolution media query point
|
||||
at different displays.
|
||||
|
||||
**Why does the ratio have to be a string?** `layout.css.devPixelsPerPx` is a string pref;
|
||||
pass the number as text, `"1.25"`, not as a bare float.
|
||||
|
||||
## Sources
|
||||
|
||||
- [MDN: `Window.devicePixelRatio`](https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio) -
|
||||
the ratio of physical pixels to CSS pixels that the property reports.
|
||||
- [MDN: the `resolution` media feature](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/resolution) -
|
||||
the `dppx` unit used in the media-query check above.
|
||||
- [Playwright: `device_scale_factor` on `browser.new_context`](https://playwright.dev/python/docs/api/class-browser#browser-new-context) -
|
||||
the per-context knob that must agree with the pref.
|
||||
- Firefox's `layout.css.devPixelsPerPx` pref itself, and the dead dpr write once shipped
|
||||
here, read from the browser's own behaviour rather than from a rendered report.
|
||||
|
||||
**See also:** [why a pref you set can quietly do nothing](firefox-prefs-not-applying.md),
|
||||
[what an impossible screen geometry gives away](screen-size-headless-tells.md), and
|
||||
[reading the CSS resolution query directly](css-media-query-fingerprinting.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 dead dpr write in this
|
||||
page is one we shipped ourselves, and only caught by reading the value back.*
|
||||
@@ -0,0 +1,232 @@
|
||||
---
|
||||
title: "Anti-detect browser or Playwright stealth: which you need"
|
||||
description: "Deciding between a paid anti-detect browser and stock Playwright on a patched Firefox build: what they share, what the paid GUI adds, and how to script it."
|
||||
parent: "Comparisons"
|
||||
nav_order: 33
|
||||
---
|
||||
|
||||
|
||||
# Anti-detect browser or Playwright stealth: which you need
|
||||
|
||||
The honest version of this question is not "which one wins". It is "which
|
||||
layers do I actually need, and which am I paying for twice". A commercial
|
||||
anti-detect browser and a patched-engine library overlap on exactly one layer
|
||||
and differ on the rest, so the answer depends entirely on which layer your
|
||||
real problem lives in.
|
||||
|
||||
This page names the layers, shows where the two approaches meet and where they
|
||||
part, and gives you the runnable version of the engine layer so you can decide
|
||||
by trying rather than by reading marketing.
|
||||
|
||||
## What you are actually comparing
|
||||
|
||||
A commercial anti-detect browser is usually three things sold as one product:
|
||||
|
||||
- a **patched browser engine** that reports a consistent, human-looking
|
||||
fingerprint,
|
||||
- a **profile and identity manager** that stores many separate personas and
|
||||
keeps them apart,
|
||||
- and **proxy wiring plus IP reputation handling**, so each persona leaves
|
||||
from its own network exit.
|
||||
|
||||
All three sit behind a paid GUI, and the whole thing is built for a person
|
||||
clicking through many accounts by hand.
|
||||
|
||||
Stock Playwright driving an open patched Firefox build gives you the first of
|
||||
those three, scriptably, in Python. You get the same engine-level fingerprint
|
||||
spoofing. What you do not get for free is the profile manager and the proxy or
|
||||
reputation layer - the library deliberately leaves those to you, because in
|
||||
code you usually already have your own way of storing state and choosing an
|
||||
exit.
|
||||
|
||||
So the real question is not "GUI or library". It is: **is your bottleneck the
|
||||
engine, or is it the network and the identities?** If it is the engine, the two
|
||||
approaches are equivalent and one of them is free and scriptable. If it is the
|
||||
network, the engine choice will not move the needle at all.
|
||||
|
||||
## The layer they share: a patched engine
|
||||
|
||||
This is the part that overlaps, and it is worth being precise about what
|
||||
"patched engine" buys you, because it is the same thing in both cases.
|
||||
|
||||
A real browser reports hundreds of correlated values: the GPU string and the
|
||||
pixels it actually draws, the audio device, the installed fonts, the screen
|
||||
geometry, the codecs, the TLS handshake, and the driver layer that automation
|
||||
frameworks usually announce themselves through - the best-known example being
|
||||
[`navigator.webdriver`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/webdriver),
|
||||
a specified boolean a real user's browser never sets. A patched engine makes those
|
||||
read as a genuine Firefox driven by a person, and - this is the part a page
|
||||
script cannot do - keeps them **consistent with each other**, because most
|
||||
detection is a cross-check between two values that should agree rather than a
|
||||
lookup of one unusual value. See
|
||||
[what a browser fingerprint is made of](what-is-a-browser-fingerprint.md) for
|
||||
the surfaces involved.
|
||||
|
||||
This is also why the engine layer beats the stealth-plugin layer, in a GUI
|
||||
product or a library alike. A JavaScript patch applied to a page runs after the
|
||||
browser has already answered the network and driver questions, and stacking two
|
||||
spoofers produces a contradiction neither produces alone -
|
||||
[picking one stealth layer](playwright-stealth-levels.md) is the whole game.
|
||||
The engine layer answers those questions before any page loads, which is why
|
||||
this project patches Firefox at the C++ level instead of injecting scripts. The
|
||||
same reasoning shows up when you compare
|
||||
[a patched Firefox against a patched Chromium](firefox-vs-chromium-antidetect.md)
|
||||
or against [another Firefox-based build](vs-camoufox.md): the durable difference
|
||||
is always where the patch lives, not the brand on the box.
|
||||
|
||||
## The layers the paid product adds: proxy and identity management
|
||||
|
||||
Here is where the paid GUI earns its money, and where the library asks you to
|
||||
bring your own.
|
||||
|
||||
A commercial anti-detect browser stores dozens or hundreds of profiles, assigns
|
||||
each a proxy, and tries to keep the exit IPs clean and separated so two
|
||||
personas never share a fingerprint-plus-network story. For a human running many
|
||||
accounts by hand, that management surface is the product, and rebuilding it in
|
||||
code is real work.
|
||||
|
||||
A library hands you the engine and stops there. You supply the proxy per
|
||||
session, you decide how identities are stored and rotated, and you own the IP
|
||||
quality. That is a feature when you are automating: you plug the exit into your
|
||||
own pipeline instead of clicking through a vendor's UI. It is a cost when what
|
||||
you actually wanted was the vendor's managed clean IPs, because a patched engine
|
||||
does not include any.
|
||||
|
||||
The dividing line is clean: **the engine makes you look real; the proxy and
|
||||
identity layer decides whether "real" is enough.** The library gives you the
|
||||
first outright and leaves the second as an explicit input.
|
||||
|
||||
## Doing it in code: the two-line version
|
||||
|
||||
If your bottleneck is the engine, this is the whole switch. Any existing
|
||||
Playwright script becomes a stealthed one by changing how the browser launches;
|
||||
nothing after that line changes, because the object you get back 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, canvas, audio,
|
||||
# fonts and screen on every run, so a failing run can be replayed exactly.
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
print(page.title())
|
||||
```
|
||||
|
||||
You supply the proxy - the identity/network layer the paid product would manage
|
||||
for you - as a plain dict. This is the part the library leaves in your hands on
|
||||
purpose:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
proxy = {
|
||||
"server": "socks5://gate.example.com:1080",
|
||||
"username": "user",
|
||||
"password": "pass",
|
||||
}
|
||||
|
||||
# timezone defaults to auto, derived from the proxy's egress IP, so the
|
||||
# browser's zone matches where the network says you are.
|
||||
with InvisiblePlaywright(seed=42, proxy=proxy) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
page.click("#submit") # pointer arcs to the target on a Bezier curve
|
||||
```
|
||||
|
||||
The async API is identical in shape (`from invisible_playwright.async_api
|
||||
import InvisiblePlaywright`, then `await page.goto(...)`), and every standard
|
||||
Playwright method works unchanged because there is no wrapped subset to learn.
|
||||
Install is the ordinary way, and the engine downloads itself on first use:
|
||||
|
||||
```bash
|
||||
pip install invisible-playwright
|
||||
```
|
||||
|
||||
That is the engine layer, in full, scriptable. What it does not print is a
|
||||
managed clean IP - you passed that in yourself.
|
||||
|
||||
## The honest caveat: the engine will not fix your IP
|
||||
|
||||
This is the sentence that decides most buy-versus-code questions, so it gets its
|
||||
own section.
|
||||
|
||||
invisible_playwright is designed to look like a real browser driven by a real
|
||||
person, and that is precisely why it clears most detection: the fingerprint,
|
||||
the TLS handshake and the driver layer read as a genuine Firefox. It does not,
|
||||
on its own, fix **IP reputation, per-account quotas, rate limits, or the timing
|
||||
and behaviour of the session**. Those are yours to supply - a clean proxy,
|
||||
human pacing, sensible request velocity.
|
||||
|
||||
A perfect browser on a datacenter IP, or on a residential IP a thousand other
|
||||
people are using this minute, still loses, and no engine choice changes that.
|
||||
If your manual visit from the same machine and network also gets the wrong
|
||||
page, the problem was never the browser -
|
||||
[why a clean fingerprint still gets blocked](why-blocked-with-a-clean-fingerprint.md)
|
||||
is the whole story. This is the same layer a paid product's proxy management is
|
||||
selling, and it is the one honest reason to reach for the GUI: if IP quality is
|
||||
your real bottleneck, the engine will not fix it, and you should be buying
|
||||
network reputation, not a browser.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Buy the GUI when you are a person managing many accounts by hand and you want
|
||||
the profile store and managed clean exits handled for you. Use the library when
|
||||
you want programmatic control and you already have, or can build, your own
|
||||
identity and proxy plumbing - you get the same patched engine, in Python, for
|
||||
free, and you keep the network layer under your own pipeline.
|
||||
|
||||
The overlap is the engine. The paid extra is the network and identity
|
||||
management the library deliberately leaves to you. Decide by naming which of
|
||||
those two is actually blocking you today, and the answer stops being a matter of
|
||||
taste.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Do I need an anti-detect browser at all?** Only for the engine layer, and a
|
||||
patched Firefox build gives you that scriptably. If you need managed proxies and
|
||||
a many-account GUI, the paid product bundles those on top.
|
||||
|
||||
**Is stock Playwright enough by itself?** For the fingerprint, only with a
|
||||
patched engine under it - plain Playwright announces itself at the driver and
|
||||
network layers. For IP reputation and behaviour, no tool is enough; you supply
|
||||
those.
|
||||
|
||||
**Will a patched engine fix my blocks?** It fixes fingerprint, TLS and driver
|
||||
tells, which is most detection. It does not fix a bad IP, a blown quota, or
|
||||
robotic timing.
|
||||
|
||||
**What does the paid product do that the library does not?** It manages
|
||||
profiles at scale and wires up proxies with some IP reputation handling behind a
|
||||
GUI. The library leaves proxy and identity choice to your code on purpose.
|
||||
|
||||
**Can I get reproducible identities in code?** Yes - pass `seed=42` and every
|
||||
fingerprint field comes back identical run after run, which is what makes a
|
||||
failing run replayable.
|
||||
|
||||
**If IP quality is my problem, does any of this help?** No. The engine choice is
|
||||
orthogonal to network reputation. Buy or rent clean exits; the browser layer
|
||||
cannot substitute for them.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's [Quickstart](quickstart.md) and [Configuration](configuration.md)
|
||||
pages, for the real launch API, proxy dict and timezone behaviour shown above.
|
||||
- The troubleshooting order in
|
||||
[Playwright detected as a bot on one site](playwright-detected-as-bot.md),
|
||||
which ranks engine tells above IP as the more common and cheaper fix, and IP
|
||||
reputation as the last and most expensive suspect.
|
||||
- [MDN: `Navigator.webdriver`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/webdriver)
|
||||
and [Playwright's `Browser` class reference](https://playwright.dev/python/docs/api/class-browser),
|
||||
for the driver-layer property and the object the launch call above returns.
|
||||
|
||||
**See also:** [what a browser fingerprint is made of](what-is-a-browser-fingerprint.md),
|
||||
[choosing a single stealth layer](playwright-stealth-levels.md), and
|
||||
[why a clean fingerprint can still be blocked](why-blocked-with-a-clean-fingerprint.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 layer
|
||||
is the part I can hand you; the clean IP is the part you still have to bring.*
|
||||
@@ -0,0 +1,213 @@
|
||||
---
|
||||
title: "Do websites know you are using a script?"
|
||||
description: "How sites detect scripts driving the browser: navigator.webdriver, CDP, BiDi artifacts, synthetic events and timing tells. What hides automation-layer reveals."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 13
|
||||
---
|
||||
|
||||
|
||||
# Do websites know you are using a script?
|
||||
|
||||
Often, yes, and usually not for the reason people assume. The fingerprint gets most
|
||||
of the attention, but a site can tell a script is driving the browser through a
|
||||
separate set of tells that have nothing to do with the GPU, the fonts or the screen.
|
||||
These are automation-layer tells, and they answer a narrower question than "who are
|
||||
you": they answer "is a program at the wheel".
|
||||
|
||||
The honest version of the answer is that these tells are fixable, and that fixing them
|
||||
does not make you invisible. It removes the announcement that a script is present. It
|
||||
does not remove a datacenter IP, a per-account quota, or the fact that you filled a
|
||||
form in eighty milliseconds. This page covers the announcement, and is clear about
|
||||
where the announcement ends.
|
||||
|
||||
## The four tells that say "a script is here"
|
||||
|
||||
None of these depend on your fingerprint. A browser with a flawless machine identity
|
||||
still trips every one of them if the automation layer is careless.
|
||||
|
||||
- **`navigator.webdriver`.** A boolean the automation standard requires the browser to
|
||||
set to `true` when a driver is attached. It is the single most checked automation
|
||||
flag on the web, it is one line to read, and [setting it to `false` is not the fix a
|
||||
real browser reports `undefined`](navigator-webdriver-explained.md).
|
||||
- **CDP or BiDi artifacts.** The remote control protocols that most drivers speak leave
|
||||
observable traces: extra objects on the page, timing side effects, a debugger that is
|
||||
attached. A page can probe for the protocol itself rather than for any property it
|
||||
sets, which is [why CDP and BiDi have their own detection surface](bidi-vs-cdp-detection.md).
|
||||
- **Synthetic events with `isTrusted` false.** Every DOM event carries an `isTrusted`
|
||||
flag. The browser sets it to `true` for events it generated from real hardware input
|
||||
and `false` for events created in JavaScript. A driver that clicks by dispatching a
|
||||
synthetic event produces `isTrusted: false`, and [that flag cannot be forged from
|
||||
page script](playwright-clicks-istrusted.md).
|
||||
- **Unnaturally regular timing.** Keystrokes at a perfectly uniform interval, a click
|
||||
the same number of milliseconds after every load, requests on a fixed period. This
|
||||
one is different from the other three: it is not something the browser leaks, it is
|
||||
something your code produces.
|
||||
|
||||
The first three are properties of the automation plumbing. The fourth is a property of
|
||||
how you drive. That distinction is the whole point of this page.
|
||||
|
||||
## Why invisible_playwright does not expose the first three
|
||||
|
||||
invisible_playwright is a Firefox patched at the C++ level, driven by stock Playwright
|
||||
over a patched protocol. The design goal is that the browser looks like a real Firefox
|
||||
driven by a real person, and the automation layer is where "driven by a real person"
|
||||
is won or lost.
|
||||
|
||||
The control channel does not present the driver tells that a normal automation setup
|
||||
exposes: `navigator.webdriver` reads the way a clean browser reads, and the protocol
|
||||
the wrapper speaks to the engine is not the one the common protocol probes are looking
|
||||
for. More importantly, input is not synthesized in page script. Clicks and keystrokes
|
||||
are routed through the browser's real input pipeline, so the events a page sees are
|
||||
generated by the engine the same way a physical mouse or keyboard would generate them.
|
||||
That means `isTrusted` is genuinely `true`, because the event genuinely came through
|
||||
the trusted path, not because a flag was patched.
|
||||
|
||||
Switching from plain Playwright to this is two lines, and every Playwright method works
|
||||
unchanged afterwards:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
page.fill("#name", "Ada Lovelace") # keystrokes go through the real input path
|
||||
page.click("#submit") # a genuinely trusted click, isTrusted true
|
||||
```
|
||||
|
||||
The `browser` object is a real Playwright `Browser`, so there is no reduced API to
|
||||
learn. The `seed=42` argument makes the machine identity reproducible, which matters
|
||||
for debugging: the same seed gives the same browser every run, so a failing run can be
|
||||
replayed instead of guessed at.
|
||||
|
||||
## The tell you still own: timing and behaviour
|
||||
|
||||
Here is the caveat, stated plainly. Removing the driver tells hides that a script is
|
||||
present. It does nothing about the fourth tell, because the fourth tell is yours.
|
||||
|
||||
A trusted click that lands at the exact same offset after every page load is still a
|
||||
robot. A form filled faster than a human can read it is still a robot. A request loop
|
||||
on a metronome is still a robot. Some sites do not fingerprint the browser at all, they
|
||||
watch the session, and against those sites the quality of your pacing is the entire
|
||||
game. This is especially true for [AI agents, whose pauses can be shaped like model
|
||||
latency rather than human thought](ai-browser-agents-stealth.md).
|
||||
|
||||
You control this, which is good news, because it means the fix is in your code rather
|
||||
than in the engine. Vary the intervals. Do not act faster than a person could. Let the
|
||||
page settle before the next action. The engine gives you trusted events and human-like
|
||||
mouse arcs by default; the rhythm of when you fire them is on you.
|
||||
|
||||
```python
|
||||
import random
|
||||
import time
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
for field, value in [("#first", "Ada"), ("#last", "Lovelace")]:
|
||||
page.click(field)
|
||||
page.type(field, value, delay=random.randint(80, 220)) # per-keystroke jitter
|
||||
time.sleep(random.uniform(0.4, 1.1)) # think between fields
|
||||
page.click("#submit")
|
||||
```
|
||||
|
||||
## What this does not fix, so you supply it
|
||||
|
||||
The driver layer is one of several independent things a site checks, and being clean on
|
||||
one says nothing about the others. invisible_playwright reads as a genuine Firefox at
|
||||
the fingerprint, TLS and driver layers, which is why it passes most detection checks.
|
||||
It does not, on its own, address:
|
||||
|
||||
- **IP reputation.** A perfect browser on a known datacenter or already-blocked address
|
||||
still loses. You supply a clean exit.
|
||||
- **Per-account quotas and rate limits.** These are counted server-side against your
|
||||
account or address, and no browser property changes the count.
|
||||
- **Behaviour and timing**, covered above, which is yours to shape.
|
||||
- **The country and timezone agreeing with the exit.** The engine auto-derives the
|
||||
timezone from the egress IP so these do not drift apart, but the exit itself is a
|
||||
choice you make.
|
||||
|
||||
The rule from the rest of these notes applies here too: a suppressed signal is itself a
|
||||
signal. Hiding that a script is present is worth doing precisely because it is not the
|
||||
same as hiding everything, and treating it as a complete solution is how a clean driver
|
||||
layer ends up flagged for a metronomic click.
|
||||
|
||||
## How to confirm it on your own setup
|
||||
|
||||
Do not take a vendor's word for any of this, including ours. Open a page that reads
|
||||
these values in both invisible_playwright and a stock browser on the same machine, and
|
||||
compare the fields. Read `navigator.webdriver`. Attach a listener and read
|
||||
`event.isTrusted` on a real click versus a scripted one. The [method for testing this without fooling yourself with
|
||||
a green verdict is its own page](how-to-test-bot-detection.md), and the short version is:
|
||||
assert the signal you expect is present, do not just confirm a bad one is absent.
|
||||
|
||||
```python
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
print("webdriver:", page.evaluate("() => navigator.webdriver"))
|
||||
trusted = page.evaluate("""() => new Promise(resolve => {
|
||||
document.addEventListener('click', e => resolve(e.isTrusted), { once: true });
|
||||
})""")
|
||||
page.click("body")
|
||||
print("isTrusted:", trusted)
|
||||
```
|
||||
|
||||
Run it more than once. This domain is not deterministic, and a single green run is not
|
||||
a pass.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Websites can tell a script is driving a browser, and they do it mostly through the
|
||||
automation layer rather than the fingerprint: `navigator.webdriver`, the control
|
||||
protocol's artifacts, and untrusted synthetic events. invisible_playwright is built so
|
||||
those three do not announce themselves, because its input goes through the real pipeline
|
||||
and its protocol does not expose the driver tells. That is genuinely useful and it is
|
||||
genuinely bounded. The fourth tell, timing, is not the engine's to fix and not something
|
||||
any browser patch can hide. Get the plumbing clean with the tool, get the rhythm human
|
||||
with your code, and put both behind an exit that does not give you away on its own.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can a website tell I am using a script?** Often yes, through automation-layer tells
|
||||
like `navigator.webdriver`, control-protocol artifacts and untrusted synthetic events,
|
||||
which are independent of your fingerprint.
|
||||
|
||||
**Does hiding navigator.webdriver make me undetectable?** No. It removes one specific
|
||||
announcement. Timing, IP reputation and rate limits are separate and remain yours to
|
||||
handle.
|
||||
|
||||
**What is isTrusted and why does it matter?** It is a per-event flag the browser sets
|
||||
`true` only for events from real input. Events synthesized in page script come back
|
||||
`false`, which flags automation. Input through the real pipeline is trusted for real.
|
||||
|
||||
**Will invisible_playwright pass every bot check?** It reads as a genuine Firefox at the
|
||||
fingerprint, TLS and driver layers, which is why it passes most. It does not fix your IP,
|
||||
your quotas, or superhuman pacing.
|
||||
|
||||
**How do I make my timing look human?** Vary intervals, add per-keystroke jitter, pause
|
||||
between actions, and never act faster than a person could read the page.
|
||||
|
||||
**Is running a script against a site illegal?** That is a question about a site's terms
|
||||
and your jurisdiction, not about detection. This page is about how detection works, not
|
||||
about permission to automate.
|
||||
|
||||
## Sources
|
||||
|
||||
- The [WebDriver specification](https://www.w3.org/TR/webdriver2/#interface) for the
|
||||
`navigator.webdriver` requirement, the [WebDriver BiDi specification](https://www.w3.org/TR/webdriver-bidi/)
|
||||
for the remote-protocol surface, and the [DOM standard](https://dom.spec.whatwg.org/#dom-event-istrusted)
|
||||
for the `isTrusted` event flag, each read from its own text rather than from a summary.
|
||||
- This project's own input path and protocol behaviour, and its release gates, from which
|
||||
the trusted-event and driver-tell claims above are measured rather than asserted.
|
||||
|
||||
**See also:** [navigator.webdriver, explained](navigator-webdriver-explained.md) for the
|
||||
one flag every site reads, [why isTrusted separates a real click from a scripted one](playwright-clicks-istrusted.md),
|
||||
and [testing detection without fooling yourself with a verdict](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. It hides that a script is
|
||||
present; the pacing is still yours to get right.*
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
title: "Documentation"
|
||||
description: "How to install, configure and use invisible_playwright: install and fetch the engine, the two-line switch from plain Playwright, proxy and timezone configuration, pinning specific fields, and the CLI."
|
||||
has_children: true
|
||||
nav_order: 2
|
||||
---
|
||||
|
||||
# Documentation
|
||||
|
||||
The product itself, not the browser it's built on. [Installation](installation.md)
|
||||
gets the wrapper and the engine on disk, [Quickstart](quickstart.md) is the two-line
|
||||
switch from plain Playwright, [Configuration](configuration.md) covers proxies,
|
||||
timezone and environment variables, [Pinning fingerprint fields](pinning.md) covers
|
||||
forcing specific values while leaving the rest seed-derived, and the
|
||||
[CLI reference](cli-reference.md) covers the command line.
|
||||
|
||||
If you're here to understand *why* a particular signal matters rather than how to
|
||||
configure this package, that's [Guides](guides.md) instead.
|
||||
@@ -0,0 +1,255 @@
|
||||
---
|
||||
title: "Does a proxy leak DNS? DoH and DNS leaks explained"
|
||||
description: "How a SOCKS5 proxy can leak DNS when the host resolves names locally, where DNS-over-HTTPS fits, and how to verify that names exit where the connection does."
|
||||
parent: "Network, Proxy and WebRTC"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 21
|
||||
---
|
||||
|
||||
|
||||
# Does a proxy leak DNS? DoH and DNS leaks explained
|
||||
|
||||
A proxy moves your connection to a different exit. It does not automatically move the
|
||||
step that happens before the connection: turning `example.com` into an IP address. If
|
||||
that lookup is done by your own machine while the connection leaves through the proxy,
|
||||
you have a browser whose traffic exits in one country and whose DNS queries exit from
|
||||
your real network. That split is a DNS leak, and it is one of the most common ways a
|
||||
proxied session still tells a consistent story about where you actually are.
|
||||
|
||||
This page explains where name resolution happens, the difference between remote and
|
||||
local resolution over SOCKS5, where DNS-over-HTTPS fits, how to check which one you are
|
||||
doing, and the one thing fixing the leak does not fix.
|
||||
|
||||
## Where DNS resolution actually happens
|
||||
|
||||
DNS resolution happens in one of two places: on your own host, using whatever resolver
|
||||
your operating system is configured to use, or at the proxy exit, where the proxy does
|
||||
the lookup on your behalf. Every connection to a hostname is really two steps: first a
|
||||
name is resolved to an address, then a socket is opened to that address. People think of
|
||||
a proxy as covering "the connection", but there are two connections in that sentence, and
|
||||
a proxy does not necessarily cover both.
|
||||
|
||||
In detail, the resolver step can run in one of two places:
|
||||
|
||||
- **On your host**, using whatever DNS server your operating system is configured to
|
||||
use. That is usually your ISP's resolver, or one handed to you by your local network.
|
||||
- **At the proxy exit**, where the proxy itself does the lookup on your behalf and only
|
||||
the connection details come back to you.
|
||||
|
||||
When the host resolves, the lookup packets leave from your real network before the proxy
|
||||
is ever involved. A passive observer on your network, and the resolver you queried, both
|
||||
see that you asked for `example.com` at a given second. Moments later the destination
|
||||
site sees a connection arrive from the proxy's country. Correlating those two is not
|
||||
hard, and it undoes the reason you added the proxy.
|
||||
|
||||
## Remote vs local resolution over SOCKS5
|
||||
|
||||
SOCKS5, defined in [RFC 1928](https://datatracker.ietf.org/doc/html/rfc1928), is the
|
||||
scheme where this actually has a choice, which is why it comes up here and not with plain
|
||||
HTTP proxying. The protocol lets a client send the proxy either an **address** it has
|
||||
already resolved, or a **hostname** for the proxy to resolve itself.
|
||||
|
||||
- **Local (host-side) resolution.** The client resolves `example.com` to an IP using the
|
||||
host's resolver, then tells the proxy "connect to this IP". The lookup left your
|
||||
network. This is the leak.
|
||||
- **Remote (proxy-side) resolution.** The client tells the proxy "connect to this
|
||||
hostname", and the proxy resolves it at the exit. The lookup and the connection now
|
||||
leave from the same place.
|
||||
|
||||
The trap is that the leaking version is often the default in naive setups. A lot of
|
||||
tooling resolves the hostname first out of habit and only then hands an address to the
|
||||
proxy, so the connection is proxied and the DNS is not. Nothing errors. The page loads.
|
||||
The exit IP looks right in a quick check. The lookup quietly went out your front door.
|
||||
This is the same class of silent-default problem as
|
||||
[SOCKS5 authentication that falls back to an unproxied connection](playwright-socks5-proxy-authentication.md)
|
||||
instead of failing loudly. The difference between the two schemes, and why SOCKS5 is the
|
||||
one that carries hostnames at all, is covered in
|
||||
[SOCKS5 vs HTTP proxy for a browser](socks5-vs-http-proxy-browser.md).
|
||||
|
||||
invisible_playwright resolves DNS through the proxy by default, so names and connections
|
||||
exit from the same place. There is no separate switch to remember: pass a SOCKS5 proxy
|
||||
and the hostname goes to the exit, not to your local resolver.
|
||||
|
||||
## Where DNS-over-HTTPS fits
|
||||
|
||||
DNS-over-HTTPS (DoH), standardized in
|
||||
[RFC 8484](https://datatracker.ietf.org/doc/html/rfc8484), encrypts the resolver query
|
||||
and sends it over HTTPS to a chosen resolver. It is a related but different fix from
|
||||
proxy-side resolution, and the two solve different problems.
|
||||
|
||||
Its purpose is confidentiality: your local network and your ISP can no longer read which
|
||||
hostnames you are looking up, because the query looks like ordinary HTTPS traffic to some
|
||||
server.
|
||||
|
||||
What DoH does **not** do on its own is change *where* the query exits. If the browser's
|
||||
DoH request itself goes out your real network rather than through the proxy, the encrypted
|
||||
lookup still originates from your real IP. The resolver you picked now knows the name, and
|
||||
a determined observer still sees a lookup-shaped request leaving your network at the same
|
||||
moment a proxied connection opens elsewhere. Encryption hides the *content* of the leak,
|
||||
not the *fact* of it.
|
||||
|
||||
So DoH and proxy-side resolution answer different questions:
|
||||
|
||||
- **Proxy-side resolution** decides *where the lookup exits*. It closes the geographic
|
||||
split that this whole page is about.
|
||||
- **DoH** decides *whether the lookup is readable in transit*. It is about privacy from
|
||||
the network path, not about exit location.
|
||||
|
||||
For a proxied automation session, the property you want is that the name resolves at the
|
||||
exit. When resolution happens at the proxy, the exit's own resolver handles the name, and
|
||||
the "which resolver, encrypted or not" question moves to the exit's side of the world,
|
||||
where it belongs. Firefox exposes DoH through standard `network.trr.*` about:config
|
||||
preferences if you want the encrypted-in-transit property on top, but it is not a
|
||||
substitute for resolving at the exit.
|
||||
|
||||
## Launch invisible_playwright and resolve names at the exit
|
||||
|
||||
The whole point of the product here is that the correct behaviour is the default. You pass
|
||||
a SOCKS5 proxy the ordinary way and the hostname is resolved at the exit, alongside the
|
||||
connection.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
proxy = {
|
||||
"server": "socks5://gate.example.com:1080",
|
||||
"username": "user",
|
||||
"password": "pass",
|
||||
}
|
||||
|
||||
# seed=42 makes the whole identity reproducible run to run
|
||||
with InvisiblePlaywright(seed=42, proxy=proxy) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
print(page.title())
|
||||
```
|
||||
|
||||
The `browser` object is a real Playwright `Browser`, so every method you already use works
|
||||
unchanged. The only thing that differs from stock Playwright here is that the name in
|
||||
`page.goto(...)` is resolved through the proxy rather than by your host, so the DNS query
|
||||
and the HTTP connection both leave from `gate.example.com`'s exit and not from your
|
||||
network. Async is the same, from `invisible_playwright.async_api`.
|
||||
|
||||
If you drive `firefox.launch()` yourself instead of using this class, the same proxy dict
|
||||
has to reach the launch through `get_default_stealth_prefs(proxy=...)` so the SOCKS
|
||||
preferences that route DNS are actually written. Skipping that is how a hand-rolled setup
|
||||
ends up proxying the connection and leaking the lookup.
|
||||
|
||||
## How to verify names exit where the traffic does
|
||||
|
||||
Do not assume. The failure mode of a DNS leak is that everything looks fine, so the check
|
||||
has to be positive: confirm the lookup exit, do not just confirm the absence of an error.
|
||||
|
||||
A minimal, honest check has two halves that must agree:
|
||||
|
||||
```bash
|
||||
# 1. What does the world see your CONNECTION exit as?
|
||||
# Run this THROUGH the browser session, not with a bare curl on the host,
|
||||
# or you have measured the path you do not use.
|
||||
```
|
||||
|
||||
Inside the session, read the exit the destination actually sees:
|
||||
|
||||
```python
|
||||
with InvisiblePlaywright(seed=42, proxy=proxy) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com/ip") # any endpoint that echoes the caller IP
|
||||
print("connection exit:", page.inner_text("body"))
|
||||
```
|
||||
|
||||
Then compare that against where your **DNS** appears to resolve from, using a resolver-echo
|
||||
service that reports the address of the machine that queried it. If the connection exit and
|
||||
the resolver-side address are in the same place, resolution is happening at the exit. If the
|
||||
resolver address is your home ISP while the connection exit is the proxy's country, you have
|
||||
found the leak. This is the same "measure the real path, through the proxy, not on localhost"
|
||||
discipline described in [how to check a proxy for an IP leak](how-to-check-proxy-ip-leak.md),
|
||||
and it belongs next to the WebRTC and timezone checks, because all three fail in the same
|
||||
quiet way: a value that is individually plausible and disagrees with another value.
|
||||
|
||||
While you are checking exits, check the [timezone against the exit IP](timezone-proxy-mismatch.md)
|
||||
too. A DNS leak and a timezone mismatch are the same category of tell: two surfaces that
|
||||
should point at one location and do not.
|
||||
|
||||
## The honest caveat: this fixes the leak, not the reputation
|
||||
|
||||
Resolving names at the exit closes a specific, real gap: it stops your DNS from pointing
|
||||
at your real network while your connection points somewhere else. That is worth doing, and
|
||||
it is the default here for that reason.
|
||||
|
||||
It does not make the exit IP good. If the proxy's address is a known datacenter range, or
|
||||
is already on shared blocklists, or is a country that does not match the rest of your
|
||||
session, a perfectly consistent DNS path does not help. The name and the connection now
|
||||
exit from the *same* place, but that place can still have a bad reputation. What decides
|
||||
whether a datacenter exit is recognised as one is a separate question, covered in
|
||||
[can websites detect a datacenter proxy IP](can-websites-detect-a-datacenter-proxy-ip.md).
|
||||
|
||||
The honest framing for the whole product is the same here as everywhere: invisible_playwright
|
||||
is built to look like a real Firefox driven by a real person, which is why the fingerprint,
|
||||
the TLS handshake and the driver layer read as genuine, and why it passes most detection
|
||||
checks that inspect the browser. It does not supply a clean IP, per-account quotas, rate
|
||||
limits, or human timing. You bring a reputable exit and sane pacing; the browser brings the
|
||||
part that has to look real. A closed DNS leak is one clean surface among several, not a
|
||||
finish line.
|
||||
|
||||
## Conclusion
|
||||
|
||||
A proxy can leak DNS whenever the host resolves names locally while the connection exits
|
||||
elsewhere. Over SOCKS5 the fix is to hand the proxy a hostname to resolve at the exit rather
|
||||
than an address you resolved at home, so names and connections leave from the same place.
|
||||
DoH is a companion, not a replacement: it encrypts the lookup in transit but does not by
|
||||
itself move where the lookup exits. Verify positively, comparing the connection exit against
|
||||
the resolver-side address, and remember that closing the leak fixes location consistency,
|
||||
not the reputation of the address you exit from.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does using a proxy hide my DNS?** Only if the proxy does the name resolution. If your
|
||||
host resolves the name and then hands the proxy an IP, the lookup left your real network
|
||||
and the connection did not, which is a DNS leak.
|
||||
|
||||
**What is the difference between remote and local DNS resolution?** Local means your machine
|
||||
resolves the hostname before contacting the proxy; remote means the proxy resolves it at the
|
||||
exit. SOCKS5 supports both, and only remote resolution keeps names and connections exiting
|
||||
together.
|
||||
|
||||
**Does DNS-over-HTTPS stop a DNS leak?** Not by itself. DoH encrypts the query so the path
|
||||
cannot read it, but if the encrypted query still leaves from your real network the leak of
|
||||
location is unchanged. It answers "is my lookup readable", not "where does my lookup exit".
|
||||
|
||||
**Does invisible_playwright leak DNS?** No. It resolves DNS through the proxy by default, so
|
||||
the name and the connection exit from the same place. You just pass a SOCKS5 proxy the normal
|
||||
way.
|
||||
|
||||
**How do I check for a DNS leak?** Positively, through the browser session and not on
|
||||
localhost. Compare the exit IP the destination sees against the address a resolver-echo
|
||||
service reports; if they disagree in location, you have a leak.
|
||||
|
||||
**If my DNS no longer leaks, am I safe?** It fixes location consistency, not IP reputation.
|
||||
A datacenter or blocklisted exit is still a datacenter or blocklisted exit after the leak is
|
||||
closed.
|
||||
|
||||
## Sources
|
||||
|
||||
- The SOCKS5 protocol's two connect modes (address versus hostname), defined in
|
||||
[RFC 1928](https://datatracker.ietf.org/doc/html/rfc1928), which is the mechanism that
|
||||
makes proxy-side resolution possible at all.
|
||||
- DNS Queries over HTTPS (DoH), standardized in
|
||||
[RFC 8484](https://datatracker.ietf.org/doc/html/rfc8484), which encrypts the resolver
|
||||
query in transit without changing where it exits.
|
||||
- This project's proxy handling, which routes DNS through the proxy by default rather than
|
||||
through the host resolver, and refuses a proxy endpoint given without an explicit port
|
||||
rather than launching unproxied.
|
||||
- The release gates behind the network pages in this set, including the exit-consistency and
|
||||
WebRTC checks, which all assert a present, correct signal rather than the absence of a
|
||||
wrong one.
|
||||
|
||||
**See also:** [how to check a proxy for an IP leak](how-to-check-proxy-ip-leak.md),
|
||||
[SOCKS5 vs HTTP proxy for a browser](socks5-vs-http-proxy-browser.md), and
|
||||
[Playwright SOCKS5 proxy with authentication](playwright-socks5-proxy-authentication.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 default that keeps DNS and
|
||||
the connection exiting together is the whole point of this page; the reputation of the exit is
|
||||
still yours to bring.*
|
||||
@@ -0,0 +1,253 @@
|
||||
---
|
||||
title: "Does a VPN stop browser fingerprinting?"
|
||||
description: "A VPN changes the IP a server sees, not the browser fingerprint. Why canvas, WebGL, fonts and timezone survive the tunnel, and what actually covers the fingerprint half."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 12
|
||||
---
|
||||
|
||||
|
||||
# Does a VPN stop browser fingerprinting?
|
||||
|
||||
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
|
||||
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
|
||||
backfire, and what has to cover the half it cannot.
|
||||
|
||||
## What a VPN actually changes
|
||||
|
||||
A VPN routes your traffic through a server somewhere else and presents that server's
|
||||
address as the origin of every request. From the server's point of view, you are in
|
||||
the country the exit sits in, on the network the exit belongs to. That is genuinely
|
||||
useful and it is the entire effect: one field, the source IP, is replaced.
|
||||
|
||||
Everything a detector reads from *inside* the page is untouched, because none of it
|
||||
travels through the tunnel as a value the VPN can rewrite. The page runs JavaScript
|
||||
on your actual machine and asks your actual browser questions. The tunnel carries the
|
||||
answers without changing them.
|
||||
|
||||
So the honest split is: a VPN is the network half. The fingerprint half is a
|
||||
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
|
||||
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
|
||||
[WebGL](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API).** The hash of a
|
||||
rendered image and the GPU vendor and renderer strings come from your graphics stack.
|
||||
A tunnel does not touch the graphics stack.
|
||||
- **Fonts.** The installed-font list is read from the operating system. It still
|
||||
describes your real machine, and if that is a server it still describes a server.
|
||||
- **User agent and platform.**
|
||||
[`navigator.userAgent`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgent),
|
||||
[`navigator.platform`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/platform),
|
||||
[`navigator.oscpu`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/oscpu)
|
||||
report the browser you are actually running.
|
||||
- **Hardware counters.**
|
||||
[`hardwareConcurrency`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/hardwareConcurrency),
|
||||
[`deviceMemory`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/deviceMemory),
|
||||
the audio device sample rate, the screen dimensions and device pixel ratio all come
|
||||
from the box the browser runs on.
|
||||
- **Timezone.**
|
||||
[`Intl.DateTimeFormat().resolvedOptions().timeZone`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat)
|
||||
reads your system clock's zone, which is set by your operating system, not by your
|
||||
exit.
|
||||
|
||||
A commercial system hashes many of these together into a stable identifier. That
|
||||
identifier is stable *across* IP changes by design, which means switching VPN exits
|
||||
does not make you a new visitor. It makes you the same visitor from a new address,
|
||||
which is its own pattern.
|
||||
|
||||
## When a VPN makes you more suspicious, not less
|
||||
|
||||
This is the part most guides skip. A VPN does not just fail to help the fingerprint
|
||||
layer. It can actively contradict itself.
|
||||
|
||||
**The timezone that does not move.** Your exit is in one country; your system clock
|
||||
is still in another. A detector reads the exit's geolocation and the browser's
|
||||
reported timezone and sees two different places. A plain browser with no VPN at least
|
||||
tells one consistent story. A VPN with an unaligned clock tells two, and disagreement
|
||||
between values that should agree is precisely
|
||||
[what timezone-versus-proxy checks look for](timezone-proxy-mismatch.md).
|
||||
|
||||
**The address that leaks past the tunnel.**
|
||||
[WebRTC](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API) can enumerate
|
||||
network candidates directly and, depending on configuration, surface an address the
|
||||
VPN was supposed to hide, printed right next to the exit. That is the strongest
|
||||
possible contradiction: the browser volunteering the very thing the tunnel exists to
|
||||
conceal. It also fails the other way, returning nothing at all, which is itself a
|
||||
signal that something is suppressing the API. Getting these to agree is a surface of
|
||||
its own, covered in
|
||||
[making the WebRTC address match the exit](webrtc-ip-match-proxy-exit.md).
|
||||
|
||||
**The reputation the exit already carries.** A shared VPN endpoint has been used by
|
||||
thousands of other people, and a busy exit accumulates a reputation that has nothing
|
||||
to do with your fingerprint. A perfectly ordinary browser on a known-bad exit is
|
||||
detected on the exit alone.
|
||||
|
||||
None of these three is a fingerprint fix. Two of them are new ways to fail that you
|
||||
did not have before you connected.
|
||||
|
||||
## The fingerprint half: what invisible_playwright controls
|
||||
|
||||
invisible_playwright is a Firefox patched at the C++ level and driven by stock
|
||||
Playwright. It is built to look like a real browser driven by a real person, which is
|
||||
why the fingerprint, the TLS handshake and the driver layer read as a genuine
|
||||
Firefox rather than as automation. It owns the half a VPN cannot reach: it derives a
|
||||
complete, internally consistent identity - GPU, canvas, audio, fonts, screen, roughly
|
||||
400 fields - from a single seed, so the values agree with each other instead of being
|
||||
a plausible field sitting next to a contradicting one.
|
||||
|
||||
Switching from plain Playwright is a two-line change, and the browser it returns is a
|
||||
real Playwright `Browser` with every standard method:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# proxy = the network half; the fingerprint half is handled by the engine
|
||||
proxy = {"server": "socks5://gate.example.com:1080", "username": "u", "password": "p"}
|
||||
|
||||
with InvisiblePlaywright(seed=42, proxy=proxy) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# navigator.userAgent, canvas hash, WebGL strings, fonts and timezone
|
||||
# all describe one coherent machine, and the timezone follows the exit
|
||||
```
|
||||
|
||||
Pass a `seed` and every field it implies comes back identical run after run, so a
|
||||
session you want to reproduce is reproducible. Omit it and each session gets a
|
||||
distinct identity. Either way, the fingerprint the page reads is a coherent whole
|
||||
rather than your real machine wearing a new IP.
|
||||
|
||||
## Aligning timezone and geolocation to the exit
|
||||
|
||||
The specific failure a VPN introduces - a clock that contradicts the exit - is the
|
||||
one the engine closes automatically. By default the browser timezone is derived from
|
||||
the egress IP: the proxy exit if a proxy is set, otherwise the host's own public
|
||||
address. The clock follows the exit instead of staying pinned to the host.
|
||||
|
||||
```python
|
||||
# default: timezone auto-derived from the egress IP, so the clock matches the exit
|
||||
with InvisiblePlaywright(proxy=proxy) as browser:
|
||||
...
|
||||
|
||||
# an explicit IANA zone always wins, when you need to force one
|
||||
with InvisiblePlaywright(proxy=proxy, timezone="America/New_York") as browser:
|
||||
...
|
||||
```
|
||||
|
||||
The geolocation and locale surfaces are aligned to the same exit rather than left to
|
||||
disagree. When the network path cannot reach an external lookup, the derivation still
|
||||
resolves from a bundled dataset rather than falling back to the host's zone, which is
|
||||
[why the timezone stays correct offline](offline-geoip-timezone-proxy.md). The result
|
||||
is that the tunnel and the browser tell one story, which is what a VPN on its own
|
||||
cannot arrange.
|
||||
|
||||
## Measuring the difference
|
||||
|
||||
The claim is checkable, and checking it is the point. Run a fingerprinting report
|
||||
twice through the same exit: once with a stock Firefox pointed at the VPN, once with
|
||||
invisible_playwright pointed at the same proxy, and diff the two reports field by
|
||||
field rather than reading the scores.
|
||||
|
||||
With the stock browser, the address at the top matches the exit and the rows below it
|
||||
describe your real machine, including a timezone that may sit on a different continent
|
||||
from the address. With the engine, the address matches the exit *and* the rows below
|
||||
it describe one coherent machine whose clock, locale and geolocation sit in the same
|
||||
place as the exit. The delta is every fingerprint field plus the timezone alignment -
|
||||
which is exactly the half the VPN left untouched in the first report.
|
||||
|
||||
Run it at least ten times and space the runs out. This domain is non-deterministic,
|
||||
and a single green run is not a result.
|
||||
|
||||
## What invisible_playwright does not do
|
||||
|
||||
The honest caveat, because overclaiming is both false and a liability. The engine
|
||||
covers the fingerprint, the TLS layer and the driver tells. It does not supply the
|
||||
network half and it cannot repair it:
|
||||
|
||||
- **IP reputation.** A poor-reputation exit is detected on its own, whatever the
|
||||
fingerprint looks like. You supply a clean proxy; the engine does not launder a
|
||||
dirty one.
|
||||
- **Per-account quotas and rate limits.** These are counted server-side against your
|
||||
account or your address, not read from the browser. Pacing is yours to manage.
|
||||
- **Behaviour and timing.** Pointer motion is generated on a Bezier curve, but the
|
||||
rhythm of a whole session - how fast you move between actions, whether an agent
|
||||
pauses in a shape that looks like model latency - is yours to shape.
|
||||
|
||||
The framing that holds up: a VPN is the network half and invisible_playwright is the
|
||||
fingerprint half. You need both, and a clean exit and human pacing on top of both.
|
||||
|
||||
## Conclusion
|
||||
|
||||
A VPN answers exactly one question a detector asks - where is this request coming
|
||||
from - and leaves every other question answered by your real machine. On a bad day it
|
||||
adds two contradictions, a stranded timezone and a WebRTC leak, that a plain browser
|
||||
would not have produced. It is a necessary piece and not a sufficient one.
|
||||
|
||||
Cover the fingerprint layer with something built to look like a real browser, align
|
||||
the clock and geolocation to the exit so the two halves agree, put a clean IP under
|
||||
it, and pace the session like a person. A VPN does one of those four. Treat it as one
|
||||
of four, not as the answer, and it does its job.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does a VPN change my browser fingerprint?** No. It changes the source IP and
|
||||
nothing the page reads from inside the browser: canvas, WebGL, fonts, user agent,
|
||||
timezone and hardware are unchanged.
|
||||
|
||||
**Can a VPN make detection worse?** Yes. If your system timezone does not match the
|
||||
exit, or WebRTC leaks an address past the tunnel, you have handed a detector a
|
||||
contradiction it would not otherwise have.
|
||||
|
||||
**Is a VPN the same as a proxy here?** For this purpose, close enough: both replace
|
||||
the visible IP and neither touches the fingerprint. The engine takes a proxy directly
|
||||
and aligns the browser's timezone to that exit.
|
||||
|
||||
**Will a VPN hide that I am automating?** No. Automation tells and the fingerprint
|
||||
live in the browser, not the network. The address is the one thing the tunnel moves.
|
||||
|
||||
**Do I still need a good IP if my fingerprint is perfect?** Yes. A coherent browser
|
||||
on a known-bad exit is detected on the exit alone. The two halves are independent.
|
||||
|
||||
**Does invisible_playwright include a VPN or proxy?** No. It handles the fingerprint,
|
||||
TLS and driver layers and aligns the timezone to whatever exit you pass. You supply
|
||||
the clean IP.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's release gates, including the WebRTC gate whose negative-only checks
|
||||
once passed on a feature that was returning nothing, and the timezone derivation
|
||||
that resolves the zone from the egress address.
|
||||
- The public fingerprinting suites - CreepJS, BotD, FingerprintJS, sannysoft and
|
||||
BrowserLeaks - read field by field before and after a VPN, which is where the
|
||||
"one field changed, the rest did not" observation comes from.
|
||||
- [MDN: `Navigator.userAgent`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgent),
|
||||
[`Navigator.platform`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/platform)
|
||||
and [`Navigator.oscpu`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/oscpu),
|
||||
the browser-reported properties a VPN cannot rewrite.
|
||||
- [MDN: `Navigator.hardwareConcurrency`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/hardwareConcurrency),
|
||||
[`Navigator.deviceMemory`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/deviceMemory)
|
||||
and [`Intl.DateTimeFormat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat),
|
||||
the hardware and clock surfaces read straight from the host.
|
||||
- [MDN: the Canvas API](https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API),
|
||||
[the WebGL API](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API) and
|
||||
[the WebRTC API](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API), the
|
||||
graphics and networking surfaces a tunnel does not reach.
|
||||
|
||||
**See also:** [when the timezone does not match the proxy](timezone-proxy-mismatch.md)
|
||||
for the contradiction a VPN introduces, and
|
||||
[what no in-page test can see about the TLS handshake](ja3-ja4-tls-fingerprint.md) for
|
||||
the network layer neither a VPN nor a fingerprint fix reaches from JavaScript.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The fingerprint half is
|
||||
what it controls; the clean IP and the human pacing are still yours to supply.*
|
||||
@@ -0,0 +1,209 @@
|
||||
---
|
||||
title: "Does chaining two proxies help avoid detection?"
|
||||
description: "Chaining two proxies hides your origin from the first operator, but the target only ever scores the last exit IP - here is what a proxy chain changes and what it does not."
|
||||
parent: "Network, Proxy and WebRTC"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 27
|
||||
---
|
||||
|
||||
# Does chaining two proxies help avoid detection?
|
||||
|
||||
Chaining proxies is one of those ideas that sounds like it should stack: if one hop
|
||||
hides you, two hops must hide you more, and a site scoring your traffic should see
|
||||
something twice as clean. It is a reasonable intuition and it is measuring the wrong
|
||||
thing.
|
||||
|
||||
The target of your request sees exactly one address: the exit of the last hop. It has
|
||||
no way to know whether that packet reached the last hop directly from your machine or
|
||||
through five relays first, because a chain is invisible past its final link. So the
|
||||
question this page answers honestly: a chain changes who can trace the traffic back to
|
||||
you, not what the destination scores. Those are two different goals, and only one of
|
||||
them is about detection.
|
||||
|
||||
## What the destination actually sees
|
||||
|
||||
A web server terminates a TCP connection from one peer. That peer is whatever machine
|
||||
opened the socket to it, which for a proxied request is the last hop's exit. Every
|
||||
signal the server can derive from the network layer - the source IP, its
|
||||
[ASN and reputation](can-websites-detect-a-datacenter-proxy-ip.md), the reverse DNS,
|
||||
the country, whether the range is residential or datacenter - is a property of that one
|
||||
exit and nothing behind it.
|
||||
|
||||
Add a second proxy in front of the first and the picture at the destination does not
|
||||
move. The exit is still the exit. If that final IP sits in a flagged datacenter range,
|
||||
a second hop upstream of it does not launder the range, because the range that gets
|
||||
scored is the one the packet leaves from. If the final IP is a clean residential
|
||||
address, one hop or three hops behind it score identically.
|
||||
|
||||
This is the specific fact worth internalising: **the number of hops is not a field the
|
||||
target can read.** It reads the last one and stops.
|
||||
|
||||
## Where a chain genuinely helps: who can trace you
|
||||
|
||||
A chain is not useless. It solves a real problem, just not the detection one.
|
||||
|
||||
With a single proxy, the operator of that proxy sees both ends: your real address on
|
||||
the way in and the destination on the way out. They can correlate the two. Chaining
|
||||
splits that knowledge across operators. The first hop sees your origin but not your
|
||||
destination; the last hop sees your destination but not your origin. No single operator
|
||||
holds both halves unless they collude or share ownership.
|
||||
|
||||
That is an operational-privacy property, and it is a real one:
|
||||
|
||||
- **Trust splitting.** You stop trusting any one provider with the full picture of who
|
||||
is talking to what.
|
||||
- **Jurisdiction separation.** Placing hops in different legal jurisdictions raises the
|
||||
cost of compelling a single operator to hand over a correlation that no single
|
||||
operator has.
|
||||
- **Origin concealment from the entry node.** If you do not want the entry provider to
|
||||
log your real IP against your traffic, a hop in front of it removes that link.
|
||||
|
||||
None of these change the score the destination computes. They change who could later
|
||||
reconstruct the path. If your goal is "this site should not treat me as automated," a
|
||||
chain does not address it. If your goal is "no single intermediary can build a profile
|
||||
of my origin plus my destinations," a chain is exactly the tool.
|
||||
|
||||
## What a chain costs
|
||||
|
||||
Two hops are not free, and the costs land on the axes detection actually watches.
|
||||
|
||||
**Latency stacks.** Every hop adds a round trip and its own processing delay. A chain
|
||||
that crosses two continents can add hundreds of milliseconds per request. Slow,
|
||||
irregular response times are themselves a weak behavioural signal, and they make
|
||||
human-like pacing harder to hit because your own timing floor is now higher and noisier.
|
||||
|
||||
**Failure points multiply.** A single proxy is one thing that can drop, throttle, or
|
||||
inject. A chain is two, in series, and the compound reliability is the product of the
|
||||
two. If each hop is up 99 percent of the time, the chain is up about 98 percent, and a
|
||||
mid-session hop failure looks to the site like an abandoned or truncated session.
|
||||
|
||||
**The weakest exit still governs the score.** You can put a pristine entry node in front
|
||||
of a tired, over-shared exit and gain nothing at the destination, because the exit is
|
||||
what gets measured. Spending effort on the hop the target cannot see, while the hop it
|
||||
can see stays dirty, is the common way a chain disappoints.
|
||||
|
||||
## How invisible_playwright fits: one server, chain built upstream
|
||||
|
||||
invisible_playwright routes the browser to a single proxy server. It writes the
|
||||
[SOCKS](https://datatracker.ietf.org/doc/html/rfc1928) or HTTP preferences for one
|
||||
endpoint and sends traffic there. It does not build a chain inside the browser, and
|
||||
there is no per-request multi-hop setting to configure, because a chain is an upstream
|
||||
network arrangement, not a browser feature.
|
||||
|
||||
If you want a chain, you build it below the address you hand the wrapper: the endpoint
|
||||
you configure is the entry to your chain, and whatever it forwards to is your business
|
||||
and invisible to both the browser and the destination. From the wrapper's point of view
|
||||
it is one server - the same single `server` plus optional credentials shape that
|
||||
[Playwright itself documents](https://playwright.dev/python/docs/network#http-proxy)
|
||||
for launching a browser, passed straight through.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# One endpoint. If this endpoint happens to be the entry of a chain you run
|
||||
# upstream, the browser neither knows nor needs to - it sees a single hop.
|
||||
proxy = {
|
||||
"server": "socks5://entry.example.com:1080",
|
||||
"username": "user",
|
||||
"password": "pass",
|
||||
}
|
||||
|
||||
with InvisiblePlaywright(seed=42, proxy=proxy) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# Read back the address the destination actually attributes to you -
|
||||
# this is the LAST hop's exit, whatever sits behind it.
|
||||
print(page.inner_text("body"))
|
||||
```
|
||||
|
||||
The `browser` returned is a real Playwright `Browser`; every documented method works
|
||||
unchanged. The important line is the last one: point it at a service that echoes the
|
||||
requesting IP and you will read the exit of your chain, the same single address the
|
||||
destination reads. Confirm it inside the browser rather than assuming it, and let
|
||||
[the browser timezone auto-derive from that exit](timezone-proxy-mismatch.md) so the
|
||||
address and the clock tell the same story.
|
||||
|
||||
## Why the fingerprint is the part chaining cannot touch
|
||||
|
||||
Here is the honest framing of what this product does and does not do.
|
||||
|
||||
invisible_playwright is a Firefox patched at the C++ level and driven by stock
|
||||
Playwright, built to look like a real browser operated by a real person. That is why it
|
||||
passes most detection checks that live in the browser: the fingerprint (GPU, canvas,
|
||||
audio, fonts, screen, roughly 400 fields, seed-reproducible), the TLS handshake and the
|
||||
driver layer all read as a genuine Firefox rather than an automated one. A CreepJS,
|
||||
BotD, FingerprintJS or sannysoft run reads it as an ordinary browser because at those
|
||||
layers it is one.
|
||||
|
||||
A proxy chain sits entirely below all of that. It cannot improve a fingerprint, because
|
||||
the fingerprint is computed in the browser and shipped over whatever network you use. It
|
||||
cannot fix a datacenter exit's reputation, per-account quotas, rate limits, or the
|
||||
timing of your behaviour. Those are yours to supply: a clean exit,
|
||||
[the right kind of proxy for the job](residential-datacenter-mobile-proxies-explained.md),
|
||||
human pacing, and quotas you respect.
|
||||
|
||||
So the two layers are orthogonal. The browser makes you look like a real person's
|
||||
browser. The exit IP decides whether that browser is arriving from an address the site
|
||||
trusts. A chain rearranges trust among your proxy operators and does nothing to either
|
||||
of those. If the exit is bad, chaining behind it does not help; the fix is a better
|
||||
exit, or [rotating exits deliberately rather than accidentally](how-to-rotate-proxies-playwright.md).
|
||||
|
||||
## Conclusion
|
||||
|
||||
Chaining two proxies is a privacy tool, not a detection tool. It changes who can trace
|
||||
your traffic back to you by splitting that knowledge across operators and jurisdictions,
|
||||
and it does so at the cost of latency and an extra failure point. What it does not
|
||||
change is the one thing the destination measures: the last exit's IP, its ASN and its
|
||||
reputation. That value is identical whether one hop or three sit behind it.
|
||||
|
||||
If you are being scored as automated, look at the exit's reputation and the browser's
|
||||
realness, not the number of hops. invisible_playwright handles the browser realness and
|
||||
routes to a single server; the chain, if you want one, is something you build upstream
|
||||
of that server for reasons that have nothing to do with the site's verdict.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does chaining two proxies make me harder to detect?** Not at the destination. It sees
|
||||
only the last exit IP, so the chain behind it is invisible to the site's scoring.
|
||||
|
||||
**Then what is a proxy chain good for?** Hiding your origin from the first proxy
|
||||
operator and splitting trust across operators and jurisdictions, so no single
|
||||
intermediary sees both your origin and your destination.
|
||||
|
||||
**Will a chain clean up a bad exit IP?** No. The final hop is what gets scored. A clean
|
||||
entry node in front of a flagged exit gains nothing at the target.
|
||||
|
||||
**Does invisible_playwright support multi-hop proxies?** It routes to one server. A
|
||||
chain is built upstream of the endpoint you configure, not inside the browser, and the
|
||||
browser sees a single hop.
|
||||
|
||||
**What is the cost of chaining?** Added latency at every hop and a second serial failure
|
||||
point, so the compound uptime drops and your timing floor rises.
|
||||
|
||||
**If chaining does not help detection, what does?** A trustworthy exit IP plus a browser
|
||||
that reads as a real one at the fingerprint, TLS and driver layers, together with human
|
||||
pacing and quotas you respect.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's proxy handling, which configures a single endpoint per session and
|
||||
auto-derives the browser timezone from that endpoint's egress.
|
||||
- The network-layer fact that a TCP peer is the last hop only: a destination reads the
|
||||
exit's address and cannot enumerate hops behind it.
|
||||
- The release gates that measure fingerprint realness in the browser, which is a layer
|
||||
no proxy arrangement touches in either direction.
|
||||
- [RFC 1928, "SOCKS Protocol Version 5"](https://datatracker.ietf.org/doc/html/rfc1928),
|
||||
the protocol a proxy endpoint speaks.
|
||||
- [Playwright's own proxy configuration docs](https://playwright.dev/python/docs/network#http-proxy),
|
||||
which document the single-endpoint `server`/`username`/`password` shape used above.
|
||||
|
||||
**See also:** [can websites detect a datacenter proxy IP](can-websites-detect-a-datacenter-proxy-ip.md),
|
||||
[sticky versus rotating proxy sessions](sticky-vs-rotating-proxy-sessions.md), and
|
||||
[why you might still be blocked with a clean fingerprint](why-blocked-with-a-clean-fingerprint.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 browser is built to
|
||||
look real; the exit IP is still yours to choose, and a chain changes who can trace it,
|
||||
not what the site scores.*
|
||||
@@ -0,0 +1,201 @@
|
||||
---
|
||||
title: "Does clearing cookies stop fingerprint tracking?"
|
||||
description: "No. Cookies are stateful and clearable, but fingerprinting is stateless and rebuilds the same identity from canvas, WebGL, fonts, audio and TLS every clear."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 27
|
||||
---
|
||||
|
||||
|
||||
# Does clearing cookies stop fingerprint tracking?
|
||||
|
||||
Short version: no. Clearing cookies deletes something the site handed you and asked
|
||||
you to hold. Fingerprinting never handed you anything to delete. It reads what your
|
||||
browser is, every time you show up, and rebuilds the same identifier from scratch.
|
||||
That is not an accident of the design, it is the whole point of it: fingerprinting
|
||||
exists precisely because cookies can be cleared and it wanted an identifier that
|
||||
could not.
|
||||
|
||||
This page explains the difference between the two, why the second one ignores the
|
||||
first, what does change the identity, and where the honest limits of the fingerprint
|
||||
layer are.
|
||||
|
||||
## What a cookie is, and what a fingerprint is
|
||||
|
||||
A cookie is state. The site writes a value into your browser, your browser stores it,
|
||||
and it sends it back on the next request. Because it is stored, it can be deleted, and
|
||||
when you clear it the site has to start over. This is a real, working privacy control
|
||||
for the thing it controls.
|
||||
|
||||
A fingerprint is not stored anywhere on your machine for you to clear. It is computed
|
||||
on the spot from properties your browser exposes: how it draws a
|
||||
[canvas](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL),
|
||||
which GPU and renderer string it reports through
|
||||
[WebGL](https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_debug_renderer_info),
|
||||
which fonts it can load, how its
|
||||
[audio stack](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API)
|
||||
processes a signal, and, below the page entirely, how its TLS handshake looks. The
|
||||
site hashes those together into an identifier. There is no file to remove because none
|
||||
of it was ever written down on your side.
|
||||
|
||||
So the two answer different questions. A cookie asks "did I give you a token before?"
|
||||
A fingerprint asks "are you the same machine as before?" Clearing the first has no
|
||||
effect on the second.
|
||||
|
||||
## Why fingerprinting survives the clear
|
||||
|
||||
Stateful versus stateless is the entire story.
|
||||
|
||||
Clear your cookies, clear local storage, open a private window, and then reload a
|
||||
fingerprinting page. The canvas still draws the same pixels, so it hashes to the same
|
||||
value. WebGL still reports the same renderer. The font probe still finds the same
|
||||
list. The audio path still returns the same numbers. Combine those and you get the
|
||||
same identifier you had five minutes ago, because none of the inputs changed. The
|
||||
[FingerprintJS visitor ID is a hash of exactly these components](fingerprintjs-visitor-id.md),
|
||||
and a hash of unchanged inputs is unchanged output.
|
||||
|
||||
This is why "clear cookies between sessions" does not rotate you a new identity. It
|
||||
rotates the one thing that was trivial to rotate and leaves untouched every signal
|
||||
that was hard to. A detector that leans on the fingerprint rather than the cookie is
|
||||
built specifically to not care what you did to your storage.
|
||||
|
||||
The corollary matters for automation: if you run a loop that clears cookies between
|
||||
iterations expecting to look like a fresh visitor each time, every iteration presents
|
||||
the identical fingerprint. You have not created many visitors, you have created one
|
||||
visitor who keeps deleting their cookies, which is itself a pattern.
|
||||
|
||||
## What actually changes the identity
|
||||
|
||||
If the identifier is a hash of canvas, WebGL, fonts, audio and TLS, then the only way
|
||||
to present a different identity is to change those underlying values so they hash
|
||||
differently, and to change them together so they still agree with one another. A canvas
|
||||
that says one machine next to a font list that says another is not a new identity, it
|
||||
is a contradiction, and [contradictions are what the tampering-focused suites look for](creepjs-explained.md).
|
||||
|
||||
That is a much harder thing to do than emptying a cookie jar, which is the reason a
|
||||
cookie clear can never do it. The cleared browser still renders canvas the same way and
|
||||
still reports the same fonts. Changing those values in a self-consistent way is what a
|
||||
fingerprint-management layer is for, and it is what invisible_playwright does per seed.
|
||||
|
||||
## Doing it with invisible_playwright
|
||||
|
||||
The product gives each seed a distinct, internally self-consistent fingerprint: a
|
||||
different GPU, canvas hash, audio context, font set and screen, all derived together
|
||||
so they agree with each other. Switching seeds is what a cookie clear is trying and
|
||||
failing to be.
|
||||
|
||||
The launch is the standard two-line change, and the object you get back is a real
|
||||
Playwright `Browser` with every method intact:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# Seed A: one self-consistent machine
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# canvas, WebGL, fonts, audio all derived from seed 42
|
||||
|
||||
# Seed B: a genuinely different machine, not the same one with cookies wiped
|
||||
with InvisiblePlaywright(seed=1337) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# different canvas hash, different renderer, different fonts
|
||||
```
|
||||
|
||||
Two different seeds produce two different fingerprints. The same seed produces the
|
||||
same one every run, which is the property that makes a failing run reproducible
|
||||
instead of a guess:
|
||||
|
||||
```python
|
||||
# Same seed, same identity, every run - the opposite of "clear and hope"
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# identical canvas hash and renderer to any other seed=42 run
|
||||
```
|
||||
|
||||
If you want an identity to persist across separate sessions on purpose, that is a
|
||||
profile decision rather than a cookie one: see [persistent profiles](persistent-profiles.md)
|
||||
for keeping the same seed and storage across runs, and [cross-platform canvas and WebGL consistency](canvas-webgl-cross-platform-consistency.md)
|
||||
for why the drawn pixels have to match the reported hardware on every OS you deploy to.
|
||||
|
||||
## The honest caveat: this is the fingerprint layer only
|
||||
|
||||
A distinct, self-consistent fingerprint is what makes invisible_playwright read as a
|
||||
genuine Firefox driven by a real person, and it is why it passes most fingerprint, TLS
|
||||
and driver-layer checks. It is not a claim that everything about you rotates when the
|
||||
seed does.
|
||||
|
||||
Two things are tracked independently of both cookies and fingerprint, and the reader
|
||||
supplies the answers to them:
|
||||
|
||||
- **Your IP and its reputation.** A brand-new fingerprint arriving from the same
|
||||
datacenter address as the last hundred requests is still that address. The exit is
|
||||
yours to choose, and a clean one matters as much as the browser does.
|
||||
- **Account and behaviour state.** Per-account quotas, rate limits, session age and the
|
||||
rhythm of what you do are counted against the account and the address, not the
|
||||
fingerprint. Change the seed all you like, a burst of identical requests at machine
|
||||
speed still reads as a burst. Human pacing is yours to supply.
|
||||
|
||||
So the accurate statement is: changing the fingerprint changes the fingerprint. It
|
||||
helps a lot with the layer that reconstructs identity from canvas and TLS, and it does
|
||||
nothing on its own for the layer that watches your address and your behaviour. Both
|
||||
have to be right, and they are separate jobs.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Clearing cookies removes the identifier the site stored on your side. Fingerprinting
|
||||
was designed for exactly the world where people clear cookies, so it stores nothing on
|
||||
your side and recomputes the identity from canvas, WebGL, fonts, audio and TLS every
|
||||
time. The only way to look like a different visitor is to change those values together,
|
||||
which a cookie clear cannot do and a per-seed fingerprint can. Just remember that this
|
||||
is the fingerprint layer alone: your IP and your account behaviour are tracked on their
|
||||
own, and they need their own clean inputs.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does clearing cookies stop fingerprinting?** No. Cookies are stored and deletable,
|
||||
the fingerprint is recomputed from your browser's properties every visit, so a clear
|
||||
leaves it unchanged.
|
||||
|
||||
**Does incognito or a private window give me a new fingerprint?** No. Private mode
|
||||
clears storage, not the canvas, WebGL, font, audio and TLS values the fingerprint is
|
||||
built from. Same machine, same fingerprint.
|
||||
|
||||
**Then how do I actually change my fingerprint?** By changing the underlying values in
|
||||
a self-consistent way. In invisible_playwright that is a different seed, which redraws
|
||||
the GPU, canvas, fonts, audio and screen together so they still agree.
|
||||
|
||||
**If I clear cookies in a loop, do I look like many visitors?** No. Every iteration
|
||||
presents the same fingerprint, so you look like one visitor repeatedly clearing
|
||||
cookies, which is its own pattern.
|
||||
|
||||
**Does a new fingerprint fix a blocked IP?** No. The address and its reputation are
|
||||
tracked independently of both cookies and fingerprint. A clean exit is a separate
|
||||
requirement you supply yourself.
|
||||
|
||||
**Will a per-seed fingerprint make me undetectable?** No, and be wary of anything that
|
||||
says it will. It makes the fingerprint, TLS and driver layer read as a real Firefox,
|
||||
which is most checks but not all of them. Behaviour, pacing and IP are still on you.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's fingerprint generator, which derives canvas, WebGL, font, audio and
|
||||
screen values together from a single seed so a new identity is internally consistent.
|
||||
- The public detection suites named across this set, read for which components feed
|
||||
the identifier and which of them a storage clear leaves untouched.
|
||||
- The release gates that separate the fingerprint layer from IP and behaviour, so a
|
||||
clean fingerprint is never mistaken for a clean session.
|
||||
|
||||
**See also:** [the FingerprintJS visitor ID](fingerprintjs-visitor-id.md) for what the
|
||||
hash is actually made of, [persistent profiles](persistent-profiles.md) for keeping one
|
||||
identity on purpose, and [the JA3/JA4 TLS fingerprint](ja3-ja4-tls-fingerprint.md) for
|
||||
the layer that no amount of cookie clearing or JavaScript ever reaches.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. Every session gets a
|
||||
distinct, self-consistent fingerprint from its seed, which is the thing a cookie clear
|
||||
was always trying and failing to be.*
|
||||
@@ -0,0 +1,195 @@
|
||||
---
|
||||
title: "Does Playwright Change My Browser Fingerprint?"
|
||||
description: "Stock Playwright does not randomize your fingerprint - it inherits the host browser's real values, which is how a Linux server leaks past a spoofed Windows user agent."
|
||||
parent: "The Automation Layer"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 23
|
||||
---
|
||||
|
||||
|
||||
# Does Playwright Change My Browser Fingerprint?
|
||||
|
||||
Short version: no. Stock Playwright launches a browser and hands you whatever that
|
||||
browser reports on the machine it runs on. It does not randomize the fingerprint, it
|
||||
does not repair it, and it does not make it look like anything other than what it is.
|
||||
That surprises people who expected the automation layer to also be a disguise layer,
|
||||
and the surprise usually arrives as a block on a server that worked fine on a laptop.
|
||||
|
||||
This page is what Playwright does and does not touch, the specific trap that catches
|
||||
server deployments, and where a seed-derived identity replaces the values you inherit.
|
||||
|
||||
## What Playwright actually does to the fingerprint
|
||||
|
||||
Playwright drives a browser. It does not synthesize one. When you call
|
||||
[`p.firefox.launch()`](https://playwright.dev/python/docs/api/class-browsertype#browser-type-launch),
|
||||
the fingerprint you present is the real fingerprint of the real
|
||||
Firefox on the real host: its GPU string comes from the host's graphics stack, its
|
||||
font list from the host's installed fonts, its `navigator.platform` from the host OS,
|
||||
its screen metrics from the host display, its audio characteristics from the host
|
||||
audio device.
|
||||
|
||||
Playwright's job is the driver channel and the automation surface. It exposes a few
|
||||
[context knobs](https://playwright.dev/python/docs/api/class-browser#browser-new-context) -
|
||||
`user_agent`, `locale`, `timezone_id`, `viewport` - but those are
|
||||
overrides you type in, not a coherent identity. Set a `user_agent` and you have
|
||||
changed one string; every other value the page can read still comes from the machine.
|
||||
That is the gap this whole page is about.
|
||||
|
||||
So the honest answer to the title is: Playwright inherits, it does not invent. If you
|
||||
want a different machine, you have to supply one.
|
||||
|
||||
## The server-OS mismatch trap
|
||||
|
||||
Here is the exact failure, because it is the one that ships.
|
||||
|
||||
You develop on a Windows or Mac laptop, everything passes, you deploy to a Linux
|
||||
server. Now the browser reports Linux fonts, a datacenter or software GPU renderer,
|
||||
and a Linux `navigator.platform`. Then, because a lot of guides say to, you set a
|
||||
Windows `user_agent` to "look normal".
|
||||
|
||||
You have just built a contradiction. A consistency detector does not care that any
|
||||
single value is plausible. It cares whether values that must agree, do.
|
||||
[CreepJS is built specifically to catch that](creepjs-explained.md): a user agent
|
||||
claiming Windows, sitting on top of a font set that only exists on Linux, next to a
|
||||
GPU string that only exists in a datacenter. Each field is fine alone. Together they
|
||||
describe a machine that cannot exist, and that is a cleaner signal than any single bad
|
||||
value would have been.
|
||||
|
||||
None of these are automation flags. They are "this is a Linux server wearing a Windows
|
||||
costume" flags, and [they survive every JavaScript stealth plugin ever written](playwright-docker-detection.md)
|
||||
because the fonts, the GPU and the platform are not in JavaScript's gift to change.
|
||||
The [font list mismatch alone](headless-fonts-differ.md) is a one-line check on the
|
||||
detector's side.
|
||||
|
||||
## What a seed-derived identity changes
|
||||
|
||||
invisible_playwright replaces the inherited values with a generated identity, and the
|
||||
word that matters is *coherent*. From one seed it derives every surface together -
|
||||
fonts, screen, device pixel ratio, canvas, WebGL vendor and renderer, audio, timezone,
|
||||
platform - so they describe a single believable Windows machine instead of the host it
|
||||
actually runs on. The Linux server underneath stops showing through, because the page
|
||||
never reads the Linux values.
|
||||
|
||||
Two properties follow from deriving everything from one seed:
|
||||
|
||||
- **Consistency.** The user agent, the fonts, the GPU string and the platform are drawn
|
||||
as one machine, so a cross-field detector finds agreement instead of a costume. This
|
||||
is the same principle as
|
||||
[keeping canvas and WebGL consistent across platforms](canvas-webgl-cross-platform-consistency.md):
|
||||
the surfaces have to corroborate each other, not just each look normal in isolation.
|
||||
- **Reproducibility.** The same seed yields the same identity every run. A
|
||||
[FingerprintJS visitor ID](fingerprintjs-visitor-id.md) is a hash over many
|
||||
components; feed it the same seed twice and you get the same ID, which is what lets
|
||||
you replay a failing run exactly instead of hoping the next random draw reproduces it.
|
||||
|
||||
The default (no seed) still gives every session a distinct coherent identity. Passing a
|
||||
seed just pins which one.
|
||||
|
||||
## A runnable example
|
||||
|
||||
Switching from stock Playwright is a two-line change, and after that every standard
|
||||
Playwright method works unchanged, because the object you get back is a real Playwright
|
||||
`Browser`.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# same seed -> same coherent Windows identity, every run
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# navigator.platform, fonts, GPU, canvas, timezone all describe
|
||||
# ONE machine - not the Linux host this happens to run on
|
||||
print(page.evaluate("navigator.platform"))
|
||||
```
|
||||
|
||||
Run that on your laptop and on a Linux server and the reported platform, fonts and GPU
|
||||
match, because they come from the seed and not from the host. Log the seed if you did
|
||||
not pass one, and you can reproduce the run later:
|
||||
|
||||
```python
|
||||
sf = InvisiblePlaywright()
|
||||
with sf as browser:
|
||||
print("seed =", sf.seed) # replay this exact machine later
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
```
|
||||
|
||||
Async is the same shape with `from invisible_playwright.async_api import InvisiblePlaywright`
|
||||
and `await` on the page calls. There is no wrapped subset of the API to learn;
|
||||
see [the quickstart](quickstart.md) for the sync-versus-async pair side by side.
|
||||
|
||||
## The honest caveat: fingerprint is not everything
|
||||
|
||||
A coherent fingerprint fixes exactly one class of problem: the browser now reads as a
|
||||
genuine Firefox on a consistent Windows machine, at the fingerprint, TLS and driver
|
||||
layers. That is why it passes most detection checks that inspect what the browser *is*.
|
||||
|
||||
It does not fix what the browser *does*, and it does not fix where it connects from.
|
||||
A perfect, seed-stable Windows identity coming out of a datacenter IP that a thousand
|
||||
other clients are using this minute is still a datacenter IP. A perfect identity that
|
||||
fills a form in eighty milliseconds and clicks without the pointer ever passing through
|
||||
the space between two coordinates is still behaving like a script. The fingerprint is
|
||||
not a disguise for a bad exit or robotic timing, and anyone who tells you a browser
|
||||
alone makes you "undetectable" is selling the overclaim.
|
||||
|
||||
You supply the other two layers: a clean exit (see the
|
||||
[proxy and timezone notes in configuration](configuration.md), where the browser
|
||||
timezone auto-derives from the egress IP so those two stop contradicting each other),
|
||||
and human pacing. The tool makes the machine coherent. The IP and the behaviour are
|
||||
yours to get right.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Playwright does not change your fingerprint - it inherits the host's, which is exactly
|
||||
why a laptop-tested script fails on a Linux server the moment you paint a Windows user
|
||||
agent over a Linux machine. A seed-derived identity closes that gap by generating every
|
||||
surface together, so the fields corroborate one another instead of exposing the host,
|
||||
and the same seed reproduces the same machine for debugging. Pair it with a clean exit
|
||||
and human timing and it does the job it is built for. Treat it as a substitute for
|
||||
those and it will not, and no honest tool claims otherwise.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does Playwright randomize the fingerprint?** No. It launches a browser and you
|
||||
inherit that browser's real values on the host it runs on.
|
||||
|
||||
**Why does my scraper work locally but get blocked on a server?** Because the server
|
||||
reports Linux fonts, a datacenter GPU and a Linux platform, which contradict the Windows
|
||||
user agent you set. Consistency detectors read that mismatch directly.
|
||||
|
||||
**Does setting `user_agent` in Playwright change my fingerprint?** It changes one
|
||||
string. The fonts, GPU, platform, screen and audio still come from the machine, so a
|
||||
lone user-agent override usually creates a contradiction rather than hiding anything.
|
||||
|
||||
**What does a seed do?** It derives one coherent identity - fonts, screen, canvas,
|
||||
WebGL, timezone - all describing the same Windows machine, and the same seed reproduces
|
||||
it every run.
|
||||
|
||||
**Will a coherent fingerprint make me undetectable?** No. It helps with the fingerprint,
|
||||
TLS and driver layers. It does nothing for a bad IP, per-account limits, rate limits or
|
||||
robotic timing, and you have to supply those yourself.
|
||||
|
||||
**Is invisible_playwright still real Playwright?** Yes. The `browser` object is a real
|
||||
Playwright `Browser`; every documented method works unchanged.
|
||||
|
||||
## Sources
|
||||
|
||||
- Playwright's own [launch](https://playwright.dev/python/docs/api/class-browsertype#browser-type-launch)
|
||||
and [context](https://playwright.dev/python/docs/api/class-browser#browser-new-context) API,
|
||||
read for what it does and does not override.
|
||||
- This project's fingerprint generator, which derives every surface from one seed, and
|
||||
the release gates that compare a generated identity field by field against a stock
|
||||
Firefox on the same machine.
|
||||
- The public consistency detectors named across this doc set, read from their own source
|
||||
rather than from a rendered verdict.
|
||||
|
||||
**See also:** [what CreepJS actually checks](creepjs-explained.md),
|
||||
[why a container gives itself away regardless of the stealth layer](playwright-docker-detection.md),
|
||||
and [keeping canvas and WebGL consistent across platforms](canvas-webgl-cross-platform-consistency.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 server-OS mismatch in
|
||||
this page is a mistake I shipped before I built the thing that fixes it.*
|
||||
@@ -0,0 +1,201 @@
|
||||
---
|
||||
title: "Does Playwright Get Detected on the First Request?"
|
||||
description: "Yes, detection can happen before JavaScript runs: the TLS handshake and HTTP/2 settings form a fingerprint a Playwright script can contradict on request zero."
|
||||
parent: "The Automation Layer"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 27
|
||||
---
|
||||
|
||||
|
||||
# Does Playwright Get Detected on the First Request?
|
||||
|
||||
Yes, it can, and the surprising part is that it can happen before a single line
|
||||
of your page's JavaScript runs. People picture detection as something that
|
||||
inspects `navigator.webdriver` or reads a canvas hash after the page loads. Those
|
||||
are real, but they are late. The first thing a server sees from you is not a
|
||||
DOM, it is a TLS handshake and the opening frames of an HTTP/2 connection, and
|
||||
those carry a fingerprint of their own.
|
||||
|
||||
If that network fingerprint says one client while your `User-Agent` header says
|
||||
Firefox, the two disagree on request zero, before any script has a chance to
|
||||
tidy anything up. This page is about that gap, why a real patched browser does
|
||||
not have it, and the honest limits of what "no gap" buys you.
|
||||
|
||||
## What the server sees before your JavaScript runs
|
||||
|
||||
A page load is not one event, it is a sequence, and the browser has already
|
||||
described itself twice before your code executes.
|
||||
|
||||
First is the TLS handshake. The [ClientHello](https://datatracker.ietf.org/doc/html/rfc8446) message lists the cipher suites
|
||||
the client offers, the extensions it sends, the elliptic curves it supports and
|
||||
the order of all of it. That ordering is not random and it is not the same
|
||||
across clients: a given browser build produces a characteristic shape, and
|
||||
hashing that shape is what JA3 and JA4 do. [The full mechanics of how a
|
||||
handshake becomes a fingerprint](ja3-ja4-tls-fingerprint.md) are a page of their
|
||||
own, but the short version is that the network stack has a signature and the
|
||||
signature is legible.
|
||||
|
||||
Second, once the encrypted connection is up, HTTP/2 opens with a `SETTINGS`
|
||||
frame and a set of window and priority values. The exact numbers, and the order
|
||||
they arrive in, differ between engines and between an engine and a generic HTTP
|
||||
library that merely speaks the protocol. [HTTP/2 settings are a fingerprint in
|
||||
the same way](http2-fingerprint-detection.md): distinctive, sent up front, and
|
||||
impossible to edit from inside the page because the page does not exist yet.
|
||||
|
||||
Both of these are decided by whatever actually made the connection. Not by a
|
||||
header you set. Not by a property you patched. The transport layer answers for
|
||||
itself.
|
||||
|
||||
## Why the mismatch is the tell, not the fingerprint itself
|
||||
|
||||
A JA3 hash on its own is not incriminating. Plenty of legitimate clients have
|
||||
unusual handshakes. What gets flagged is a contradiction: a handshake that
|
||||
belongs to one client sitting underneath a `User-Agent` header that names a
|
||||
different one.
|
||||
|
||||
This is the same failure that shows up everywhere else in fingerprinting. A
|
||||
detector rarely asks "is this value rare". It asks "do two values that must
|
||||
agree, agree". Here the two values are the network fingerprint and the claimed
|
||||
browser. If a request presents a TLS signature that a generic HTTP client
|
||||
produces, and the header says it is Firefox on Windows, that is not a subtle
|
||||
statistical wobble. It is a flat contradiction, visible on the first packet,
|
||||
with no page interaction required. [The mismatch between a TLS fingerprint and
|
||||
the User-Agent](tls-fingerprint-user-agent-mismatch.md) is one of the cleanest
|
||||
signals a server has, precisely because the two sources are independent and hard
|
||||
to fake in lockstep.
|
||||
|
||||
This is why bolt-on stealth is fragile at the network layer. You can override
|
||||
every JavaScript property you like, and the handshake still comes from whatever
|
||||
library or headless build actually opened the socket. The disguise is applied
|
||||
above the layer where the contradiction lives.
|
||||
|
||||
## Why a real patched Firefox has no gap here
|
||||
|
||||
invisible_playwright takes the approach that avoids the mismatch by construction:
|
||||
it drives a real Firefox, patched at the C++ level, using stock Playwright. The
|
||||
handshake is not spoofed to look like Firefox. It is Firefox's handshake, because
|
||||
the process performing it is Firefox.
|
||||
|
||||
That distinction is the whole point. When the TLS `ClientHello` goes out, it is
|
||||
emitted by a genuine Gecko network stack, so the JA3 and JA4 it produces are the
|
||||
ones a real Firefox of that version produces. When HTTP/2 opens, the `SETTINGS`
|
||||
frame carries the values that engine actually uses. The `User-Agent` header then
|
||||
names Firefox and is telling the truth, so there is nothing for a request-zero
|
||||
comparison to catch. There is no second client hiding under the first, because
|
||||
there is only one client.
|
||||
|
||||
Switching to it is a two-line change, and the network behaviour comes along for
|
||||
free because it was never something you were configuring:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
# The TLS handshake and HTTP/2 frames on this request are a real
|
||||
# Firefox's, and the User-Agent header matches because it is not a spoof.
|
||||
```
|
||||
|
||||
The `browser` here is a real Playwright `Browser`, so every method you already
|
||||
use works unchanged. The `seed` fixes the in-page fingerprint (GPU, canvas,
|
||||
audio, fonts) so a run is reproducible, but the network-layer identity does not
|
||||
depend on the seed at all: it is the same genuine Firefox handshake on every
|
||||
session, because that is what the process is.
|
||||
|
||||
If you want to confirm this rather than take it on faith, the honest method is a
|
||||
comparison. Capture the handshake from a session driven this way and from a stock
|
||||
Firefox on the same machine, and diff the JA3 or JA4. They should match, because
|
||||
it is the same engine. That is the same "compare, do not read a verdict"
|
||||
discipline that the [testing guide](how-to-test-bot-detection.md) argues for at
|
||||
every layer.
|
||||
|
||||
## The honest caveat: a matching handshake is table stakes
|
||||
|
||||
Here is the part that a slogan would skip. A correct TLS and HTTP/2 fingerprint
|
||||
means you do not fail the request-zero mismatch check. It does not mean you pass
|
||||
request zero.
|
||||
|
||||
The server judges the handshake and the IP that sent it at the same instant. A
|
||||
perfect Firefox `ClientHello` arriving from an address with a bad reputation, a
|
||||
datacenter range, or an exit that a thousand other clients are using this minute,
|
||||
is still a bad first impression. The network fingerprint being clean removes one
|
||||
signal; it does nothing about the address underneath it, and the address is
|
||||
evaluated on exactly the same first packet.
|
||||
|
||||
So the layer split is worth stating plainly. invisible_playwright is designed to
|
||||
look like a real browser driven by a real person, and that is why it clears the
|
||||
fingerprint, TLS and driver checks: those read as a genuine Firefox because it is
|
||||
one. What it does not do, and cannot do, is supply the things that are not
|
||||
browser properties:
|
||||
|
||||
- **IP reputation.** The engine sends the handshake; you choose what sends it.
|
||||
Route it through a clean, ideally residential exit. [Proxy configuration and
|
||||
the DNS handling that goes with it](configuration.md) is where that is set.
|
||||
- **Rate limits and per-account quotas.** A real browser making a thousand
|
||||
identical requests a minute is still a thousand requests a minute.
|
||||
- **Behaviour and timing.** After request zero, the session is judged on how it
|
||||
moves. Human pacing is your responsibility, and for agent workloads the pause
|
||||
shaped like model latency is [its own consideration](ai-browser-agents-stealth.md).
|
||||
|
||||
A matching handshake is necessary and not sufficient. It is the floor you have to
|
||||
be standing on before anything else you do matters, not the ceiling.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Detection on the first request is real, and it lives below JavaScript: the TLS
|
||||
handshake and HTTP/2 settings describe the client before the page loads, and a
|
||||
network fingerprint that contradicts the `User-Agent` is one of the earliest and
|
||||
cleanest signals a server has. The durable answer to it is not a better spoof but
|
||||
a real engine, which is why driving a genuine patched Firefox means the handshake
|
||||
matches the header by construction. Pair that with a clean exit and human pacing,
|
||||
and request zero stops being the place you get caught. Leave the exit dirty and it
|
||||
still is, no matter how perfect the handshake.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can I be detected before my JavaScript runs?** Yes. The TLS handshake and the
|
||||
HTTP/2 `SETTINGS` frame are sent before the page loads and both carry a
|
||||
fingerprint, so a mismatch is visible on the first request.
|
||||
|
||||
**What is a JA3 or JA4 fingerprint?** A hash of the shape of the TLS
|
||||
`ClientHello`: the cipher suites, extensions and curves and the order they appear
|
||||
in. Different clients produce different shapes.
|
||||
|
||||
**Why does a matching handshake matter if the header already says Firefox?**
|
||||
Because the header is trivially set and the handshake is not. When they disagree,
|
||||
the handshake is believed and the header is treated as a lie.
|
||||
|
||||
**Can I fix the TLS fingerprint from JavaScript or a stealth plugin?** No. The
|
||||
handshake happens below the page, before any script runs. The only real fix is
|
||||
for the actual client to be the browser it claims to be.
|
||||
|
||||
**Does a real Firefox handshake mean I will not be blocked?** No. It clears the
|
||||
network-fingerprint mismatch, but the IP that sent the handshake is judged at the
|
||||
same moment, and reputation, rate limits and behaviour are all still yours to
|
||||
handle.
|
||||
|
||||
**Does the seed change the network fingerprint?** No. The seed fixes the in-page
|
||||
identity so runs are reproducible; the TLS and HTTP/2 fingerprint is the genuine
|
||||
engine's and is the same regardless.
|
||||
|
||||
## Sources
|
||||
|
||||
- The TLS 1.3 and HTTP/2 specifications for what the `ClientHello` and `SETTINGS`
|
||||
frames actually contain, and the public JA3 and JA4 definitions for how those
|
||||
are hashed into a fingerprint.
|
||||
- This project's own comparison method: capturing a handshake from a session and
|
||||
from a stock Firefox on the same machine and diffing the result, rather than
|
||||
trusting a verdict.
|
||||
|
||||
**See also:** [JA3 and JA4 TLS fingerprints](ja3-ja4-tls-fingerprint.md) for the
|
||||
handshake mechanics, [the TLS-versus-User-Agent mismatch](tls-fingerprint-user-agent-mismatch.md)
|
||||
for why the contradiction is decisive, and [HTTP/2 fingerprint detection](http2-fingerprint-detection.md)
|
||||
for the layer just above it.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The handshake is
|
||||
real because the browser is real; the exit and the pacing are still yours to get
|
||||
right.*
|
||||
@@ -0,0 +1,233 @@
|
||||
---
|
||||
title: "Does Playwright Leave Traces a Website Can See?"
|
||||
description: "Playwright leaves some traces a page can read, some it cannot. Which are page-visible, why the control WebSocket is not, and how patched Firefox reads ordinary."
|
||||
parent: "The Automation Layer"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 22
|
||||
---
|
||||
|
||||
|
||||
# Does Playwright Leave Traces a Website Can See?
|
||||
|
||||
Short version: Playwright leaves traces, but only some of them are readable by the
|
||||
page you are visiting. The distinction matters more than the list, because most of the
|
||||
famous "Playwright tells" are things the page can see in its own document, and the part
|
||||
people worry about most - the connection the driver uses to control the browser - is not
|
||||
one of them.
|
||||
|
||||
This page splits automation traces into two piles, page-visible and off-page, shows a
|
||||
DOM check you can run yourself, explains why Chromium-based tooling and Firefox differ on
|
||||
one specific tell, and states plainly where a clean document still is not enough.
|
||||
|
||||
## Two kinds of trace: what the page can read, and what it cannot
|
||||
|
||||
A running automation session has two very different surfaces.
|
||||
|
||||
**Off-page.** The driver talks to the browser over a control channel: a local
|
||||
WebSocket or pipe that carries the commands your script issues (navigate, click, read
|
||||
this element). That channel lives between your process and the browser process. The page
|
||||
being automated has no handle to it, cannot open it, and cannot enumerate it. It is
|
||||
server-side relative to the document, in the same sense a debugger attached to a process
|
||||
is invisible to the code running inside.
|
||||
|
||||
**Page-visible.** Everything the automation writes into the document or the global
|
||||
scope. If a tool sets a property on `navigator`, defines a global, or injects a helper
|
||||
object into `window`, then any script the page runs can read it back with one line. This
|
||||
is the pile that detectors actually query, because it is the only pile they can reach
|
||||
from JavaScript.
|
||||
|
||||
The useful question is therefore never "does Playwright leave traces" but "which pile is
|
||||
this trace in". A trace in the first pile is not something a page can test for. A trace
|
||||
in the second pile is a one-line check, and that is where the work is.
|
||||
|
||||
## The control channel: a trace, but not one the page can see
|
||||
|
||||
The WebSocket (or pipe) is real. If you inspect your own machine while a session runs,
|
||||
it is right there. But it is off-page, and that has a concrete consequence: a website
|
||||
cannot detect automation by looking for the driver connection, because nothing in the
|
||||
document reaches across that boundary.
|
||||
|
||||
This is why "close the DevTools port" style advice misses the point for in-page
|
||||
detection. Whether the transport is a Chrome DevTools Protocol socket, a WebDriver BiDi
|
||||
session, or Firefox's own Juggler protocol, the page sees the same thing either way:
|
||||
nothing. The differences between those transports show up in other places -
|
||||
[the protocol a tool speaks changes what artifacts land in the page](bidi-vs-cdp-detection.md) -
|
||||
but the raw existence of a control socket is not a page-readable signal.
|
||||
|
||||
What the page reads is the residue the driver leaves behind in the document. That is the
|
||||
next pile.
|
||||
|
||||
## The traces a page CAN see
|
||||
|
||||
Three families, in rough order of how often they appear:
|
||||
|
||||
- **A webdriver flag.** The [WebDriver specification](https://www.w3.org/TR/webdriver2/)
|
||||
requires a conforming browser to expose `navigator.webdriver` as `true` while a session
|
||||
is under automation control. That is a page-visible boolean by design, and a stock
|
||||
automated browser reports it honestly. Patching it in a page script trades one tell for
|
||||
another, because a clean browser reports `undefined` and not `false` - the
|
||||
[full reason setting it to false is worse than leaving it alone](navigator-webdriver-explained.md)
|
||||
is its own page.
|
||||
- **Automation globals.** Some stacks leave a named object on `window` so their in-page
|
||||
code has somewhere to keep state. Anything on the global object is enumerable, so a
|
||||
named global is a named tell.
|
||||
- **Injected document properties.** On Chromium-based tooling driven through
|
||||
ChromeDriver, the driver keeps working state on the document under `cdc_` / `$cdc`
|
||||
property names. Their presence is a one-line automation test, and
|
||||
[renaming them in the binary does not remove the surface](cdc-variable-explained.md),
|
||||
it only changes its shape.
|
||||
|
||||
All three are page-visible because they live in the document or the global scope. None of
|
||||
them is the control channel. Fixing them is a matter of not writing them into the page in
|
||||
the first place, which is a design decision, not a runtime patch.
|
||||
|
||||
## Chromium injects cdc_ into the document; Firefox through Juggler does not
|
||||
|
||||
Chromium-based tooling writes `cdc_`-prefixed properties into the page; Firefox driven
|
||||
through Juggler writes none, because its driver never has to touch the document at all.
|
||||
|
||||
ChromeDriver needs to run its own JavaScript inside the page to do its job, and it keeps
|
||||
state on the page's own objects under `cdc_`-prefixed names. That is a page-visible
|
||||
artifact of how that particular driver works.
|
||||
|
||||
Firefox driven through its own Juggler protocol does not use ChromeDriver, so `cdc_`
|
||||
simply does not exist there. That is a fact about the protocol, not a claim of virtue:
|
||||
Firefox's automation state lives in privileged execution contexts the page cannot
|
||||
enumerate, so the driver does not have to write into the document to function. The
|
||||
`cdc_` family of checks returns nothing on a Firefox session for a structural reason.
|
||||
|
||||
That structural point is only half the story, though, because a stock Firefox under
|
||||
automation still sets the webdriver flag to `true`. So "no `cdc_`" does not mean "looks
|
||||
like a person" on its own. What closes the remaining gap is where the value is decided.
|
||||
On the patched Firefox this project ships, the webdriver flag is cleared and the
|
||||
fingerprint is normalized inside the engine, before it ships, so the document a site
|
||||
inspects reports the same values a normal build reports, through the same native code
|
||||
path. There is no in-page override for a detector to catch, because there is no override.
|
||||
The wider comparison of the two engines lives in
|
||||
[Firefox versus Chromium for anti-detect work](firefox-vs-chromium-antidetect.md).
|
||||
|
||||
## Check the document yourself
|
||||
|
||||
Do not take any of this on trust. Enumerate the document and the global scope in your own
|
||||
session and read what is there. With the real API the launch is two lines and the check
|
||||
is one `page.evaluate`:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
|
||||
report = page.evaluate("""() => ({
|
||||
webdriver: navigator.webdriver,
|
||||
cdc_on_document: Object.getOwnPropertyNames(document)
|
||||
.filter(k => k.startsWith('cdc_') || k.startsWith('$cdc')),
|
||||
suspicious_globals: Object.getOwnPropertyNames(window)
|
||||
.filter(k => /^(cdc_|\\$cdc|__playwright|__driver|__webdriver)/.test(k)),
|
||||
})""")
|
||||
|
||||
print(report)
|
||||
```
|
||||
|
||||
On this patched Firefox, `webdriver` comes back `undefined` (not `false`), and both
|
||||
lists come back empty: no `cdc_` on the document, no automation global on `window`. The
|
||||
same check on a stock ChromeDriver session is where you see the `cdc_` entries appear.
|
||||
Passing `seed=42` just means the run is reproducible, so you can re-run the exact same
|
||||
identity and compare - the
|
||||
[wider method for testing detection](how-to-test-bot-detection.md) is to compare against
|
||||
a stock browser field by field rather than reading a single verdict.
|
||||
|
||||
Note what this check does not include: the control-channel WebSocket. There is no
|
||||
expression you can write in `page.evaluate` that finds it, because it is off-page. That
|
||||
absence is the point of this whole page.
|
||||
|
||||
## What this fixes, and what it honestly does not
|
||||
|
||||
Clearing the page-visible traces is what makes invisible_playwright pass most in-document
|
||||
detection: the automation flag, the injected globals, and the fingerprint (GPU, audio,
|
||||
fonts, screen, roughly 400 fields) all read as a genuine Firefox, because they are
|
||||
produced by a genuine, if patched, Firefox. That is the demonstrable part, and the DOM
|
||||
check above is how you confirm it for yourself.
|
||||
|
||||
"No page-visible traces" is not the same as "invisible", and it is worth being blunt
|
||||
about the difference:
|
||||
|
||||
- **The network layer.** The TLS handshake and HTTP/2 settings are decided before any
|
||||
page script runs, and [an in-page test cannot see them](ja3-ja4-tls-fingerprint.md),
|
||||
which cuts both ways: a clean document does not fix a handshake that contradicts the
|
||||
user agent. The patched engine's handshake is a real Firefox handshake, so this
|
||||
particular mismatch is not introduced, but the point stands that this surface is
|
||||
outside the document.
|
||||
- **IP reputation.** A consistent browser on a datacenter address is still on a
|
||||
datacenter address. That is not a browser property, and no amount of fingerprint work
|
||||
changes it. You supply a clean exit, and the browser stays consistent with it.
|
||||
- **Per-account quotas and rate limits.** If an account or a source address makes more
|
||||
requests than a person plausibly would, that is measured server-side and is invisible
|
||||
to any document check.
|
||||
- **Behaviour and timing.** Pointer motion, typing rhythm, and pacing are watched by
|
||||
some sites regardless of how clean the document is. This project drives real mouse
|
||||
motion, but the cadence of your script is yours to make human.
|
||||
|
||||
So the honest framing: invisible_playwright is built to look like a real browser driven
|
||||
by a real person, which is why it clears the page-visible driver and fingerprint layer.
|
||||
It does not, on its own, fix your IP, your account limits, or your pacing. Those are the
|
||||
reader's to supply - a clean proxy and human timing - and a page that reads as ordinary
|
||||
plus a session that behaves ordinarily is the combination that actually holds.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Playwright leaves traces, but sort them before you worry about them. The control channel
|
||||
is a real trace and the page cannot see it, so it is not a detection vector from the
|
||||
document. The webdriver flag, automation globals, and Chromium's `cdc_` injection are
|
||||
page-visible, and those are the ones detectors query. Firefox through Juggler carries no
|
||||
`cdc_` for a structural reason, and a Firefox patched in the engine additionally clears
|
||||
the webdriver flag and normalizes the fingerprint, so the document reads as an ordinary
|
||||
browser. Confirm that with the one-line DOM check rather than believing the paragraph.
|
||||
Then remember that a clean document is a necessary condition, not a sufficient one: the
|
||||
network, the address, the account, and the behaviour are still yours to get right.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does Playwright leave traces a website can detect?** Some yes, some no. Automation
|
||||
globals, a webdriver flag, and (on Chromium tooling) `cdc_` properties are page-visible.
|
||||
The driver's control WebSocket is off-page and a document cannot see it.
|
||||
|
||||
**Can a website see the WebSocket Playwright uses to control the browser?** No. That
|
||||
channel is between your process and the browser process. Nothing in the page has a handle
|
||||
to it, so it is not an in-page detection signal.
|
||||
|
||||
**Does Firefox have the `cdc_` variables Chrome does?** No. Those come from ChromeDriver.
|
||||
Firefox driven through its Juggler protocol keeps driver state off the page, so a `cdc_`
|
||||
scan returns nothing on a Firefox session.
|
||||
|
||||
**Is `navigator.webdriver` always true under automation?** On a stock automated browser,
|
||||
yes, because the spec requires it. On the patched Firefox this project ships it is cleared
|
||||
in the engine, so it reports `undefined` like a normal browser, not `false`.
|
||||
|
||||
**If the document is clean, am I undetectable?** No. A clean document does nothing about
|
||||
IP reputation, per-account quotas, rate limits, the TLS handshake, or your timing. Those
|
||||
are separate surfaces you have to handle yourself.
|
||||
|
||||
**How do I check what my own session exposes?** Enumerate `window` and `document` in a
|
||||
live session with `page.evaluate` and read `navigator.webdriver`, as in the example
|
||||
above, then compare the result against a stock browser on the same machine.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's own sessions, enumerating `window` and `document` on a live
|
||||
Playwright-driven Firefox rather than trusting a description of one.
|
||||
- The public detection suites (CreepJS, BotD, sannysoft, FingerprintJS, BrowserLeaks),
|
||||
each read from its own source for what it collects from the document.
|
||||
- The Playwright, [WebDriver BiDi](https://www.w3.org/TR/webdriver-bidi/), and Juggler
|
||||
protocol behaviour for where driver state lives relative to the page.
|
||||
|
||||
**See also:** [the ChromeDriver cdc_ variable](cdc-variable-explained.md),
|
||||
[why navigator.webdriver is not the tell you think it is](navigator-webdriver-explained.md),
|
||||
and [how to test whether your browser is detected](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 DOM check above is one
|
||||
I run against a real session before repeating any claim about what a page can see.*
|
||||
@@ -0,0 +1,210 @@
|
||||
---
|
||||
title: "Does Playwright Set navigator.webdriver to True?"
|
||||
description: "Stock Playwright reports navigator.webdriver as true, an old automation tell. Why patching it is detectable, and what a native false looks like to detectors."
|
||||
parent: "The Automation Layer"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 21
|
||||
---
|
||||
|
||||
|
||||
# Does Playwright Set navigator.webdriver to True?
|
||||
|
||||
Short version: yes. A browser launched by stock Playwright reports
|
||||
[`navigator.webdriver`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/webdriver) `=== true`, and it has done so for years. That single boolean is
|
||||
one of the oldest and cheapest automation tells there is, which is exactly why so many
|
||||
people try to patch it and why the patch usually makes things worse.
|
||||
|
||||
This page is what the flag is, why setting it to `false` from JavaScript is itself a
|
||||
signal, what a native `false` looks like to a detector, and the honest limit of what
|
||||
clearing it buys you.
|
||||
|
||||
## The one-line answer, and the check that proves it
|
||||
|
||||
The flag is specified. The [WebDriver standard](https://www.w3.org/TR/webdriver2/) says a browser under automation control
|
||||
must expose `navigator.webdriver` as `true`, so Playwright, Selenium and any other
|
||||
WebDriver-based driver all set it. Read it yourself:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
print(page.evaluate("() => navigator.webdriver"))
|
||||
```
|
||||
|
||||
On a plain Playwright launch of the same engine that prints `True`. The value above
|
||||
comes back `False`, and the rest of this page is about why the difference between those
|
||||
two lines is not one character of JavaScript.
|
||||
|
||||
A clean, human-driven browser reports `false` here. Note that this is different from the
|
||||
Chromium story, where an untouched browser reports `undefined` and a hand-set `false` is
|
||||
itself an anomaly. On Firefox the honest value is a plain `false`, which is what this
|
||||
engine returns.
|
||||
|
||||
## Why that boolean is such an old tell
|
||||
|
||||
It costs a detector nothing. One property read, no timing, no fingerprint math, no
|
||||
iframe. It is the first line of almost every detection script ever written, and it
|
||||
catches the enormous number of scrapers that never touch it at all.
|
||||
|
||||
Because it is so cheap, it is also the first thing every serious tool fixes, which means
|
||||
that by itself it separates almost nobody from almost nobody. It matters for the reverse
|
||||
reason: leaving it `true` marks you instantly, so it is table stakes rather than an
|
||||
advantage. The interesting question is not whether the flag reads `false`, it is
|
||||
*how* it came to read `false`, because that is where the second tell lives.
|
||||
|
||||
## Why a JavaScript patch of the flag is itself detectable
|
||||
|
||||
The obvious fix is to overwrite the property from a script that runs before the page:
|
||||
|
||||
```js
|
||||
// the classic, and the trap
|
||||
Object.defineProperty(navigator, "webdriver", { get: () => false });
|
||||
```
|
||||
|
||||
This does make `navigator.webdriver` return `false`. It also leaves two fresh
|
||||
fingerprints that are easier to check than the original flag.
|
||||
|
||||
**The getter is no longer native code.** In a real browser the property is backed by an
|
||||
internal getter implemented in C++. Ask that getter to describe itself and it says so:
|
||||
|
||||
```js
|
||||
Object.getOwnPropertyDescriptor(Navigator.prototype, "webdriver")
|
||||
.get.toString();
|
||||
// real browser: "function get webdriver() { [native code] }"
|
||||
// JS override: "() => false" <-- the whole source, in plain sight
|
||||
```
|
||||
|
||||
Every function in JavaScript carries its own source, and
|
||||
[`Function.prototype.toString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/toString) hands it back. A native builtin answers with the
|
||||
`[native code]` placeholder; your arrow function answers with its actual body. So the
|
||||
override that was supposed to hide automation has instead written the word `false` into
|
||||
a place a detector can read directly. This is the general ceiling on page-level stealth,
|
||||
and it is worth understanding on its own terms in
|
||||
[the note on toString and the native-code check](tostring-native-code-detection.md).
|
||||
|
||||
**The property moved to the wrong object.** On a real Firefox the `webdriver` accessor
|
||||
lives on `Navigator.prototype`, not on the `navigator` instance. `defineProperty` on
|
||||
`navigator` puts an own property on the instance, so `navigator.hasOwnProperty("webdriver")`
|
||||
flips from `false` to `true` and the descriptor now sits one rung lower on the prototype
|
||||
chain than it should. A detector that walks the chain, which the tampering-focused suites
|
||||
do by design, sees the shape change even when the value is correct.
|
||||
|
||||
The pattern is the one that runs through
|
||||
[the whole checklist for being flagged on a single site](playwright-detected-as-bot.md):
|
||||
a value fixed in isolation contradicts a value nobody thought to fix. Setting the boolean
|
||||
right while leaving the getter's source and its location wrong is two new tells in
|
||||
exchange for one old one.
|
||||
|
||||
## What a native false looks like to a detector
|
||||
|
||||
The way out is not a better shim, it is to not have a shim. This engine is a Firefox
|
||||
patched at the C++ level, so `navigator.webdriver` is `false` because the browser's own
|
||||
internals return `false`, the same code path a normal Firefox uses. There is no
|
||||
JavaScript getter to inspect and no instance property to trip over:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
report = page.evaluate("""() => {
|
||||
const desc = Object.getOwnPropertyDescriptor(
|
||||
Navigator.prototype, "webdriver");
|
||||
return {
|
||||
value: navigator.webdriver,
|
||||
ownProp: navigator.hasOwnProperty("webdriver"),
|
||||
getterSource: desc && desc.get.toString(),
|
||||
};
|
||||
}""")
|
||||
print(report)
|
||||
# {'value': False,
|
||||
# 'ownProp': False,
|
||||
# 'getterSource': 'function get webdriver() { [native code] }'}
|
||||
```
|
||||
|
||||
All three answers match a browser nobody automated: the value is `false`, the property
|
||||
is not an own property of the instance, and the getter still reports `[native code]`.
|
||||
There is nothing here for a descriptor walk or a `toString` probe to catch, because the
|
||||
thing they look for was never added. The same reasoning, at more length and with the
|
||||
history of the flag, is in
|
||||
[why navigator.webdriver is not the tell you think it is](navigator-webdriver-explained.md).
|
||||
|
||||
## The honest caveat: necessary, not sufficient
|
||||
|
||||
Clearing this flag correctly is table stakes, and table stakes are not a win. A `false`
|
||||
`navigator.webdriver` is one boolean among dozens of signals, and it says nothing about
|
||||
the surfaces that actually get datacenter automation caught:
|
||||
|
||||
- **The IP.** A perfectly clean browser on a known or datacenter address still loses,
|
||||
and no browser property changes that. You supply the exit.
|
||||
- **Rate and volume.** Per-account quotas, request velocity and how many sessions share
|
||||
one address are counted server-side, where the driver flag is invisible.
|
||||
- **Behaviour and timing.** A pointer that teleports, a form filled in eighty
|
||||
milliseconds, keystrokes at a metronome interval. This engine draws mouse motion on a
|
||||
Bezier curve, but the pacing of your actions is yours to make human.
|
||||
- **The rest of the fingerprint.** GPU, fonts, audio device, screen, the TLS handshake.
|
||||
These read as a genuine Firefox here, which is the whole design, but they are a system
|
||||
you keep consistent, not a switch you flip once.
|
||||
|
||||
invisible_playwright is built to look like a real browser driven by a real person, which
|
||||
is why it passes most detection checks at the fingerprint, TLS and driver layers. It does
|
||||
not, and cannot, fix a bad IP, a blown quota or robotic timing. The
|
||||
[method for actually testing which layer is failing](how-to-test-bot-detection.md)
|
||||
is worth more than any single flag reading, because it tells you whether the thing you
|
||||
fixed was ever the thing catching you.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Stock Playwright sets `navigator.webdriver` to `true` by specification. Patching it from
|
||||
JavaScript trades one obvious tell for two subtler ones: a getter whose source reads
|
||||
`false` under `toString`, and a property that has migrated onto the wrong object. A
|
||||
native `false`, returned by the browser's own C++ path, leaves neither, which is why this
|
||||
engine returns `false` without a shim to catch. Treat that as necessary and never as
|
||||
sufficient: it clears the driver layer, and the IP, the pacing and the behaviour are
|
||||
still yours to get right.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does Playwright set navigator.webdriver to true?** Yes, on every WebDriver-based
|
||||
launch, because the standard requires an automated browser to report `true`.
|
||||
|
||||
**Can I just set navigator.webdriver to false in a script?** You can, and the value will
|
||||
read `false`, but the override's getter no longer reports `[native code]` and the
|
||||
property lands on the wrong object, so you have added two tells to remove one.
|
||||
|
||||
**How do detectors catch the JavaScript override?** By reading the getter's source with
|
||||
`Function.prototype.toString`, and by walking the prototype chain to see that the
|
||||
property moved onto the instance.
|
||||
|
||||
**What should a clean Firefox report?** A plain `false`. That is different from Chromium,
|
||||
where an untouched browser reports `undefined` and a hand-set `false` is itself odd.
|
||||
|
||||
**Does invisible_playwright fake the value?** No. It returns `false` from the browser's
|
||||
own native code path, so there is no JavaScript getter to inspect and no own property to
|
||||
find.
|
||||
|
||||
**If navigator.webdriver is false, am I undetectable?** No. It is one boolean among many
|
||||
signals. It does nothing for your IP reputation, your rate limits or your behaviour, all
|
||||
of which you still have to supply.
|
||||
|
||||
## Sources
|
||||
|
||||
- The WebDriver specification, which defines `navigator.webdriver` and requires an
|
||||
automated user agent to expose it as `true`.
|
||||
- `Function.prototype.toString`, whose `[native code]` behaviour for builtins is the
|
||||
standard mechanism behind the getter-source check.
|
||||
- This project's own driver-layer checks, comparing a native `false` against a
|
||||
JavaScript override on the same engine.
|
||||
|
||||
**See also:** [Function.prototype.toString and the native-code check](tostring-native-code-detection.md),
|
||||
[why navigator.webdriver is not the tell you think it is](navigator-webdriver-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. The flag reads false
|
||||
because the browser's own code returns false, not because a script overwrote it.*
|
||||
@@ -0,0 +1,208 @@
|
||||
---
|
||||
title: "Does Playwright Support Firefox Stealth?"
|
||||
description: "Stock Playwright drives a plain Firefox with no stealth layer, so automation signals show. Put the spoofs in a patched browser and keep the standard Playwright API."
|
||||
parent: "The Automation Layer"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 25
|
||||
---
|
||||
|
||||
|
||||
# Does Playwright Support Firefox Stealth?
|
||||
|
||||
Short answer: Playwright drives Firefox well, but it does not make Firefox
|
||||
stealthy. The bundled Firefox it launches is an ordinary build, and it exposes
|
||||
the same automation signals any driver would. Stealth is not something the
|
||||
driver can add, because the driver is not where the signals live. It has to be
|
||||
compiled into the browser.
|
||||
|
||||
That distinction is the whole answer, and the rest of this page is why it is
|
||||
true and what to do about it.
|
||||
|
||||
## The short version: stealth lives in the browser, not the driver
|
||||
|
||||
A browser automation stack has two halves. The driver is the process that sends
|
||||
commands - click here, go there, read this element. The browser is the process
|
||||
that renders the page and answers every fingerprinting question a site asks:
|
||||
what GPU do you have, what fonts, what is `navigator.webdriver`, what does your
|
||||
TLS handshake look like.
|
||||
|
||||
Detection happens entirely in the second half. A site never sees your driver.
|
||||
It sees the browser's answers. So a stealth layer has to change what the browser
|
||||
reports, which means it has to be inside the browser. A patched driver talking
|
||||
to an unpatched browser changes nothing a detector can read.
|
||||
|
||||
Stock Playwright is a very good driver. It is not, and does not try to be, a
|
||||
stealth browser.
|
||||
|
||||
## What stock Playwright's Firefox actually exposes
|
||||
|
||||
Playwright ships [its own Firefox build](https://playwright.dev/python/docs/browsers)
|
||||
and talks to it over the Juggler protocol. That build is a normal Firefox with
|
||||
the automation hooks enabled. It was never meant to hide, so it does not:
|
||||
|
||||
- [`navigator.webdriver`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/webdriver)
|
||||
reports the automated state.
|
||||
- The fingerprint is whatever the host machine happens to have. On a server that
|
||||
means a software WebGL renderer, no audio device, a font set that belongs to
|
||||
the container rather than to the platform the user agent claims, and a screen
|
||||
size nobody actually runs.
|
||||
- The TLS handshake is the build's own, which [no in-page test can see but a
|
||||
server-side detector can](ja3-ja4-tls-fingerprint.md).
|
||||
|
||||
None of this is a defect in Playwright. It is a driver doing its job. But it
|
||||
means "use Playwright with Firefox" and "have a stealthy Firefox" are two
|
||||
different projects, and the first does not get you the second.
|
||||
|
||||
## Why patching the driver is the wrong layer
|
||||
|
||||
The common instinct is to reach for a stealth plugin: a piece of JavaScript
|
||||
injected into every page that overwrites the properties a detector reads. This
|
||||
works at the edges and fails at the core, for a reason that is structural rather
|
||||
than a matter of plugin quality.
|
||||
|
||||
Injected JavaScript runs after the page's own code can already have captured the
|
||||
original built-ins, and a serious check compares the built-ins against a clean
|
||||
copy taken from a fresh iframe. An overwrite leaves a fingerprint of its own: a
|
||||
patched function has a different `toString`, a redefined property has a
|
||||
telltale descriptor, and [setting `navigator.webdriver` to `false` is itself a
|
||||
signature because a real browser reports `undefined`](navigator-webdriver-explained.md).
|
||||
The machine tells - GPU, fonts, audio, screen - are not in JavaScript's gift to
|
||||
change at all.
|
||||
|
||||
So the driver layer can paper over a handful of properties and cannot touch the
|
||||
rest. The deeper you push the disguise, the closer to the engine it has to be.
|
||||
[The full ladder of where a spoof can live, and what each rung can and cannot
|
||||
reach, is its own page](playwright-stealth-levels.md).
|
||||
|
||||
## The split invisible_playwright uses: stock Playwright, patched Firefox
|
||||
|
||||
This is exactly the split invisible_playwright is built on. The driver stays
|
||||
stock: an unmodified, current Playwright, with the standard API and nothing
|
||||
wrapped or subsetted. The stealth moves entirely into the browser, which is a
|
||||
Firefox patched at the C++ level so the spoofs are compiled in - `webdriver`
|
||||
reads the way a normal browser's does, the fingerprint surfaces (GPU, canvas,
|
||||
audio, screen, fonts) are answered from a seed-derived identity, and real fonts
|
||||
are bundled so the list matches the platform being claimed.
|
||||
|
||||
Because the disguise is in the engine and not in an injected script, there is no
|
||||
overwritten built-in to catch and no second spoofer contradicting the first. And
|
||||
because the driver is ordinary Playwright, switching is two lines and every
|
||||
method you already know keeps working:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# seed=42 makes the whole identity reproducible run to run
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
|
||||
# the browser, not a plugin, answers this - and it reads like a real one
|
||||
print("webdriver:", page.evaluate("navigator.webdriver"))
|
||||
print("renderer:", page.evaluate(
|
||||
"document.createElement('canvas').getContext('webgl')"
|
||||
".getParameter(0x1F01)"))
|
||||
```
|
||||
|
||||
The `browser` object is a real
|
||||
[`playwright.sync_api.Browser`](https://playwright.dev/python/docs/api/class-browser).
|
||||
Everything in the upstream Playwright documentation applies unchanged; the only
|
||||
difference is what the browser reports when a page asks. The async surface is
|
||||
identical:
|
||||
|
||||
```python
|
||||
from invisible_playwright.async_api import InvisiblePlaywright
|
||||
|
||||
async with InvisiblePlaywright(seed=42) as browser:
|
||||
page = await browser.new_page()
|
||||
await page.goto("https://example.com")
|
||||
print(await page.evaluate("navigator.webdriver"))
|
||||
```
|
||||
|
||||
Run the first snippet against a plain Playwright Firefox and against this one and
|
||||
diff the two reports field by field. The plain build announces automation and a
|
||||
server machine; the patched build reads like a real desktop Firefox, and the
|
||||
same seed produces the same reading every time.
|
||||
|
||||
## What this fixes and what you still supply
|
||||
|
||||
Here is the honest boundary, because the split above solves one layer and one
|
||||
layer only.
|
||||
|
||||
What the patched browser handles: the fingerprint, the driver tells, and the TLS
|
||||
handshake all read as a genuine Firefox. That is most of what a public detection
|
||||
suite - CreepJS, BotD, FingerprintJS, sannysoft, BrowserLeaks - actually
|
||||
measures, and it is why a well-configured session passes most of those checks.
|
||||
|
||||
What it does not, and cannot, handle on its own:
|
||||
|
||||
- **IP reputation.** A perfect browser on a known datacenter address still loses.
|
||||
You supply a clean exit; [the proxy configuration is its own
|
||||
page](configuration.md).
|
||||
- **Per-account quotas and rate limits.** These are about the account and the
|
||||
request volume, not the browser.
|
||||
- **Behaviour and timing.** Pointer motion, typing rhythm, and the pace of a
|
||||
session are yours to make human. The tool arcs the mouse on a Bezier curve, but
|
||||
it will not invent realistic pauses for you.
|
||||
|
||||
Looking like a real browser is necessary and not sufficient. This is not an
|
||||
undetectable browser and there is no such thing; it is a browser that looks real,
|
||||
paired with the parts only you can supply. Anyone selling "bypass everything" is
|
||||
selling the half of the problem that is not theirs to sell.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Does Playwright support Firefox stealth? It supports driving Firefox, and stealth
|
||||
is not a driver feature - it belongs in the browser, so the right answer is stock
|
||||
Playwright plus a patched Firefox rather than a patched Playwright. That keeps the
|
||||
standard API and moves the disguise to the only layer that a detector can read.
|
||||
It gets you a browser that looks real, which is most of the battle and not all of
|
||||
it. The clean IP and the human pacing are still yours to bring.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does Playwright have a stealth mode?** No. It is a driver, and the bundled
|
||||
Firefox it launches is a normal build that exposes the usual automation signals.
|
||||
Stealth has to be added in the browser.
|
||||
|
||||
**Can a stealth plugin make Playwright's Firefox undetectable?** It can hide a
|
||||
few properties and it leaves its own signature doing so, and it cannot touch the
|
||||
machine tells - GPU, fonts, audio, screen. Injected JavaScript is the wrong layer
|
||||
for the hard part.
|
||||
|
||||
**Do I have to patch Playwright itself?** No, and you should not. Patch the
|
||||
browser and keep Playwright stock, so the standard API stays intact and the
|
||||
disguise sits where detectors actually look.
|
||||
|
||||
**Will this pass every bot check?** It passes most fingerprint, driver, and TLS
|
||||
checks because those read as a real Firefox. It does nothing about your IP,
|
||||
your quotas, or your behaviour, and those get sessions blocked too.
|
||||
|
||||
**Do I have to change my Playwright code?** Two lines at launch. The returned
|
||||
object is a real Playwright `Browser`, so every method works exactly as
|
||||
documented upstream.
|
||||
|
||||
**Is Firefox better than Chromium for this?** They have different tradeoffs;
|
||||
[the comparison is its own page](firefox-vs-chromium-antidetect.md).
|
||||
|
||||
## Sources
|
||||
|
||||
- [Playwright's own docs on the Firefox build it drives](https://playwright.dev/python/docs/browsers),
|
||||
and the [`Browser` class reference](https://playwright.dev/python/docs/api/class-browser),
|
||||
read from their own behaviour rather than a summary of it.
|
||||
- [MDN's `navigator.webdriver` reference](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/webdriver)
|
||||
for what the property signals and when.
|
||||
- This project's release gates, which assert the patched browser reports a real
|
||||
fingerprint and driver state, run through a proxy and compared field by field
|
||||
against a stock browser on the same machine.
|
||||
|
||||
**See also:** [the levels a stealth layer can live at](playwright-stealth-levels.md),
|
||||
[what navigator.webdriver really signals](navigator-webdriver-explained.md), and
|
||||
[Firefox versus Chromium for anti-detect](firefox-vs-chromium-antidetect.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 split it is built
|
||||
on is the whole point of this page: keep the driver ordinary, put the disguise in
|
||||
the browser.*
|
||||
@@ -0,0 +1,192 @@
|
||||
---
|
||||
title: "Does Playwright Trigger reCAPTCHA More Often?"
|
||||
description: "Why Playwright triggers reCAPTCHA more often. How reCAPTCHA builds risk from fingerprint, IP, session and behavior, and which inputs a browser engine can control."
|
||||
parent: "Testing and Troubleshooting"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 13
|
||||
---
|
||||
|
||||
|
||||
# Does Playwright Trigger reCAPTCHA More Often?
|
||||
|
||||
Often, yes, but not for the reason most people assume. There is no single "this is
|
||||
Playwright" flag that reCAPTCHA flips. What it does is build a risk score out of many
|
||||
inputs, and a default Playwright session happens to push several of those inputs in the
|
||||
same wrong direction at once.
|
||||
|
||||
That distinction matters, because it tells you which parts of the problem the browser can
|
||||
fix and which parts it cannot. This page walks the inputs, shows which one a coherent
|
||||
real-browser engine moves, and is honest about the ones that no browser setting touches.
|
||||
|
||||
## reCAPTCHA is a score, not a switch
|
||||
|
||||
The useful mental model is a risk score between "obviously a person" and "obviously
|
||||
automated", with a threshold somewhere in the middle. Below the threshold you get a quiet
|
||||
pass or an invisible check. Above it you get a challenge, and above that you get blocked
|
||||
outright.
|
||||
|
||||
Nothing about that score is a boolean. You do not "fail the Playwright test" and you do
|
||||
not "pass" it. You accumulate a number, and every input either adds to it or does not.
|
||||
This is the same machinery described in
|
||||
[how a browser trust score is actually assembled](browser-trust-score-explained.md): a
|
||||
weighted sum, not a checklist, which is why fixing one obvious tell can leave you still
|
||||
above the line.
|
||||
|
||||
So the right question is not "does Playwright get detected". It is "which inputs does a
|
||||
default Playwright session push over the threshold, and which of those can I move".
|
||||
|
||||
## The inputs that feed the score
|
||||
|
||||
Four families of input matter here, and they are largely independent of each other.
|
||||
|
||||
- **Fingerprint coherence.** Not whether any single value is unusual, but whether the
|
||||
values agree. A user agent claiming one platform against APIs that behave like another,
|
||||
a GPU string that does not match how pixels actually render, a font set that does not
|
||||
belong to the claimed operating system. Detectors mostly check agreement, not novelty.
|
||||
- **IP reputation.** The address and its ASN. A datacenter range, an exit that a thousand
|
||||
other sessions used this minute, a country that disagrees with the rest of the session.
|
||||
- **Session and cookie age.** A brand-new context with no cookies and no history looks
|
||||
different from a browser someone has actually used. reCAPTCHA reads longevity and prior
|
||||
interaction as signal.
|
||||
- **Interaction pattern.** Pointer motion, typing rhythm, the pause before a click. A form
|
||||
filled in eighty milliseconds and a pointer that teleports between coordinates both
|
||||
score against you.
|
||||
|
||||
A default Playwright launch tends to be bad at the first and the third for free: a fresh
|
||||
automated context ships an inconsistent fingerprint and a historyless session in the same
|
||||
breath. That is most of why the challenge rate is higher than a hand-driven browser's,
|
||||
before you have touched the proxy at all.
|
||||
|
||||
## Which input the browser layer actually moves
|
||||
|
||||
Of those four, exactly one is fully inside the browser's gift: fingerprint coherence.
|
||||
|
||||
Stock Playwright driving stock Firefox or Chromium leaks a scattering of small
|
||||
disagreements. Some are automation tells like
|
||||
[`navigator.webdriver`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/webdriver), a
|
||||
standard property that reports true whenever the user agent is under automation control. More
|
||||
are consistency gaps: a headless context with no real GPU, a screen size no display has, a codec
|
||||
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
|
||||
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
|
||||
before you trust any single verdict, because a green score can also mean a broken feature
|
||||
that leaks nothing.
|
||||
|
||||
The other three inputs are not browser properties at all, which is the honest half of this
|
||||
page and the reason a "stealth browser" alone is never the whole answer.
|
||||
|
||||
## 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 job on this specific problem is narrow and it is the fingerprint input: instead of a
|
||||
scattering of disagreements, it presents one coherent real Firefox. GPU, audio, fonts,
|
||||
screen and roughly 400 fields are derived together from a single seed, so they agree with
|
||||
each other and with a genuine desktop Firefox rather than contradicting one another.
|
||||
|
||||
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/form")
|
||||
page.click("#submit") # pointer arcs to the button on a Bezier curve
|
||||
```
|
||||
|
||||
The reproducible seed is what makes the fingerprint input debuggable: if a run draws a
|
||||
challenge, replay the exact same identity and change one variable at a time, rather than
|
||||
guessing whether the site changed or the machine did.
|
||||
|
||||
What this buys you is a lower fingerprint contribution to the score. The TLS handshake and
|
||||
driver layer also read as a genuine Firefox rather than as something impersonating one,
|
||||
which closes the network-layer tells covered in
|
||||
[JA3 and JA4 TLS fingerprinting](ja3-ja4-tls-fingerprint.md). It does not touch the other
|
||||
three inputs, and it does not "solve" the score. There is no such thing.
|
||||
|
||||
## The inputs the browser cannot move
|
||||
|
||||
A coherent fingerprint on a bad address is still on a bad address. These are the inputs you
|
||||
have to supply yourself, and no browser setting substitutes for them:
|
||||
|
||||
- **IP reputation.** Around ninety percent of proxies are already known and blocked before
|
||||
you use them. A perfect browser on a listed datacenter IP still scores high. This is the
|
||||
first thing to rule out, and the [Docker and datacenter side of the
|
||||
problem](how-to-run-playwright-docker-undetected.md) is where most server-side sessions
|
||||
actually lose.
|
||||
- **Session age.** A brand-new context with zero cookies reads as fresh every time. Warming
|
||||
a session, reusing storage state, and not throwing away every cookie between runs all move
|
||||
this input, and none of them are the browser's job.
|
||||
- **Behaviour and timing.** Mechanical pacing scores against you regardless of how real the
|
||||
browser looks. Human-shaped delays and real pointer motion are things you pace from your
|
||||
own code. invisible_playwright supplies Bezier-curve mouse motion, but the rhythm of when
|
||||
you act is yours.
|
||||
|
||||
If your fingerprint is coherent and you are still challenged, the score is coming from one
|
||||
of these three, and buying a better browser will not change it.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Playwright meets reCAPTCHA challenges more often because a default automated session pushes
|
||||
several score inputs the wrong way at once, chiefly an inconsistent fingerprint and a fresh,
|
||||
historyless session. A real-browser engine like invisible_playwright moves the fingerprint
|
||||
input, and the TLS and driver layers with it, which is a real and measurable reduction in
|
||||
one contribution to the score. It does not, and cannot, fix IP reputation, session age, or
|
||||
your timing. Treat reCAPTCHA as a sum you lower from several directions, not a switch one
|
||||
tool flips, and pair a coherent browser with a clean exit and human pacing.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does Playwright itself get flagged by reCAPTCHA?** Not as a single flag. A default
|
||||
Playwright session raises the risk score mainly through an inconsistent fingerprint and a
|
||||
brand-new session with no history, which together read as automation.
|
||||
|
||||
**Will a stealth browser stop reCAPTCHA challenges?** It lowers one input, the fingerprint,
|
||||
and the TLS layer with it. It does nothing for your IP, your session age, or your timing, so
|
||||
on its own it does not stop challenges.
|
||||
|
||||
**Can any browser guarantee a pass?** No. reCAPTCHA produces a score from inputs the browser
|
||||
does not control, so no browser setting "solves" it. Anyone claiming otherwise is selling
|
||||
something.
|
||||
|
||||
**Why do I still get challenged with a perfect fingerprint?** Because the score has other
|
||||
inputs. A datacenter IP, a cookieless session, or mechanical timing can each push you over
|
||||
the threshold on their own.
|
||||
|
||||
**Does a reproducible seed help here?** Yes, for debugging. The same seed gives the same
|
||||
machine every run, so a challenge can be replayed exactly instead of chasing a new random
|
||||
identity each time.
|
||||
|
||||
**Is it the proxy or the browser?** Test it: open the same page by hand from the same
|
||||
machine and network. If the manual visit is also challenged, it is the exit, and the
|
||||
[detection checklist](playwright-detected-as-bot.md) works that split in order.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's fingerprint generation, which derives roughly 400 fields from one seed so
|
||||
they agree with each other rather than contradicting.
|
||||
- The comparison method in the testing guide linked above, used to read the fingerprint
|
||||
contribution to a score directly rather than trusting a verdict.
|
||||
- Public detector suites (CreepJS, BotD, FingerprintJS, sannysoft, BrowserLeaks), each read
|
||||
from its own source, for what a coherence check actually inspects.
|
||||
|
||||
**See also:** [how a browser trust score is assembled](browser-trust-score-explained.md),
|
||||
[the checklist for being detected on one site](playwright-detected-as-bot.md), and
|
||||
[how to test whether your browser is detected](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. It moves the fingerprint
|
||||
input to a reCAPTCHA score; the clean exit and the human pacing are still yours to bring.*
|
||||
@@ -0,0 +1,212 @@
|
||||
---
|
||||
title: "DOM-reading vs screenshot agents: which stealth helps"
|
||||
description: "DOM-reading and screenshot browser agents get detected differently: which stealth signal helps depends on whether the agent reads the DOM or clicks by pixel."
|
||||
parent: "AI Agents and Frameworks"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 15
|
||||
---
|
||||
|
||||
|
||||
# DOM-reading vs screenshot agents: which stealth helps
|
||||
|
||||
Which stealth signal helps depends on how the agent perceives the page, not on the model
|
||||
behind it. A DOM-reading agent acts on selectors, so it is exposed at the DOM and driver
|
||||
layer, and a patched engine's automation-tell fixes are what carry it. A screenshot agent
|
||||
clicks by coordinate instead, so it is exposed at the graphics surface and in its rhythm,
|
||||
and canvas, WebGL and GPU realness are what carry it. Both agents drive the same browser
|
||||
to the same page and get caught by completely different things, even though they inherit
|
||||
the same engine and the same patch underneath.
|
||||
|
||||
This page is about matching the fix to the way the agent sees. It ends with a short,
|
||||
runnable example and one honest caveat: the engine changes what the page can measure about
|
||||
the browser, and it does not change your address or your pacing. Those you supply.
|
||||
|
||||
## Two ways an agent sees a page
|
||||
|
||||
An agent has to turn a web page into something a model can act on, and there are two
|
||||
common ways to do it.
|
||||
|
||||
A **DOM-reading agent** asks the browser for structure. It pulls the serialized DOM, or an
|
||||
accessibility snapshot, or the visible text, hands that to the model, and gets back an
|
||||
action expressed against an element: click this selector, type into that field. Text and
|
||||
accessibility-tree agents live here.
|
||||
|
||||
A **screenshot agent** asks the browser for a picture. It captures the rendered viewport,
|
||||
sends the image to a vision model, and gets back an action expressed in pixels: click at
|
||||
these coordinates, then these. Computer-use style agents live here.
|
||||
|
||||
The distinction matters because detection is layered, and the two ways of seeing walk
|
||||
through different layers on their way to acting.
|
||||
|
||||
## What a DOM-reading agent gives away
|
||||
|
||||
When the agent acts on selectors, the surface that matters most is the one it is reading
|
||||
from: the DOM and the JavaScript environment around it.
|
||||
|
||||
This is where the classic automation flags live. A `navigator.webdriver` that reads
|
||||
`true`, leftover automation globals, an object that a driver injected and forgot to clean
|
||||
up. A DOM-reading agent does not care about these directly, but the page it is reading can,
|
||||
and a page that finds one serves the agent a different DOM, or a challenge, or nothing.
|
||||
[These flags are mostly solved and mostly misunderstood](navigator-webdriver-explained.md):
|
||||
a clean browser reports `undefined`, and setting the flag to `false` is a value with its
|
||||
own signature rather than an absence.
|
||||
|
||||
So for this mode, the DOM-level and driver-level tells are the ones that decide the run.
|
||||
The good news is that this is exactly the layer a patched engine covers, because those
|
||||
signals are properties the browser reports and the browser is the thing that was patched.
|
||||
The agent reads the same clean structure a real browser would hand back, without a stealth
|
||||
plugin sitting between the page and the model.
|
||||
|
||||
## What a screenshot agent gives away
|
||||
|
||||
A vision agent never reads `navigator.webdriver`, so at first glance the DOM flags look
|
||||
irrelevant to it. They mostly are. What it exposes instead is everything that has to be
|
||||
true for the picture to look like a real machine drew it, plus the rhythm of how it acts.
|
||||
|
||||
The picture is drawn by the graphics stack. A server with no GPU announces itself through
|
||||
the rendered image and through the values that describe the renderer, and
|
||||
[a renderer string that says one thing while the pixels say another](renderer-string-vs-render.md)
|
||||
is a mismatch no property patch hides. Canvas and WebGL realness, which a DOM agent can
|
||||
skate past if it never touches those APIs, are load-bearing here because the whole
|
||||
interaction is mediated by what the machine can actually draw.
|
||||
|
||||
The rhythm is the second half. A vision agent clicks by coordinate, and if the pointer
|
||||
jumps from point to point without passing through the space between, or the pauses between
|
||||
actions are all shaped like model latency, that pattern is visible to anything watching
|
||||
behaviour rather than fingerprints. This is
|
||||
[the pause shaped like inference time](ai-browser-agents-stealth.md), and it is the same
|
||||
family of signal whether the agent sees text or pixels. The engine gives you Bezier-curve
|
||||
pointer motion for free, but the spacing of your actions is your loop, not the browser's.
|
||||
|
||||
## What the engine changes, and what it does not
|
||||
|
||||
The single fact worth carrying away: invisible_playwright changes the engine fingerprint
|
||||
that both modes inherit, and which part of that helps depends on how the agent perceives
|
||||
the page.
|
||||
|
||||
For a DOM-reading agent, the win is that the DOM and the JavaScript environment read as a
|
||||
genuine Firefox, so the automation and driver tells that would have flagged the read are
|
||||
not there. For a screenshot agent, the win is that the canvas, WebGL and the rest of the
|
||||
graphics surface are consistent and look like a real machine, so the picture and the values
|
||||
that describe it agree. Same engine, same patch, different part of it doing the work.
|
||||
|
||||
Here is the honest boundary. The engine is designed to look like a real browser driven by
|
||||
a real person, which is why it passes most fingerprint, TLS and driver-layer checks: those
|
||||
read as a real Firefox because they are answered by a real, patched Firefox. Neither mode
|
||||
changes two things that sit outside the browser entirely:
|
||||
|
||||
- **The network exit.** Your IP reputation, the ASN, the country. A perfect browser on a
|
||||
known datacenter address still loses, and that is true whether the agent reads text or
|
||||
pixels. Bring a clean proxy.
|
||||
- **The loop timing.** How fast the agent acts, how uniform its pauses are, whether it ever
|
||||
scrolls or waits like a person would. The engine draws a human pointer arc, but the
|
||||
cadence of your actions is yours to pace.
|
||||
|
||||
Neither is a browser property, so no engine patch reaches them. They are the caveat that
|
||||
belongs next to every honest description of what this does:
|
||||
[what fits and what does not](ai-browser-agents-stealth.md).
|
||||
|
||||
## A minimal example
|
||||
|
||||
The launch is the same two lines for both agents. The seed makes the identity
|
||||
reproducible, so a failing run can be replayed rather than guessed at.
|
||||
|
||||
```bash
|
||||
pip install invisible-playwright
|
||||
```
|
||||
|
||||
A DOM-reading agent reads structure and acts on a selector:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
|
||||
# what a text / accessibility-tree agent would hand to the model
|
||||
tree = page.accessibility.snapshot()
|
||||
text = page.inner_text("body")
|
||||
|
||||
# the model returns an action against a selector
|
||||
page.click("a") # pointer arcs to the link on a Bezier curve
|
||||
```
|
||||
|
||||
A screenshot agent reads pixels and acts on coordinates:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
|
||||
# what a vision agent would hand to the model
|
||||
shot = page.screenshot()
|
||||
|
||||
# the model returns pixel coordinates; the arc between clicks is drawn for you
|
||||
page.mouse.click(220, 140)
|
||||
```
|
||||
|
||||
The `browser` is a real Playwright `Browser`, so `accessibility.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.
|
||||
The only change from plain Playwright is the two-line launch. What differs between the two
|
||||
snippets is not the stealth, it is which surface the agent is leaning on, and therefore
|
||||
which part of the shared engine work is carrying it.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Detection is layered, and an agent only walks through the layers its way of seeing touches.
|
||||
A DOM-reading agent is exposed at the DOM and driver layer, which is where the automation
|
||||
flags live and where a patched engine does its most visible work. A screenshot agent is
|
||||
exposed at the graphics surface and in its rhythm, where canvas and GPU realness and the
|
||||
cadence of its clicks decide the run. The engine changes the fingerprint both inherit, so
|
||||
the fix is the same install either way, but knowing which half is load-bearing tells you
|
||||
where to look when a run still fails. And when it fails for the two reasons the engine does
|
||||
not touch, the address or the pacing, no amount of fingerprint work will move it.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does the stealth engine help a vision agent at all?** Yes, through the graphics surface.
|
||||
The canvas, WebGL and renderer read as a real machine, which is what a screenshot agent
|
||||
leans on, even though it never reads a single DOM flag.
|
||||
|
||||
**Do DOM automation flags matter to a screenshot agent?** Mostly not, because it never
|
||||
reads them. They matter to a text or accessibility-tree agent, which acts on the DOM the
|
||||
flags live in.
|
||||
|
||||
**Which mode is harder to keep undetected?** Neither is strictly harder. They are exposed
|
||||
in different places, so a screenshot agent needs the graphics surface and its rhythm to be
|
||||
right, while a DOM agent needs the driver layer clean.
|
||||
|
||||
**Will this make my agent undetectable?** No. It makes the browser look like a real one,
|
||||
which passes most fingerprint and driver checks. It does not touch your IP reputation or
|
||||
your loop timing, and both of those get sessions blocked on their own.
|
||||
|
||||
**Does the engine fix my agent's timing?** It draws a human pointer arc between clicks. It
|
||||
does not pace your actions. Uniform pauses shaped like model latency are still yours to
|
||||
smooth out.
|
||||
|
||||
**Do I change my code depending on the agent type?** No. The launch is identical. The DOM
|
||||
versus pixel difference is in how your agent already reads the page, not in how you start
|
||||
the browser.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's quickstart and configuration pages for the launch API, the seed, and the
|
||||
proxy and timezone handling used above.
|
||||
- The project's own notes on agent behaviour, where the model-latency pause and the
|
||||
boundary between fingerprint and pacing are documented from measurement rather than
|
||||
guesswork.
|
||||
|
||||
**See also:** [what fits and what does not for AI browser agents](ai-browser-agents-stealth.md),
|
||||
[why navigator.webdriver is not the tell you think it is](navigator-webdriver-explained.md),
|
||||
and [can websites detect Playwright](can-websites-detect-playwright.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 changes what the
|
||||
page can measure about the browser; the address and the pacing are still yours to bring.*
|
||||
@@ -0,0 +1,226 @@
|
||||
---
|
||||
title: "Drag and drop elements in Playwright with drag_to"
|
||||
description: "Drag and drop with drag_to in Playwright. Why pointer events are trusted on patched Firefox, and the limit: programmatic paths are not human mouse motion."
|
||||
parent: "The Automation Layer"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 40
|
||||
---
|
||||
|
||||
|
||||
# Drag and drop elements in Playwright with drag_to
|
||||
|
||||
Dragging one element onto another is one of those interactions that looks trivial
|
||||
and then quietly fails. A hand-dispatched `dragstart` event runs the site's handler,
|
||||
the element does not move, and nothing tells you why. Playwright has a proper helper
|
||||
for this, and on a patched browser the events it fires are indistinguishable from a
|
||||
real pointer at the trust level. That last part is worth being precise about, because
|
||||
it is true in a way that matters and false in a way that also matters.
|
||||
|
||||
This page is the two ways to drag in Playwright, why the events come back trusted, a
|
||||
runnable example, and the one honest limit you should know before you point this at
|
||||
anything that scores the motion itself.
|
||||
|
||||
## The two ways to drag in Playwright
|
||||
|
||||
Playwright gives you two documented calls, and they are the same operation at
|
||||
different altitudes.
|
||||
|
||||
[`locator.drag_to(target)`](https://playwright.dev/python/docs/api/class-locator#locator-drag-to)
|
||||
is the locator-first form. You already have a source locator, you hand it a target
|
||||
locator, and Playwright performs the full sequence: hover the source, press the mouse
|
||||
button, move to the target, release.
|
||||
|
||||
[`page.drag_and_drop(source, target)`](https://playwright.dev/python/docs/api/class-page#page-drag-and-drop)
|
||||
is the selector form. You pass two selector strings and it resolves both, then runs
|
||||
the identical hover-press-move-release sequence. Use it when you do not already hold
|
||||
the locators.
|
||||
|
||||
Both do the real thing. Neither one dispatches a synthetic `DragEvent` into the DOM
|
||||
and hopes the handler accepts it, which is the approach that fails silently on sites
|
||||
that check the event is real. They drive the actual pointer through the browser's
|
||||
input path, so the page sees a genuine press, a genuine move and a genuine release.
|
||||
|
||||
## Why the events come back trusted
|
||||
|
||||
Every DOM event carries an [`isTrusted`](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted)
|
||||
flag. The browser sets it to `true` for input it generated from a real device and
|
||||
`false` for anything a script dispatched with `dispatchEvent`. A site that guards a drag handler with `if (!event.isTrusted)
|
||||
return;` throws away scripted drags and keeps human ones, and there is no way to set
|
||||
`isTrusted` from JavaScript. It is read-only by design.
|
||||
|
||||
invisible_playwright drives a Firefox that has been patched at the C++ level, and
|
||||
Playwright's input commands travel through the browser's native input path rather than
|
||||
through a JavaScript shim. The press, the moves and the release that `drag_to`
|
||||
produces arrive as engine-generated events, so `isTrusted` reads `true` on every one
|
||||
of them. From the page's point of view the drag came from a pointer, because at the
|
||||
level the flag measures, it did. This is the same mechanism that makes
|
||||
[Playwright clicks report isTrusted=true](playwright-clicks-istrusted.md) on this
|
||||
build rather than the `false` a page-level automation layer is stuck with.
|
||||
|
||||
That is the part that is genuinely solved. The next section is the part that is not.
|
||||
|
||||
## A runnable example
|
||||
|
||||
Switching from stock Playwright is a two-line change, and every method you already
|
||||
know keeps working. Here is a drag using the locator form:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com/board")
|
||||
|
||||
source = page.locator("#card-1")
|
||||
target = page.locator("#column-done")
|
||||
|
||||
source.drag_to(target) # hover, press, move, release - all trusted
|
||||
```
|
||||
|
||||
The selector form is the same operation without holding the locators first:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com/board")
|
||||
|
||||
page.drag_and_drop("#card-1", "#column-done")
|
||||
```
|
||||
|
||||
The `seed=42` is what makes a failure reproducible: the same seed gives the same GPU,
|
||||
canvas, fonts and screen every run, so a drag that misbehaves can be replayed exactly
|
||||
instead of chased across random identities. Confirm the drop actually landed by
|
||||
asserting on the DOM afterwards, not by trusting the call returned:
|
||||
|
||||
```python
|
||||
from playwright.sync_api import expect
|
||||
expect(page.locator("#column-done")).to_contain_text("card 1")
|
||||
```
|
||||
|
||||
If you need finer control - a pause mid-drag, an intermediate waypoint, a hover to
|
||||
trigger a drop zone highlight - drop to the
|
||||
[low-level mouse API](https://playwright.dev/python/docs/api/class-mouse)
|
||||
(`page.mouse.move`, `page.mouse.down`, `page.mouse.up`) and build the sequence
|
||||
yourself. Everything on the returned `browser` is the stock Playwright API, so this is
|
||||
the ordinary manual-drag recipe, unchanged.
|
||||
|
||||
## The honest limit: a straight line is not a human drag
|
||||
|
||||
Here is the caveat, stated plainly, because skipping it would be the dishonest version
|
||||
of this page.
|
||||
|
||||
`drag_to` and `drag_and_drop` move the pointer from source to target on a straight
|
||||
programmatic path. The events are trusted, but the trajectory is a machine's: a
|
||||
direct interpolation from A to B, evenly spaced, with none of the overshoot, curve,
|
||||
micro-correction or variable speed a hand produces. For a functional drag - reordering
|
||||
a list, moving a card between columns, sorting a table - this is completely fine. The
|
||||
handler cares that a real pointer pressed, moved and released over the right elements,
|
||||
and it got exactly that.
|
||||
|
||||
It is not fine for a challenge that scores the *shape* of the movement. A slider
|
||||
puzzle or a drag-to-verify widget records the path itself - the velocity profile, the
|
||||
acceleration, whether the line is arrow-straight - and a perfectly straight, uniformly
|
||||
timed drag reads as a machine even though every event on it carries `isTrusted=true`.
|
||||
The trust flag and the motion curve are two independent signals. `drag_to` gives you
|
||||
the first for free and does nothing for the second.
|
||||
|
||||
For those cases the built-in helper is the wrong tool. You want humanized pointer
|
||||
motion driving the same low-level mouse calls, which is a
|
||||
[behaviour problem rather than a trust problem](human-mouse-movement.md): a good
|
||||
[Bezier path from a cursor library](ghost-cursor-human-mouse.md) fed through
|
||||
`page.mouse.*`. Note that even invisible_playwright's own Bezier cursor is applied on
|
||||
click and move, and the same subtlety that makes
|
||||
[hover collapse to a near-teleport](hover-mouse-movement-bug.md) applies here - the
|
||||
convenience helper does not route through it. Know which of the two problems you have
|
||||
before you reach for a fix.
|
||||
|
||||
## What drag_to does not fix
|
||||
|
||||
Trusted events are a browser property, and a drag is one interaction inside a session.
|
||||
Neither one touches the things that get a session blocked for reasons that have nothing
|
||||
to do with the drag.
|
||||
|
||||
- **IP reputation.** A trusted drag from a datacenter address that a scoring system
|
||||
already knows is still from that address. Supply a clean exit; see
|
||||
[configuration](configuration.md) for how the proxy and the auto-derived timezone
|
||||
fit together.
|
||||
- **Per-account quotas and rate limits.** No pointer event resets a counter. If an
|
||||
account or an address is over its allowance, a flawless drag does not move it back
|
||||
under.
|
||||
- **Behaviour and timing.** The drag being trusted says nothing about the fifty
|
||||
milliseconds before it or the pace of the session around it. A page filled and
|
||||
submitted in eighty milliseconds is a timing signal regardless of every event on it
|
||||
being real.
|
||||
- **Motion scoring**, as above - a separate signal from the trust flag.
|
||||
|
||||
invisible_playwright is built to look like a real browser driven by a real person, and
|
||||
that is why the fingerprint, TLS and driver layers read as a genuine Firefox and why
|
||||
the drag events are trusted. It does not, on its own, fix your address, your quotas or
|
||||
your pacing. Those you supply: a clean proxy and human timing. When a clean fingerprint
|
||||
still gets blocked, [the reason is usually one of those](why-blocked-with-a-clean-fingerprint.md),
|
||||
not the browser.
|
||||
|
||||
## Conclusion
|
||||
|
||||
For a functional drag - reorder, move, sort - `locator.drag_to(target)` or
|
||||
`page.drag_and_drop(source, target)` is the right call, and on a patched Firefox the
|
||||
hover-press-move-release it produces arrives with `isTrusted=true`, so handlers that
|
||||
throw away scripted drags accept it. That solves the trust half of the problem
|
||||
completely.
|
||||
|
||||
It does not solve the motion half. The built-in path is straight and evenly timed, and
|
||||
anything that scores the trajectory sees a machine. For those, drive humanized motion
|
||||
through the low-level mouse API instead. Know which problem you have, and the two-line
|
||||
switch handles the common case with nothing else to learn.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**How do I drag and drop in Playwright?** `locator.drag_to(target)` if you have the
|
||||
locators, or `page.drag_and_drop(source, target)` with selector strings. Both run the
|
||||
full hover-press-move-release.
|
||||
|
||||
**Are Playwright drag events real or synthetic?** On a patched Firefox they are real:
|
||||
the input goes through the browser's native input path, so every event carries
|
||||
`isTrusted=true`. A hand-dispatched `DragEvent` would be `false`.
|
||||
|
||||
**Why does my manual dragstart event do nothing?** Because a script-dispatched event
|
||||
has `isTrusted=false`, and any handler that checks the flag ignores it. Use `drag_to`,
|
||||
which drives the actual pointer.
|
||||
|
||||
**Will drag_to pass a slider or drag-to-verify challenge?** Not reliably. The events
|
||||
are trusted, but the path is straight and uniform, and a challenge that scores the
|
||||
motion curve sees a machine. That needs humanized pointer motion, not the built-in
|
||||
helper.
|
||||
|
||||
**How do I add pauses or waypoints to a drag?** Drop to `page.mouse.move`,
|
||||
`page.mouse.down` and `page.mouse.up` and build the sequence yourself. The returned
|
||||
browser is the full stock Playwright API.
|
||||
|
||||
**Does a trusted drag mean I will not get blocked?** No. It fixes the event trust
|
||||
level only. Your IP reputation, account quotas, rate limits and session timing are
|
||||
separate, and you supply the clean proxy and human pacing.
|
||||
|
||||
## Sources
|
||||
|
||||
- Playwright's documented [`locator.drag_to`](https://playwright.dev/python/docs/api/class-locator#locator-drag-to)
|
||||
and [`page.drag_and_drop`](https://playwright.dev/python/docs/api/class-page#page-drag-and-drop),
|
||||
and the low-level [`page.mouse`](https://playwright.dev/python/docs/api/class-mouse) API.
|
||||
- The [WHATWG DOM specification for `Event.isTrusted`](https://dom.spec.whatwg.org/#dom-event-istrusted)
|
||||
and [MDN's `Event.isTrusted` reference](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted):
|
||||
read-only, true only for user-agent-generated events.
|
||||
- This project's input path, where Playwright's press, move and release commands are
|
||||
delivered as engine-generated events so the `isTrusted` flag reads true.
|
||||
- This project's own notes on where pointer-motion realism ends, linked throughout.
|
||||
|
||||
**See also:** [do automated clicks report isTrusted=true](playwright-clicks-istrusted.md),
|
||||
[human-like mouse movement past the Bezier curve](human-mouse-movement.md), and
|
||||
[uploading files, another interaction that needs a trusted event](how-to-upload-files-playwright.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 trusted-events half
|
||||
is solved; the straight-line-motion half is honestly not, and this page says which is
|
||||
which.*
|
||||
@@ -0,0 +1,246 @@
|
||||
---
|
||||
title: "Emoji fingerprinting: why emoji look the same on any OS"
|
||||
description: "Emoji usually leak the host OS, since each platform ships its own emoji font. Firefox draws colour emoji from a bundled font, so they look identical everywhere."
|
||||
parent: "Canvas, WebGL, Fonts and Audio"
|
||||
grand_parent: "Guides"
|
||||
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.
|
||||
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
|
||||
from Segoe UI Emoji, macOS from Apple Color Emoji, Android from Noto Color Emoji.
|
||||
Paint one emoji into a canvas, hash the pixels, and you have a signal that separates
|
||||
the three without asking a single JavaScript question about the platform.
|
||||
|
||||
That makes emoji an attractive check for a detector, and a trap for automation
|
||||
that claims one OS while running on another. This page is about why that trap
|
||||
mostly does not apply to Firefox, what still can go wrong, and how to read the
|
||||
surface yourself instead of trusting a claim.
|
||||
|
||||
## Why emoji are a classic OS tell
|
||||
|
||||
Emoji are a classic OS tell because each platform ships its own colour-emoji font,
|
||||
and those fonts render the same code point as different pixels: different shapes,
|
||||
palettes, metrics, and coverage of newer code points. The mechanism is the same as
|
||||
any font fingerprint, only sharper. A plain glyph like the letter "a" is drawn from
|
||||
a text font, and text fonts differ enough between systems to matter, but the visual
|
||||
gap between a Windows emoji and an Apple one is far larger than the gap between two
|
||||
Latin text fonts, so the pixel hash separates cleanly.
|
||||
|
||||
It is also cheap to read. A detector does not need to enumerate anything or ask
|
||||
for a permission. It draws a handful of emoji to an offscreen canvas, reads the
|
||||
pixels back, and compares against a table of known per-OS renders. A browser
|
||||
claiming Windows that produces the Apple emoji set has contradicted itself, and
|
||||
[a contradiction is exactly what the tampering-focused suites look for](how-to-test-bot-detection.md).
|
||||
The same logic sits behind [why a headless container often renders different fonts](headless-fonts-differ.md)
|
||||
than the desktop it claims to be.
|
||||
|
||||
## Firefox draws its own emoji, and that changes the game
|
||||
|
||||
Here is the part most anti-detect writeups miss. Firefox does not use the
|
||||
operating system's emoji font at all. It ships its own colour-emoji font, based on
|
||||
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
|
||||
host.
|
||||
|
||||
That is a structural difference from Chrome, which defers to the platform emoji
|
||||
font, and it is the reason emoji are a much weaker OS tell in Firefox than people
|
||||
assume. The engine has already made the render host-independent.
|
||||
|
||||
| Browser | Where the emoji font comes from | Emoji as an OS tell |
|
||||
|---|---|---|
|
||||
| Firefox | Bundled with the browser (Twemoji-based) | Weak: the same render on every OS |
|
||||
| Browsers using the OS font (e.g. Chrome) | The host operating system's emoji font | Strong: the render changes per OS |
|
||||
|
||||
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
|
||||
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
|
||||
authored by Mozilla, not supplied by Microsoft, so it is not a Windows system
|
||||
family and it is not exposed as one of the spoofed Windows families that a page
|
||||
can enumerate. It is kept as the emoji fallback instead. The result is the one you
|
||||
want: emoji do not appear in the Windows family list, so they cannot contradict
|
||||
it, and they still render, from the same engine-provided font a real Firefox uses.
|
||||
An emoji drawn on the Linux server is byte-for-byte the emoji drawn on a Windows
|
||||
desktop, because both come from the browser, not the box.
|
||||
|
||||
## Reading the emoji surface yourself
|
||||
|
||||
Do not take any of this on faith. Measure it. Every session is derived from a
|
||||
seed, so a fixed seed gives you a fixed identity to read twice and compare, using
|
||||
the same [`toDataURL()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL)
|
||||
canvas readback every emoji fingerprinting probe relies on.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# Written as unicode escapes so the source stays ASCII; each is a real emoji.
|
||||
EMOJI = [
|
||||
"\U0001F600", # grinning face
|
||||
"\U0001F44D", # thumbs up
|
||||
"\U00002764\U0000FE0F", # red heart
|
||||
"\U0001F1EE\U0001F1F9", # regional-indicator flag
|
||||
]
|
||||
|
||||
def emoji_hash(page, ch):
|
||||
return page.evaluate(
|
||||
"""(ch) => {
|
||||
const c = document.createElement('canvas');
|
||||
c.width = 64; c.height = 64;
|
||||
const ctx = c.getContext('2d');
|
||||
ctx.textBaseline = 'top';
|
||||
ctx.font = '48px sans-serif';
|
||||
ctx.fillText(ch, 4, 4);
|
||||
return c.toDataURL();
|
||||
}""",
|
||||
ch,
|
||||
)
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
for ch in EMOJI:
|
||||
print(repr(ch), emoji_hash(page, ch)[:48])
|
||||
```
|
||||
|
||||
Run that on your laptop and on the server you deploy to. The emoji data URLs
|
||||
should match across the two machines, because the emoji font is the same on both.
|
||||
If they differ, something is drawing emoji from a host font, and that is the bug
|
||||
to chase.
|
||||
|
||||
You can also confirm it visually, which is the check a pixel hash cannot lie
|
||||
about. Reading the screenshot rather than the log catches the case where the text
|
||||
extractor was looking at the wrong thing:
|
||||
|
||||
```python
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.set_content(
|
||||
"<div style='font-size:64px'>"
|
||||
"\U0001F600 \U0001F44D \U00002764\U0000FE0F \U0001F1EE\U0001F1F9"
|
||||
"</div>"
|
||||
)
|
||||
page.screenshot(path="emoji.png")
|
||||
# Open emoji.png. The colour emoji must be present and identical on every host.
|
||||
```
|
||||
|
||||
Two runs with the same seed must produce identical emoji hashes, the same way any
|
||||
canvas read must be stable within a session. A value that changes per call is
|
||||
[the cheapest tampering signal a detector can ask for](canvas-fingerprint-noise.md),
|
||||
and it applies to emoji exactly as it applies to plain text.
|
||||
|
||||
## Where an emoji difference can still creep in
|
||||
|
||||
A non-tell is not a solved problem you can stop thinking about. A few ways emoji
|
||||
can still differ from a real Firefox:
|
||||
|
||||
- **A second spoofing layer.** If you stack a JavaScript patch or a font-faking
|
||||
plugin on top of the engine, it can intercept canvas reads and reshape the
|
||||
emoji output, producing a value that no real Firefox emits. One layer is the
|
||||
rule; two layers contradict each other.
|
||||
- **Text presentation of an emoji.** Some code points can render as a flat
|
||||
monochrome glyph or as a colour emoji depending on a variation selector. If your
|
||||
content omits the selector on a code point that needs it, you may get a text
|
||||
glyph where a human would see colour. That is a content bug, not an engine one,
|
||||
but it still shows up in a pixel comparison.
|
||||
- **Very new code points.** Any bundled emoji font has a coverage date. A code
|
||||
point newer than the font falls back to a tofu box or a component render, and if
|
||||
the reference browser you compare against ships a newer font, the two disagree.
|
||||
Compare against the same Firefox build you deploy, not against a browser on your
|
||||
desktop.
|
||||
- **Assuming the emoji surface stands in for the whole font surface.** Emoji being
|
||||
clean says nothing about Latin, CJK or the family enumeration. Those are separate
|
||||
checks and want their own comparison.
|
||||
|
||||
The general habit is the one that governs every surface: compare the automated
|
||||
browser against a stock one on the same machine, field by field, and treat a
|
||||
suppressed or blank emoji as a failure rather than a pass.
|
||||
|
||||
## What we measured across operating systems
|
||||
|
||||
The claim is only worth as much as the measurement behind it. The cross-OS font
|
||||
gate runs the browser on a Linux host that has no Windows fonts installed at all,
|
||||
and reads what it renders. The Windows text families all resolve from the bundled
|
||||
files, none of the host's own Linux fonts leak into the enumeration, and Latin,
|
||||
Japanese, simplified and traditional Chinese, Korean and the colour emoji all
|
||||
render genuinely rather than as fallback boxes.
|
||||
|
||||
The emoji specifically came back identical to the Windows-host render, which is
|
||||
exactly what the engine-provided emoji font predicts: the host has no say in it.
|
||||
That is the whole point of the design. On a signal that separates Windows, macOS
|
||||
and Android at a glance for most automation, a Firefox built this way produces the
|
||||
same emoji everywhere, so the emoji tell has nothing to catch. It is one field
|
||||
among the many a session derives from its seed, and it is one that costs a
|
||||
container-based scraper nothing to get wrong and everything to get right.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Emoji are a strong OS tell for browsers that draw them from the operating system,
|
||||
and a weak one for Firefox, which draws them from a font it carries itself. This
|
||||
project leans on that: text is made to match Windows from a bundle of real Windows
|
||||
fonts, while the colour-emoji font stays the engine's own Mozilla-authored file, so
|
||||
emoji never enter the spoofed Windows family list yet always render from the same
|
||||
source a real Firefox uses. Measured across operating systems, the emoji come out
|
||||
identical. The right way to trust that is not to trust it: fix a seed, draw the
|
||||
emoji twice, and read the pixels.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Do emoji reveal my operating system?** In most browsers yes, because each
|
||||
platform draws them from a different emoji font. In Firefox much less so, because
|
||||
Firefox rasterises colour emoji from its own bundled font on every platform.
|
||||
|
||||
**Why do my emoji look the same on Windows and Linux with this tool?** Because the
|
||||
emoji font travels with the browser rather than coming from the host, so the host
|
||||
OS does not change the render.
|
||||
|
||||
**Can a detector tell the OS from a canvas emoji?** It can try, by hashing the
|
||||
pixels of a drawn emoji against a per-OS table. With an engine-provided emoji font
|
||||
the render is host-independent, so that table has nothing distinguishing to match.
|
||||
|
||||
**Are the emoji spoofed or faked?** No. They are drawn from Firefox's own bundled
|
||||
emoji font, unmodified. Faking them would create a value no real Firefox emits,
|
||||
which is the opposite of what you want.
|
||||
|
||||
**Why is the emoji font not in the Windows font list I can enumerate?** Because it
|
||||
is a Mozilla-authored file, not a Windows system font. Exposing it as a Windows
|
||||
family would be a contradiction; keeping it as the emoji fallback is not.
|
||||
|
||||
**Should I still test the emoji surface?** Yes. Fix a seed, draw the same emoji
|
||||
twice, and confirm the hashes match within a session and across the machines you
|
||||
deploy on. A blank or changing emoji is a failure, not a pass.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's font architecture and its cross-OS font gate, which runs the
|
||||
browser on a Linux host with no Windows fonts and reads what it renders,
|
||||
including colour emoji (decision log, 2026-06-20).
|
||||
- Firefox's use of a bundled colour-emoji font in place of the platform emoji
|
||||
font, verified against a stock build on more than one operating system.
|
||||
- [`HTMLCanvasElement.toDataURL()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL)
|
||||
(MDN), the canvas readback method the emoji hash in this page's code sample
|
||||
relies on.
|
||||
- The public detection suites named across this documentation set, read from
|
||||
their own source rather than from a rendered verdict.
|
||||
|
||||
**See also:** [bundled fonts that render the same on every OS](bundled-fonts-cross-platform.md),
|
||||
[why headless renders different fonts](headless-fonts-differ.md), and
|
||||
[the method for testing whether a browser is detected](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 emoji came back
|
||||
identical on a Linux server with no Windows fonts, which is the whole reason this
|
||||
page exists.*
|
||||
@@ -0,0 +1,175 @@
|
||||
---
|
||||
title: "Execution context was destroyed, and when it means detection"
|
||||
description: "Execution context was destroyed is usually a race condition, but sometimes it means a site redirected you to a challenge. Here is how to tell the two apart."
|
||||
parent: "The Automation Layer"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 4
|
||||
---
|
||||
|
||||
|
||||
# Execution context was destroyed, and when it means detection
|
||||
|
||||
```
|
||||
Error: Execution context was destroyed, most likely because of a navigation
|
||||
```
|
||||
|
||||
This is one of the most searched Playwright and Puppeteer errors, and almost every
|
||||
answer to it is about race conditions, which is correct most of the time. It is also
|
||||
the error you get when a site decides mid-visit that it does not like you, and the two
|
||||
cases look identical from the stack trace.
|
||||
|
||||
This page separates them, because the fixes have nothing in common and people spend
|
||||
days applying one to the other.
|
||||
|
||||
## What the error actually is
|
||||
|
||||
When you evaluate JavaScript in a page, the browser runs it inside an execution context
|
||||
belonging to that document. Navigate, and that document is gone, and so is its context.
|
||||
Anything still holding a reference to it fails.
|
||||
|
||||
```python
|
||||
page.goto("https://example.com")
|
||||
handle = page.query_selector("#thing")
|
||||
page.click("#submit") # triggers a navigation
|
||||
handle.inner_text() # the context this handle belonged to no longer exists
|
||||
```
|
||||
|
||||
The error is accurate and the browser is behaving correctly. Something navigated while
|
||||
you were still talking to the old page.
|
||||
|
||||
Related messages with the same root cause: `Target closed`, `Frame was detached`,
|
||||
`Node is detached from document`.
|
||||
|
||||
## The ordinary causes, which are most of them
|
||||
|
||||
**A handle that outlived its page.** Element handles, frames and contexts are bound to
|
||||
a document. Re-query after any navigation instead of carrying references across one.
|
||||
|
||||
**An implicit navigation you did not plan.** A click on a link or a submit button
|
||||
navigates. So does a form submission, a meta refresh, and a framework doing
|
||||
client-side routing that replaces the document.
|
||||
|
||||
**Racing the load.** Evaluating while the page is still settling, so your call lands
|
||||
just as a redirect fires.
|
||||
|
||||
**A redirect chain.** `goto` returns on the first response; a page that then bounces
|
||||
through two more URLs destroys contexts under you.
|
||||
|
||||
The fixes are the usual ones: wait for the navigation instead of guessing, re-query
|
||||
handles after it, and use the API's own waiting rather than sleeping.
|
||||
|
||||
```python
|
||||
with page.expect_navigation():
|
||||
page.click("#submit")
|
||||
page.query_selector("#thing").inner_text() # fresh handle, new context
|
||||
```
|
||||
|
||||
If that solves it, you are done, and the rest of this page is not about you.
|
||||
|
||||
## When it is the site, not your code
|
||||
|
||||
Sometimes the error is not your code at all: the site navigated you away on purpose,
|
||||
and the destroyed context is the side effect. This is the case nobody writes about.
|
||||
|
||||
A site that decides a session is automated does not usually return a clean error. It
|
||||
redirects: to a challenge page, to an interstitial, to a login wall, sometimes to the
|
||||
same URL with different content. Every one of those is a navigation, and a navigation
|
||||
mid-evaluation produces exactly this error.
|
||||
|
||||
So the same message means either "my code raced" or "the page moved me somewhere else
|
||||
because it did not want me".
|
||||
|
||||
Four signals separate a race in your code from a block by the site:
|
||||
|
||||
| Signal | Your code raced | The site moved you |
|
||||
|---|---|---|
|
||||
| Where it shows up | Anywhere the timing is tight | One specific site, never elsewhere |
|
||||
| How often | Intermittent, unpredictable | Reliably, at the same step |
|
||||
| Final `page.url` | The URL you asked for | A challenge, login wall, or interstitial |
|
||||
| When in the flow | Often at load | Usually after an interaction |
|
||||
|
||||
The same four points in full:
|
||||
|
||||
**It happens on one site and never elsewhere.** Race conditions are a property of your
|
||||
code and show up wherever the timing is tight. A block is a property of one target.
|
||||
|
||||
**It happens at the same point in the flow every time.** Races are intermittent by
|
||||
nature. A challenge fires reliably, usually after the same action.
|
||||
|
||||
**The final URL is not the one you asked for.** Read it when the error fires. This is
|
||||
the single most useful thing you can do, and it takes one line.
|
||||
|
||||
**It arrives after an interaction rather than at load.** A navigation triggered by a
|
||||
scoring decision usually comes after something happened, which is also the signature of
|
||||
behavioural analysis.
|
||||
|
||||
## The four lines that tell you which one you have
|
||||
|
||||
Catch the error and look at the page instead of the stack:
|
||||
|
||||
```python
|
||||
try:
|
||||
...
|
||||
except Exception:
|
||||
print("url:", page.url)
|
||||
print("title:", page.title())
|
||||
print("body head:", page.content()[:400])
|
||||
page.screenshot(path="where-did-i-end-up.png")
|
||||
```
|
||||
|
||||
Then read the screenshot. Not the log, the image.
|
||||
|
||||
- The URL you expected, and the content you expected: your code raced.
|
||||
- A different URL, a challenge, an interstitial, or a body far shorter than the real
|
||||
page: the site moved you, and the error is a symptom.
|
||||
|
||||
That distinction takes a minute and it decides whether you spend the next day on
|
||||
waiting logic or on the browser's fingerprint.
|
||||
|
||||
## If it turns out to be the site
|
||||
|
||||
Then the error is not the problem and fixing your waits will not help. Work
|
||||
[the checklist](playwright-detected-as-bot.md) in order, and note two things it will
|
||||
tell you that are relevant here specifically:
|
||||
|
||||
- A block that arrives **after an interaction** points at behaviour rather than at the
|
||||
fingerprint. That is step five, and
|
||||
[the pointer events page](human-mouse-movement.md) is the detail.
|
||||
- A block that arrives **at the first load** points at the fingerprint or the address,
|
||||
which is steps three and seven.
|
||||
|
||||
The timing of the navigation is itself evidence, and it is free.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**How do I fix "Execution context was destroyed"?** If it is a race, wait for the
|
||||
navigation and re-query your handles afterwards. If the page navigated because the site
|
||||
sent you somewhere, no amount of waiting fixes it.
|
||||
|
||||
**Is this error a sign of bot detection?** Sometimes. It is a sign that a navigation
|
||||
happened during your evaluation, and a redirect to a challenge is a navigation.
|
||||
|
||||
**How do I tell the difference?** Read `page.url` and take a screenshot when it fires.
|
||||
If you ended up somewhere you did not ask for, it is the site.
|
||||
|
||||
**Does [`wait_until="networkidle"`](https://playwright.dev/python/docs/api/class-page#page-goto) fix it?** It changes when `goto` returns, which helps
|
||||
with some races and does nothing for a redirect that happens later.
|
||||
|
||||
**Why does it only happen in headless or only in CI?** Usually timing, because a loaded
|
||||
machine changes the race. Occasionally the environment, because a container is more
|
||||
detectable than your laptop and a challenge fires there and not at home.
|
||||
|
||||
**What about "Target closed"?** Same family. The page or the browser went away while you
|
||||
were talking to it, and the diagnosis is the same: find out what the browser was doing
|
||||
at that moment.
|
||||
|
||||
**See also:** [the checklist for being detected on one site](playwright-detected-as-bot.md),
|
||||
which is where to go if the URL came back wrong, and
|
||||
[Playwright in Docker](playwright-docker-detection.md), for the case where it only
|
||||
happens in CI.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright).
|
||||
The screenshot-on-failure habit is the cheapest debugging change in this whole subject
|
||||
and the one most often skipped.*
|
||||
@@ -0,0 +1,108 @@
|
||||
---
|
||||
title: "fake-useragent is archived: what changes and what doesn't"
|
||||
description: "The fake-useragent Python package was archived by its maintainer in 2026. What breaks, what to use instead, and why the string alone was never the whole fix."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 16
|
||||
---
|
||||
|
||||
|
||||
# fake-useragent is archived: what changes and what doesn't
|
||||
|
||||
The `fake-useragent` Python package was archived by its own maintainer in 2026.
|
||||
Archived means read-only: no new releases, no merged fixes, and a bundled string
|
||||
database frozen at whatever it held on the archive date. If a script that used to
|
||||
pull a random, realistic-looking user agent string suddenly started failing on
|
||||
import, that is why. GitHub's archive state is unambiguous: no issue or pull request
|
||||
against the repository will ever be merged again.
|
||||
|
||||
The practical break is real, but the premise underneath the package was always
|
||||
incomplete: a current user agent string is only one claim a session makes, and
|
||||
detectors check whether the claims agree with each other, not whether any single
|
||||
string looks plausible on its own. This page covers what breaks, what to replace it
|
||||
with, and why [changing the user agent string alone was never enough](is-changing-user-agent-enough.md).
|
||||
|
||||
## What actually breaks
|
||||
|
||||
`fake-useragent` did one specific job well: keep a database of real, current user
|
||||
agent strings scraped from real traffic, and hand back a random one so a script's
|
||||
requests didn't all announce themselves with the same static, obviously-scripted
|
||||
string. That database is now frozen at whatever it contained on the archive date. It
|
||||
will not pick up new Chrome or Firefox version strings as they ship, and eventually
|
||||
every string it hands out will be for a version old enough to be its own tell.
|
||||
|
||||
The immediate practical break, for anyone who imported it expecting continued
|
||||
service: no new releases, no fixes for the inevitable moment the data source it
|
||||
scraped changes shape, and an import that plenty of tutorials still show as the
|
||||
default way to get a "realistic" header.
|
||||
|
||||
## The part worth understanding regardless of the archive date
|
||||
|
||||
Losing an actively updated string database is a real, practical loss. But the
|
||||
premise underneath it - that a realistic, current user agent string is what makes a
|
||||
request look legitimate - was already incomplete before this package existed and
|
||||
stays incomplete with a perfectly current one.
|
||||
|
||||
[A user agent string is one claim among many a real session makes](playwright-user-agent.md),
|
||||
and a request or a browser session is checked for whether those claims agree with
|
||||
each other, not for whether any single one of them looks plausible in isolation. A
|
||||
freshly scraped, perfectly current Chrome 130 user agent string sitting on top of
|
||||
[a TLS handshake that names a different browser](tls-fingerprint-user-agent-mismatch.md),
|
||||
or a font list that doesn't match the claimed OS, is a contradiction - it just takes one more field to notice than a
|
||||
stale or obviously-fake string does. The database going stale makes the tell
|
||||
cheaper to find. It doesn't create a problem that a live, always-current database
|
||||
would have solved outright.
|
||||
|
||||
## What to check in your own setup
|
||||
|
||||
If a script depended on this package for HTTP requests without a real browser
|
||||
attached, the honest fix is deciding what's actually being verified against you: a
|
||||
static list of current strings, hand-maintained and updated on your own schedule,
|
||||
covers the same ground for [a pure HTTP client](http-client-vs-real-browser.md) and
|
||||
doesn't depend on an external package's continued maintenance either way.
|
||||
|
||||
If the user agent is coming from an actual browser session - Playwright, Selenium,
|
||||
anything driving a real engine - the better fix is not to set it at all. The
|
||||
browser's own, honest string already matches everything else the browser reports,
|
||||
which a hand-picked or randomly-sampled string from any database, maintained or
|
||||
archived, cannot guarantee on its own.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Is fake-useragent still usable after being archived?** The code still runs. The
|
||||
data it returns stops reflecting current browser versions as time passes, and no
|
||||
one will be fixing anything that breaks.
|
||||
|
||||
**What should I replace fake-useragent with?** Depends on what's actually consuming
|
||||
the string. For a plain HTTP client with no real browser behind it, a small,
|
||||
manually maintained list of current strings does the same job without depending on
|
||||
a package's upkeep. For anything driving an actual browser, the better fix is
|
||||
letting the browser report its own string rather than overriding it with any
|
||||
database's output.
|
||||
|
||||
**Was fake-useragent's approach flawed even before the archive?** Not flawed for
|
||||
what it was: a way to avoid one static, obviously-scripted string. Incomplete as a
|
||||
standalone answer to "will this request look legitimate," because a string is one
|
||||
field among many that get cross-checked against each other.
|
||||
|
||||
**Does this affect Playwright or Selenium users directly?** Only if the user agent
|
||||
override was being sourced from this package rather than left as the browser's own.
|
||||
[Setting a user agent at all changes what gets checked, not just what the field
|
||||
says](playwright-user-agent.md).
|
||||
|
||||
**See also:** [why you should not set the user agent in Playwright](playwright-user-agent.md),
|
||||
the underlying argument this package's archival makes concrete, and
|
||||
[selenium-stealth hasn't been updated since December 2021](selenium-stealth-unmaintained.md),
|
||||
another popular package in this space whose real status is easy to miss.
|
||||
|
||||
## Sources
|
||||
|
||||
- The package's own repository, checked directly for its archive state and last
|
||||
activity date, rather than assumed from its continued presence in tutorials and
|
||||
existing automation code.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level, where the user agent string is the engine's own
|
||||
and never comes from a database at all.*
|
||||
@@ -0,0 +1,227 @@
|
||||
---
|
||||
title: "Feed invisible_playwright pages into a RAG index"
|
||||
description: "Use invisible_playwright as the fetch stage of a RAG pipeline so JS-rendered, gated pages return real HTML instead of empty documents, then chunk and embed the text."
|
||||
parent: "AI Agents and Frameworks"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 5
|
||||
---
|
||||
|
||||
|
||||
# Feed invisible_playwright pages into a RAG index
|
||||
|
||||
This page uses invisible_playwright as the fetch stage of a retrieval pipeline: it
|
||||
renders each page the way a real Firefox would, presents a real-browser fingerprint so
|
||||
the request is not challenged on sites that gate content, and hands you the finished
|
||||
HTML to extract, chunk and embed. It also states plainly what the browser does not do,
|
||||
because a fetch stage that quietly fails is worse than one that fails loudly.
|
||||
|
||||
A retrieval pipeline is only as good as the documents that reach it, and the most
|
||||
common reason a RAG index is full of empty or half-filled documents is the fetch stage.
|
||||
A plain HTTP loader asks the server for HTML and gets back a shell: the markup that
|
||||
matters is assembled in the browser by JavaScript that the loader never runs. On sources
|
||||
that also gate content behind a fingerprint check, the loader gets less than a shell,
|
||||
because the request never looked like a browser in the first place.
|
||||
|
||||
## Why a plain HTTP loader returns empty documents
|
||||
|
||||
Two different failures produce the same empty document, and they need different fixes.
|
||||
|
||||
The first is rendering. A modern page ships a small HTML skeleton and a bundle of
|
||||
JavaScript, and the text you want is written into the DOM after that JavaScript runs
|
||||
against an API. An HTTP loader downloads the skeleton and stops. There is nothing wrong
|
||||
with the request; the content simply does not exist yet at the moment the loader reads
|
||||
it. You embed the skeleton, retrieval returns the skeleton, and the model answers from
|
||||
navigation chrome.
|
||||
|
||||
The second is gating. Some sources inspect the request before they will serve the real
|
||||
body: the TLS handshake, the header order, the JavaScript environment, whether the thing
|
||||
asking looks like an automated client. A bare HTTP client fails that inspection on the
|
||||
handshake alone and is handed a challenge page or a stub. Again the document that reaches
|
||||
your index is empty, but no amount of waiting for JavaScript fixes it, because the
|
||||
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
|
||||
put a browser in front of the index instead of an HTTP loader.
|
||||
|
||||
## The fetch stage: render with a real browser fingerprint
|
||||
|
||||
Switching from plain Playwright is a two-line change, and after that every method is the
|
||||
standard Playwright API. The `browser` object is a real Playwright `Browser`.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
def fetch_rendered_html(url, seed=42):
|
||||
with InvisiblePlaywright(seed=seed) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto(url, wait_until="networkidle")
|
||||
return page.content()
|
||||
|
||||
html = fetch_rendered_html("https://example.com/article")
|
||||
```
|
||||
|
||||
[`page.goto(..., wait_until="networkidle")`](https://playwright.dev/python/docs/api/class-page#page-goto)
|
||||
waits for the network to settle so the JavaScript-written content is present before
|
||||
`page.content()` reads the DOM. The `seed=42` argument fixes the identity: the GPU,
|
||||
canvas, audio, fonts and screen come back identical on every run, which matters here for
|
||||
a mundane reason. If ingestion of one source fails, you want to replay the exact fetch
|
||||
that failed rather than a fresh random one, so the failure is reproducible instead of a
|
||||
moving target.
|
||||
|
||||
The fingerprint work is why the request is not challenged on sites that gate content:
|
||||
invisible_playwright is a Firefox patched at the C++ level, so the fingerprint, the TLS
|
||||
handshake and the driver layer read as a genuine Firefox rather than an automated
|
||||
client. It looks like a real browser because in the ways that a detector inspects, it is
|
||||
one. If you want to confirm that for your own sources before you trust the pipeline,
|
||||
[test whether the browser is detected](how-to-test-bot-detection.md) against the same
|
||||
pages you intend to ingest, and compare the rendered body against what a stock browser
|
||||
gets.
|
||||
|
||||
## From rendered HTML to chunks to a vector index
|
||||
|
||||
Rendered HTML is still full of navigation, cookie banners and boilerplate you do not want
|
||||
in the index. Extract the main text first, then chunk, then embed. Keeping these stages
|
||||
separate makes each one debuggable on its own.
|
||||
|
||||
```python
|
||||
import trafilatura
|
||||
from langchain_text_splitters import RecursiveCharacterTextSplitter
|
||||
|
||||
def html_to_chunks(html, url):
|
||||
text = trafilatura.extract(html) or ""
|
||||
splitter = RecursiveCharacterTextSplitter(
|
||||
chunk_size=1000,
|
||||
chunk_overlap=150,
|
||||
)
|
||||
return [
|
||||
{"text": chunk, "metadata": {"source": url}}
|
||||
for chunk in splitter.split_text(text)
|
||||
]
|
||||
|
||||
chunks = html_to_chunks(html, "https://example.com/article")
|
||||
```
|
||||
|
||||
The extraction step is worth its own attention: a good extractor drops the chrome and
|
||||
keeps the prose, and getting it wrong pollutes retrieval with menu items. The mechanics
|
||||
of pulling clean prose out of a rendered page are covered in
|
||||
[extracting clean article text](how-to-extract-clean-article-text-playwright.md). Once you
|
||||
have chunks with source metadata, embedding them into a vector store is the ordinary part
|
||||
of the pipeline that does not change because of where the HTML came from.
|
||||
|
||||
## Wiring it into LlamaIndex or LangChain
|
||||
|
||||
Both frameworks accept documents from any source, so the browser fetch drops in as a
|
||||
custom loader that yields the same `Document` objects a built-in loader would. Here it is
|
||||
as a LangChain-style loader that renders each URL and returns one document per page for
|
||||
the framework's own splitter and index to consume:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
from langchain_core.documents import Document
|
||||
import trafilatura
|
||||
|
||||
def load_documents(urls, seed=42):
|
||||
docs = []
|
||||
with InvisiblePlaywright(seed=seed) as browser:
|
||||
page = browser.new_page()
|
||||
for url in urls:
|
||||
page.goto(url, wait_until="networkidle")
|
||||
text = trafilatura.extract(page.content()) or ""
|
||||
if text.strip():
|
||||
docs.append(Document(page_content=text, metadata={"source": url}))
|
||||
return docs
|
||||
|
||||
documents = load_documents([
|
||||
"https://example.com/a",
|
||||
"https://example.com/b",
|
||||
])
|
||||
```
|
||||
|
||||
Note the single `with` block around the whole loop: one browser session renders every URL
|
||||
in turn rather than launching a fresh browser per page, which is both faster and gentler
|
||||
on the source. The `if text.strip()` guard is deliberate. An empty extraction is a fetch
|
||||
that did not work, and letting it into the index as a blank document is exactly the
|
||||
failure this whole exercise is meant to remove. Log the empty ones and inspect them; an
|
||||
empty result is a signal, not a pass. Frameworks that drive a browser as part of a larger
|
||||
loop are covered under [AI agents and frameworks](guides-ai-agents.md).
|
||||
|
||||
## What the browser does not fix: IP reputation and rate
|
||||
|
||||
This is the honest boundary of the tool, and skipping it is how ingestion pipelines get
|
||||
blocked a week after they start working.
|
||||
|
||||
The browser solves the render-and-fetch problem: it runs the JavaScript and it presents a
|
||||
real-browser fingerprint. It does not launder IP reputation. If you ingest through a
|
||||
datacenter address, or an address a thousand other clients are using this minute, a
|
||||
perfect browser fingerprint still arrives from an address the source distrusts, and the
|
||||
document comes back challenged. Reputation is a property of the network path, not of the
|
||||
browser, so the fix is a clean exit rather than a better fingerprint. The general shape of
|
||||
that problem is in [why scrapers get blocked despite proxies](web-scraping-getting-blocked-proxies.md).
|
||||
|
||||
The second thing it does not fix is rate. Ingesting a corpus is machine-speed by nature:
|
||||
a loop over a URL list issues requests far faster and far more regularly than a person
|
||||
reading pages, and that regularity is itself detectable independently of any fingerprint.
|
||||
Pace the loop, add jitter between fetches, and do not point the whole corpus at one host
|
||||
in one burst. An agent that fetches on a perfectly uniform interval carries
|
||||
[the timing signature of automation](ai-browser-agents-stealth.md) no matter how real
|
||||
each individual request looks. The browser makes each request credible; the spacing
|
||||
between requests is yours to get right.
|
||||
|
||||
## Conclusion
|
||||
|
||||
A RAG index built on a plain HTTP loader inherits that loader's blind spot: it cannot see
|
||||
JavaScript-rendered content, and it cannot get past a source that inspects the request
|
||||
before serving the body. Putting invisible_playwright in the fetch stage removes both,
|
||||
because it renders the page and makes the request read as a genuine Firefox. Then you
|
||||
extract clean text, chunk it, and embed it like any other document.
|
||||
|
||||
Keep the boundary honest. The browser earns you the real HTML from guarded, JavaScript
|
||||
heavy sources. A clean exit and a paced request loop are what keep that fetch working
|
||||
past the first day, and those parts are yours to supply.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Why does my RAG loader return empty pages?** Almost always because the content is
|
||||
written by JavaScript the loader never runs, or because the source gates the body behind a
|
||||
request check the loader fails. Render with a real browser and both go away.
|
||||
|
||||
**Does invisible_playwright get me past sites that challenge my scraper?** It helps with
|
||||
the fingerprint, TLS and driver layer, which read as a real Firefox, so requests are not
|
||||
challenged on those grounds. It does not fix a distrusted IP or a request rate that is
|
||||
obviously automated. It helps with the browser half and not the network half.
|
||||
|
||||
**Can I use it as a LangChain or LlamaIndex document loader?** Yes. Wrap the fetch in a
|
||||
function that returns the framework's `Document` objects. The browser call is standard
|
||||
Playwright, so nothing else in your pipeline changes.
|
||||
|
||||
**How do I make ingestion reproducible?** Pass a fixed `seed`. The same seed produces the
|
||||
same browser identity every run, so a fetch that failed can be replayed exactly instead of
|
||||
being a different random draw each time.
|
||||
|
||||
**Do I still need a proxy?** For most gated sources, yes, and a clean one. The browser
|
||||
does not change the address the request comes from, and IP reputation is decided on that
|
||||
address, not on the fingerprint.
|
||||
|
||||
**Should I ingest as fast as the loop allows?** No. Machine-speed, evenly spaced requests
|
||||
are a signal on their own. Pace the loop and add jitter, especially against a single host.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's quickstart and configuration pages, for the launch API, the seed
|
||||
behaviour and the proxy and timezone handling used above.
|
||||
- This project's release gates, which taught the rule repeated here that an empty or
|
||||
suppressed result is a failure rather than a pass, and must be asserted against rather
|
||||
than ignored.
|
||||
|
||||
**See also:** [extracting clean article text](how-to-extract-clean-article-text-playwright.md)
|
||||
for the stage after the fetch, [how to test whether the browser is detected](how-to-test-bot-detection.md)
|
||||
before you trust a source, and [AI agents and frameworks](guides-ai-agents.md) for the
|
||||
wider loop this fits into.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. It looks like a real
|
||||
browser because in the ways a detector inspects, it is one; the clean exit and the paced
|
||||
loop are still yours to bring.*
|
||||
@@ -0,0 +1,163 @@
|
||||
---
|
||||
title: "Why a FingerprintJS visitor ID changes"
|
||||
description: "A FingerprintJS visitor ID is a hash of 41 components. Everything about why it changes, or why it stays the same, follows from that one fact."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 4
|
||||
---
|
||||
|
||||
|
||||
# Why a FingerprintJS visitor ID changes
|
||||
|
||||
A FingerprintJS visitor ID changes because it is a single hash of roughly forty-one
|
||||
browser and device components. If any one of those components reads differently, the
|
||||
whole value changes. It is not tracking you more or less; it is being fed different
|
||||
input.
|
||||
|
||||
People run FingerprintJS, get a `visitorId`, run it again a week later and get a
|
||||
different one. Or they run it in two tabs and get the same one and assume it is
|
||||
tracking something durable. Both reactions come from not knowing how the value is
|
||||
made: it is a hash, and everything else follows from that one fact.
|
||||
|
||||
Read from the open-source library source on 2026-07-27
|
||||
([`fingerprintjs/fingerprintjs`](https://github.com/fingerprintjs/fingerprintjs),
|
||||
`src/sources/` and `src/agent.ts`).
|
||||
|
||||
## How the ID is produced
|
||||
|
||||
The visitor ID is one hash of a canonical string built from every collected
|
||||
component. Nothing is stored per-component and there is no partial match: the whole
|
||||
set goes in, one value comes out.
|
||||
|
||||
```ts
|
||||
export function hashComponents(components: UnknownComponents): string {
|
||||
return x64hash128(componentsToCanonicalString(components))
|
||||
}
|
||||
```
|
||||
|
||||
Roughly forty-one component sources are collected, serialised in a canonical order,
|
||||
and hashed. The identifier is that hash.
|
||||
|
||||
So there is no notion of a partial match. **Change one component and the entire ID
|
||||
changes**, exactly as if everything had changed. There is a separate `confidence`
|
||||
score, but the ID itself is all or nothing.
|
||||
|
||||
## The components, and which of them move
|
||||
|
||||
The components that feed the hash fall into four groups by how often a real person's
|
||||
setup changes them: hardware, operating-system settings, installed software, and
|
||||
travel. The full set, from the source directory:
|
||||
|
||||
```
|
||||
canvas webgl audio audio_base_latency
|
||||
fonts font_preferences screen_resolution screen_frame
|
||||
color_depth color_gamut hdr contrast
|
||||
inverted_colors forced_colors reduced_motion reduced_transparency
|
||||
monochrome timezone date_time_locale languages
|
||||
platform os_cpu architecture cpu_class
|
||||
hardware_concurrency device_memory touch_support vendor
|
||||
vendor_flavors user_agent_data apple_pay pdf_viewer_enabled
|
||||
plugins dom_blockers indexed_db local_storage
|
||||
session_storage open_database cookies_enabled math
|
||||
private_click_measurement
|
||||
```
|
||||
|
||||
Group them by how likely they are to move under a real person, and the instability
|
||||
explains itself:
|
||||
|
||||
**Moves whenever the hardware setup changes.** `screen_resolution` and
|
||||
`screen_frame` change when a laptop is docked, an external monitor is plugged in, or
|
||||
the taskbar moves. [`device_memory`, `hardware_concurrency`](hardware-concurrency-device-memory.md)
|
||||
and `architecture` change with the machine.
|
||||
|
||||
**Moves with the operating system's own settings.**
|
||||
[`forced_colors`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/forced-colors),
|
||||
`inverted_colors`, [`reduced_motion`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion),
|
||||
`reduced_transparency`, `contrast`, `monochrome`, `color_gamut` and `hdr` all read
|
||||
accessibility and display preferences exposed as standard CSS media features.
|
||||
Someone turning on dark mode or reducing motion changes their ID.
|
||||
|
||||
**Moves with ordinary software changes.** `fonts` and `font_preferences` change when
|
||||
any application installs a font. `plugins`, `vendor_flavors` and `user_agent_data`
|
||||
change when the browser updates. `dom_blockers` changes when someone installs or
|
||||
configures an ad blocker.
|
||||
|
||||
**Moves with travel.** `timezone`, `date_time_locale`, `languages`.
|
||||
|
||||
That is why a real user's ID is not stable across weeks. It is not a flaw in the
|
||||
library, it is what hashing forty-one volatile things produces.
|
||||
|
||||
## What this means if you are automating
|
||||
|
||||
Two things, and they point in opposite directions from what people assume.
|
||||
|
||||
**An ID that changes between runs of your own tool is a signal, not safety.** If your
|
||||
setup produces a different visitor ID on every launch of the same configuration, some
|
||||
component is being randomised per call, not per identity. Real machines do not
|
||||
do that. A tool adding canvas noise on every read, instead of deriving stable noise
|
||||
from a fixed seed, produces exactly this and is detectable by the instability itself.
|
||||
|
||||
**An ID that is stable per identity and different per identity is the target.** Not a
|
||||
stable ID across all your sessions, which is one machine doing everything, and not a
|
||||
new ID every request, which is a machine that transforms between page loads. One
|
||||
consistent machine per identity, for as long as that identity lives.
|
||||
|
||||
Deriving the fingerprint from a seed is how you get that. The same seed
|
||||
gives the same forty-one components, so the same hash, run after run; a different
|
||||
seed gives a different hash that is equally ordinary. You can verify it in a minute:
|
||||
run FingerprintJS twice with one seed and confirm the ID matches, then change the
|
||||
seed and confirm it does not.
|
||||
|
||||
## The Pro version is a different thing
|
||||
|
||||
The open-source library computes the hash in the browser. Fingerprint Pro adds
|
||||
server-side signals and identification that this article does not cover, and it
|
||||
deliberately survives some of the changes listed above instead of breaking on them.
|
||||
|
||||
So "I pass the open-source one" and "I pass the commercial one" are separate claims,
|
||||
and the second does not follow from the first. Anyone telling you a tool defeats
|
||||
browser fingerprinting, without saying which of the two they measured, has not told
|
||||
you anything.
|
||||
|
||||
## Checking your own
|
||||
|
||||
Run it twice in the same configuration and compare. Then run it in a fresh profile
|
||||
with the same configuration and compare again. Then change one thing you would expect
|
||||
to matter, the seed if you have one, and confirm the ID moves.
|
||||
|
||||
If it moves when it should not, read the components, not the ID: the library
|
||||
exposes them, and the one that differs between two runs is your problem.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Why does my FingerprintJS visitor ID keep changing?** Because it is a hash of many
|
||||
components, so any one of them moving changes the whole value. It is not tracking you
|
||||
less, it is being fed different input.
|
||||
|
||||
**Is a changing ID good for privacy?** Less than it sounds. An ID that changes every
|
||||
single request describes a machine that transforms between page loads, which no real
|
||||
machine does, and that pattern is itself detectable.
|
||||
|
||||
**What makes the ID stable?** The same components answering the same way every time.
|
||||
Deriving them from a fixed seed does that by construction.
|
||||
|
||||
**Does the open-source version equal the commercial one?** No. The commercial one adds
|
||||
signals the library does not have and deliberately survives some of the changes that
|
||||
break the open-source ID.
|
||||
|
||||
**Does canvas noise help?** Only if it is stable per identity. Noise added per call
|
||||
makes two reads in one session disagree, which is the cheapest tampering check there
|
||||
is.
|
||||
|
||||
**See also:** [which fingerprint fields can be pinned](pinning.md), if you want
|
||||
specific components held still while the rest stays seed-derived,
|
||||
[what BotD detects](botd-explained.md), from the same team but aimed at
|
||||
a different question, and [why headless renders different fonts](headless-fonts-differ.md),
|
||||
since `fonts` and `font_preferences` are two of the forty-one.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright).
|
||||
Both the open-source library and the commercial one are release gates for this
|
||||
project, and the difference between them cost us enough time to be worth spelling
|
||||
out.*
|
||||
@@ -0,0 +1,186 @@
|
||||
---
|
||||
title: "Firefox preferences that silently do nothing"
|
||||
description: "A Firefox preference you set can be silently ignored, with no error or log entry. The reasons it happens, in order, and how to confirm which one you hit."
|
||||
parent: "Testing and Troubleshooting"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 3
|
||||
---
|
||||
|
||||
|
||||
# Firefox preferences that silently do nothing
|
||||
|
||||
You set a preference, the browser starts, and the value is not there. No error, no
|
||||
warning, nothing in the log. This page is the list of reasons, in the order they
|
||||
actually happen.
|
||||
|
||||
It matters here because this project delivers its entire fingerprint through
|
||||
preferences. Every failure mode below is one we have hit.
|
||||
|
||||
## The six reasons a Firefox preference silently does nothing
|
||||
|
||||
A Firefox preference set with no visible effect almost always falls into one of six
|
||||
cases: the name is not one that build reads, the value is compiled in at build time,
|
||||
it was written to the wrong file, an enterprise policy locked it, another layer
|
||||
overrides it, or it was set in the parent process and never crossed into the content
|
||||
process. The single confirmation step for all of them is the same: read the value back
|
||||
from the page, not from the profile.
|
||||
|
||||
| # | Reason | What you see | How to confirm |
|
||||
|---|---|---|---|
|
||||
| 1 | Name not read by this build | Value stored in `about:config`, page unchanged | Read it back from the page |
|
||||
| 2 | Compiled in at build time | Same name behaves differently across builds | Compare a patched build with a stock one |
|
||||
| 3 | Wrong file (`prefs.js` vs `user.js`) | Value reverts after a restart | Put it in `user.js` |
|
||||
| 4 | Enterprise policy lock | Value cannot be changed at all | Look for a `policies.json` |
|
||||
| 5 | Another layer is louder | Pref applied, behaviour still differs | Check for injected scripts or extensions |
|
||||
| 6 | Parent set, content process empty | Empty string in the page, no error | Read it in the realm that needs it |
|
||||
|
||||
## 1. The preference does not exist in that build
|
||||
|
||||
A preference name the build never reads is the most common cause of this, and it is
|
||||
silent by design.
|
||||
|
||||
Firefox has no schema for preferences. `about:config` will happily let you create
|
||||
`my.invented.pref` and store a value, and so will an automation tool. Nothing reads
|
||||
it, nothing complains, and it shows up in the profile looking exactly like a
|
||||
preference that works.
|
||||
|
||||
So a typo, a renamed pref after an upstream version bump, or a pref that only exists
|
||||
in a patched build you are not running, all produce the same result: the value is
|
||||
stored and ignored.
|
||||
|
||||
**We shipped this.** Seven tests in this repository pinned preference names the
|
||||
engine never reads. They asserted the names were written, the names were written, and
|
||||
the engine ignored all seven. The tests were green for as long as they existed. A
|
||||
test that checks a preference was *set* is not testing anything; the check has to be
|
||||
that the browser's observable behaviour changed.
|
||||
|
||||
The way to catch it is to read the value back from the page instead of from the
|
||||
profile, with a real page-visible API such as
|
||||
[`navigator.hardwareConcurrency`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/hardwareConcurrency)
|
||||
or
|
||||
[`Intl.DateTimeFormat().resolvedOptions()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/resolvedOptions):
|
||||
|
||||
```js
|
||||
// what the page sees is the only thing that counts
|
||||
navigator.hardwareConcurrency
|
||||
Intl.DateTimeFormat().resolvedOptions().timeZone
|
||||
```
|
||||
|
||||
## 2. It is a build-time preference, not a runtime one
|
||||
|
||||
Some values are compiled in. Firefox's `StaticPrefs` mechanism generates C++ from a
|
||||
list at build time, and a subset of those are read once at startup or baked into the
|
||||
binary. Setting them later, or setting them in a profile, does nothing.
|
||||
|
||||
This is why a patched build and a stock build can respond differently to the same
|
||||
preference: the patch may have made a value readable that upstream compiles as a
|
||||
constant, or the reverse.
|
||||
|
||||
## 3. `user.js` versus `prefs.js`, and who writes last
|
||||
|
||||
Two files in a profile directory hold preferences, and they behave differently:
|
||||
|
||||
- **`prefs.js`** is Firefox's own. It is rewritten when the browser exits. Editing it
|
||||
while the browser is running is pointless, because your edit is overwritten on
|
||||
close.
|
||||
- **`user.js`** is yours. It is read at every startup and applied over whatever
|
||||
`prefs.js` says.
|
||||
|
||||
So if a value keeps reverting, you almost certainly wrote it to `prefs.js` on a
|
||||
running profile. Put it in `user.js` instead and it wins on every launch.
|
||||
|
||||
Automation tools that accept a preference dictionary generally build one of these
|
||||
for you, which is why the two-file distinction only bites when you are hand-editing a
|
||||
[persistent profile](persistent-profiles.md).
|
||||
|
||||
## 4. Enterprise policy overrides everything
|
||||
|
||||
A `policies.json` next to the binary, or an OS-level policy on a managed machine,
|
||||
takes precedence over both files and can lock a preference so nothing can change it.
|
||||
This is rare on a developer machine and common on a corporate one, and it produces a
|
||||
value that looks set in `about:config` while the browser silently ignores it.
|
||||
|
||||
## 5. The preference works and something else is louder
|
||||
|
||||
The value is applied, and the observable behaviour still does not change, because a
|
||||
different layer answers first. A JavaScript shim injected into the page that
|
||||
redefines the same property will win, because it runs after the browser has already
|
||||
reported the value. Two mechanisms setting the same thing is
|
||||
[the recurring theme of these pages](playwright-stealth-levels.md).
|
||||
|
||||
## 6. It works in the parent process and is empty in the content process
|
||||
|
||||
This failure mode costs the most time to find, because it produces no error anywhere.
|
||||
|
||||
Firefox runs as a tree of processes - one parent, one content process per
|
||||
site-isolated origin, plus a handful of others - and a preference set in the parent
|
||||
is not automatically visible everywhere. Numeric and boolean preferences generated
|
||||
through Firefox's static preference mechanism get baked into a shared snapshot handed
|
||||
to every content process at launch, so those propagate for free. **String
|
||||
preferences do not go through that snapshot.** A content process asking for one that
|
||||
was never explicitly allowed through gets back an empty string - not an error, not a
|
||||
fallback to a default, just silence, so this is easy to spend a long time on before
|
||||
noticing the value never crosses the process boundary at all.
|
||||
|
||||
This matters most for exactly the values people reach for at runtime: a
|
||||
[GPU vendor and renderer string](renderer-string-vs-render.md), a spoofed identifier,
|
||||
anything that is text rather than a number or a flag.
|
||||
If the string travels through the same static-preference mechanism as a number (with
|
||||
a declared default), it gets the same free propagation. If it's read as a plain
|
||||
dynamic string preference instead, it needs to be explicitly allowed through, or every
|
||||
content process silently sees nothing.
|
||||
|
||||
## A debugging order that works
|
||||
|
||||
1. **Read it back from the page, not from the profile.** If `about:config` shows your
|
||||
value but the page does not see it, the preference is not the one the engine
|
||||
reads. That is reason one.
|
||||
2. **Check the value exists in a stock browser.** Open `about:config` in a normal
|
||||
Firefox of the same version and search for the name. If it is not there as an
|
||||
existing entry, you are inventing it.
|
||||
3. **Check nothing else sets the same surface.** A stealth plugin, a framework's
|
||||
fingerprint generator, an extension.
|
||||
4. **Check the profile is the one you think.** Automation tools frequently create a
|
||||
temporary profile and discard it, so the persistent one you edited is not the one
|
||||
that launched.
|
||||
|
||||
## Why we do it this way anyway
|
||||
|
||||
Preferences are the contract between the patched engine and the Python side of this
|
||||
project. Nothing about the fingerprint is hardcoded in either: the profile generates
|
||||
values, the preferences carry them, and the engine reads them.
|
||||
|
||||
That has a real cost, which is this whole page. It also has the property that made it
|
||||
worth paying: the same binary can be any machine, and changing what it claims does
|
||||
not mean rebuilding it. A tool that hardcodes its fingerprint has none of these
|
||||
failure modes and cannot vary at all.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Why is my Firefox preference ignored?** Usually because it is read once at startup,
|
||||
because something writes it after you do, because it is the wrong file, because the
|
||||
preference no longer exists, or because it exists but nothing reads it.
|
||||
|
||||
**How do I check whether a preference actually applied?** Read the value back from the
|
||||
page, not from the profile. The profile records your intent; the page shows the result.
|
||||
|
||||
**What is the difference between `user.js` and `prefs.js`?** `user.js` is applied at
|
||||
every start and overrides. `prefs.js` is written by the browser and can be rewritten
|
||||
under you.
|
||||
|
||||
**Does `about:config` show the truth?** It shows the current value in the parent
|
||||
process, which is not always what a content process or a given realm is using.
|
||||
|
||||
**Why would a documented preference do nothing?** Because it was removed upstream and
|
||||
left in place, or it was never wired to anything. A preference existing is not evidence
|
||||
that anything reads it.
|
||||
|
||||
**See also:** [what `privacy.resistFingerprinting` changes](resist-fingerprinting.md),
|
||||
which is a preference whose effects are large and mostly unwanted here, and
|
||||
[the three levels](playwright-stealth-levels.md) for why a preference and a page
|
||||
script fight.
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright).
|
||||
Reason one is the one that cost us a real bug, so it is first rather than last.*
|
||||
@@ -0,0 +1,238 @@
|
||||
---
|
||||
title: "Firefox or Chromium for anti-detect automation"
|
||||
description: "Firefox vs Chromium for anti-detect: no CDP surface, one identity not three, detection tuned for Chromium - traded against Firefox's smaller, rarer traffic share."
|
||||
parent: "Comparisons"
|
||||
nav_order: 2
|
||||
---
|
||||
|
||||
|
||||
# Firefox or Chromium for anti-detect automation
|
||||
|
||||
Firefox is the stronger engine for anti-detect automation when the target's detection is
|
||||
Chromium-tuned, which most of it is: it exposes no CDP automation protocol, keeps one copy
|
||||
of its identity instead of three, and ships one binary instead of a separate headless one.
|
||||
The cost is real and specific - Firefox is a small single-digit share of real traffic, so
|
||||
its fingerprint is rarer than a Chrome one. Pick whichever your stack supports, then fix
|
||||
the machine, because in most cases the engine is not the binding constraint.
|
||||
|
||||
The usual framing is that Firefox gives stronger engine-level stealth at a higher
|
||||
resource cost, and Chromium gives better compatibility. Both halves are true and neither
|
||||
is the interesting part.
|
||||
|
||||
The interesting part is that the two engines differ **structurally** in how much automation
|
||||
surface they have, in how many copies of their identity they maintain, and in how much
|
||||
attention detection has paid them. And that one of those differences cuts hard against
|
||||
Firefox in a way most comparisons skip.
|
||||
|
||||
This page is the four structural arguments for Firefox, the one serious argument against
|
||||
it, what the choice does not fix, and how to decide.
|
||||
|
||||
## Firefox vs Chromium at a glance
|
||||
|
||||
The differences that matter are structural, not cosmetic. This table summarises them; each
|
||||
row is unpacked in its own section below.
|
||||
|
||||
| Dimension | Firefox (patched) | Chromium |
|
||||
|---|---|---|
|
||||
| Automation protocol | No CDP; driven by a patch whose artefacts are smaller and less studied, not absent | CDP shipped in the browser, a well-studied detection surface |
|
||||
| Copies of identity to keep in sync | One (no Client Hints) | Three: user agent string, `Sec-CH-UA` headers, `navigator.userAgentData` |
|
||||
| Capability parity with what people run | Firefox is Firefox; no stripped variant runs in automation only | Default managed build fails a DRM capability check that real Chrome, Edge, Brave and Opera pass |
|
||||
| Headed vs headless | One binary with a flag | Different binaries by default in recent Playwright |
|
||||
| Detection attention | Comparatively little; most research targets Chromium | The overwhelming majority of accumulated detection work |
|
||||
| Share of real traffic | Small single-digit share, so the fingerprint is rarer (a real cost) | Large majority of real browsers |
|
||||
| AI agent framework fit | Usually not; most frameworks drive Chromium over CDP | Native fit for CDP-based frameworks |
|
||||
|
||||
## Firefox has no CDP surface
|
||||
|
||||
Firefox has no CDP. Playwright drives it through a patch of its own, which means there is
|
||||
no shipped protocol to detect.
|
||||
|
||||
Chromium's automation protocol is the Chrome DevTools Protocol, and it is a first-class,
|
||||
shipped part of the browser. That is convenient and it is also a surface: enabling the
|
||||
runtime domain has observable effects, the listener exists, and a body of detection work
|
||||
targets exactly those artefacts. Chromium stealth builds spend a lot of their effort
|
||||
stripping them.
|
||||
|
||||
**And here is the honest half**, which the comparisons that say "Firefox has no CDP"
|
||||
always omit: that patch has its own artefacts, and they are not trivial. Attaching a
|
||||
JavaScript debugger disables the optimising JIT, which is measurable through timing
|
||||
alone. Its own frames appeared in `Error.stack`. Evaluated code was labelled as debugger
|
||||
evaluation. And a serialisation helper ran in the page's realm before the page's first
|
||||
script, touching built-in prototypes in a world that should have been untouched.
|
||||
|
||||
[All four are written up here](debugger-timing-detection.md), because we had to find and
|
||||
fix them.
|
||||
|
||||
So the correct statement is not "Firefox has no automation surface". It is that the
|
||||
surface is **different, smaller, and much less studied**, because far fewer people are
|
||||
looking.
|
||||
|
||||
## The automation Chromium is not the Chromium people run
|
||||
|
||||
Playwright's default managed Chromium closed its codec gap in 2026 - as of Playwright 1.57
|
||||
it ships Chrome for Testing, which carries H.264 and AAC. Widevine, the DRM real streaming
|
||||
services require, did not come along with it: checked directly, the current default still
|
||||
rejects a Widevine session request. Real people run Chrome, Edge, Brave or Opera, all of
|
||||
which have it - this is the strongest version of the argument, and the one most comparisons
|
||||
skip entirely.
|
||||
|
||||
So the capability set that automation reports belongs to almost nobody on that one
|
||||
remaining axis, and it is testable in one line. Worse, it is a **capability rather than a
|
||||
value**: a missing DRM module is missing machine code, so no property override produces it,
|
||||
and a user agent claiming Chrome on a build that can't negotiate Widevine is a provable
|
||||
contradiction rather than an unusual reading.
|
||||
|
||||
Firefox has no equivalent split. There is no stripped Firefox that automation runs and
|
||||
people do not, so a patched Firefox is Firefox in the ways a capability check can test.
|
||||
|
||||
[The full version is here](chromium-is-not-chrome.md), including the branded-channel
|
||||
escape and what it costs.
|
||||
|
||||
## Firefox has one identity, Chromium has three
|
||||
|
||||
Modern Chromium reports who it is in three places: the user agent string, the
|
||||
[`Sec-CH-UA`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Client_hints)
|
||||
request headers, and `navigator.userAgentData`. In a real browser all three
|
||||
come from one internal state and agree by construction.
|
||||
|
||||
For anything modifying that identity, they are three copies to keep in sync, and the
|
||||
headers are sent **before any script runs**, so a page-level patch cannot reach them at
|
||||
all. Comparing them is a few lines on a server.
|
||||
|
||||
Firefox does not implement Client Hints. There is no second pipeline and no third copy.
|
||||
The absence is correct, expected, and shared with every other Firefox on the internet.
|
||||
|
||||
That is a genuine structural advantage, and it comes with a matching constraint:
|
||||
[you cannot then claim to be Chrome](client-hints-sec-fetch.md), because a request
|
||||
claiming Chrome and carrying no Client Hints contradicts itself.
|
||||
|
||||
## Headless is one binary, not a different one
|
||||
|
||||
Firefox is one binary with a flag. The flag still changes behaviour, and
|
||||
[this project avoids it entirely by running headed and hiding the window](headless-vs-headful.md),
|
||||
but the starting position is one codebase rather than two.
|
||||
|
||||
[Recent Playwright versions default Chromium's headed and headless modes to different
|
||||
binaries](https://playwright.dev/docs/browsers): a regular Chromium build for headed
|
||||
operations and a separate headless shell for headless mode. A separate implementation
|
||||
composites and paints differently, which is a real difference in what gets rendered and
|
||||
when.
|
||||
|
||||
## Detection is tuned for Chromium
|
||||
|
||||
The overwhelming majority of browser automation is Chromium, so the detectors, the
|
||||
research, the blog posts and the heuristics are Chromium-first: `window.chrome` shape,
|
||||
CDP artefacts, the Chromium headless user agent, ChromeDriver's own leftovers - this one
|
||||
is about attention rather than architecture.
|
||||
[The `cdc_` variable](cdc-variable-explained.md) is a Chromium-family problem that
|
||||
Firefox users never think about.
|
||||
|
||||
Running Firefox sidesteps a large amount of accumulated, specific work. Not because
|
||||
Firefox is harder to detect in principle, but because fewer people have written the
|
||||
detection.
|
||||
|
||||
That advantage is real and it is also **borrowed**. It shrinks as Firefox-based tooling
|
||||
becomes more common, and nothing about it is permanent.
|
||||
|
||||
## The argument against Firefox, which is serious
|
||||
|
||||
Chrome and Chromium derivatives are the large majority of real browser traffic. Firefox
|
||||
is a small single-digit share.
|
||||
|
||||
So a Firefox fingerprint is intrinsically **rarer than a Chrome one**, and rarity is the
|
||||
thing this entire documentation set warns about on every other page. A perfectly
|
||||
consistent Firefox is still a member of a much smaller crowd.
|
||||
|
||||
Being straight about what that does and does not mean:
|
||||
|
||||
- **It does not make you look automated.** Millions of people use Firefox, and being one
|
||||
of them is unremarkable.
|
||||
- **It does narrow the population** a scoring system places you in, before anything else
|
||||
is considered.
|
||||
- **It matters more where a site's traffic is unusually Chrome-heavy**, and less where the
|
||||
audience is broad.
|
||||
|
||||
Anyone selling you a Firefox-based tool without mentioning this is not being straight with
|
||||
you. It is the strongest argument on the other side and it does not go away.
|
||||
|
||||
### The compatibility cost, which is concrete
|
||||
|
||||
Most AI agent frameworks drive Chromium over CDP. We checked five of them by reading
|
||||
their source: browser-use, Stagehand and Skyvern are CDP, so a Firefox engine does not
|
||||
drop into any of them. [The verified table is here](ai-browser-agents-stealth.md).
|
||||
|
||||
If your surrounding stack is one of those, the engine choice has already been made for
|
||||
you.
|
||||
|
||||
## What the choice does not fix
|
||||
|
||||
Neither engine changes the machine, which is worth stating plainly because the engine
|
||||
debate absorbs attention that belongs elsewhere. On a server, both report a software
|
||||
renderer, a container font set, no audio device, no speech voices and a default screen, and
|
||||
[each of those is a stronger signal than the engine](playwright-docker-detection.md).
|
||||
|
||||
Neither changes the TLS handshake beyond making it genuinely that browser's, and
|
||||
[neither can be patched from JavaScript](ja3-ja4-tls-fingerprint.md).
|
||||
|
||||
Neither changes behaviour. A pointer that teleports is a pointer that teleports on both.
|
||||
|
||||
If you are choosing an engine before fixing those, you are optimising the smaller term.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Firefox's advantages are structural: no CDP surface, one identity instead of three, one
|
||||
binary instead of two, and a detection ecosystem that has spent its effort elsewhere.
|
||||
Chromium's advantage is that it is what almost everybody runs, which is not a small thing
|
||||
when the question being asked is "does this look like a normal visitor".
|
||||
|
||||
The honest recommendation is conditional. If your target's heuristics are Chromium-tuned,
|
||||
which most are, Firefox skips a lot of them. If your target weights how common your
|
||||
browser is, Firefox costs you. If your framework speaks CDP, the question is already
|
||||
answered.
|
||||
|
||||
And in most real cases the engine is not the binding constraint. The machine is.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Is Firefox better than Chromium for anti-detect?** Structurally it has less automation
|
||||
surface and one identity to maintain instead of three. It is also a much smaller share of
|
||||
real traffic, which cuts the other way.
|
||||
|
||||
**Does Firefox avoid CDP detection?** It has no CDP. Its automation layer has its own
|
||||
artefacts, which are smaller and less studied rather than absent.
|
||||
|
||||
**Why do Client Hints favour Firefox?** Because Firefox does not implement them, so there
|
||||
is no second copy of the identity to keep consistent. The constraint is that you cannot
|
||||
claim to be Chrome.
|
||||
|
||||
**Is a Firefox fingerprint suspicious?** No. It is less common, which narrows the
|
||||
population you are placed in. Millions of real people use Firefox.
|
||||
|
||||
**Can I use a Firefox engine with an AI agent framework?** Usually not. Most drive
|
||||
Chromium over CDP.
|
||||
|
||||
**Which should I pick?** Whichever your stack supports, then fix the machine. That is the
|
||||
larger term in almost every case.
|
||||
|
||||
**See also:** [three ways to make Playwright undetected](playwright-stealth-levels.md),
|
||||
[AI browser agents and stealth](ai-browser-agents-stealth.md) for the framework
|
||||
constraint, and [Playwright in Docker](playwright-docker-detection.md) for the part that
|
||||
is the same either way.
|
||||
|
||||
## Sources
|
||||
|
||||
- The Chrome DevTools Protocol as a shipped Chromium interface, and this project's own
|
||||
automation-layer artefacts, documented on
|
||||
[the debugger page](debugger-timing-detection.md).
|
||||
- [User Agent Client Hints](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Client_hints)
|
||||
as implemented in Chromium and absent in Firefox.
|
||||
- Recent Playwright [defaulting headed and headless Chromium to different
|
||||
binaries](https://playwright.dev/docs/browsers).
|
||||
- Five agent frameworks read from source, tabulated on
|
||||
[the agents page](ai-browser-agents-stealth.md).
|
||||
|
||||
---
|
||||
|
||||
*From the notes of [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level. We chose Firefox and the section arguing against it is
|
||||
the one worth reading twice.*
|
||||
@@ -0,0 +1,240 @@
|
||||
---
|
||||
title: "Can the Gamepad API fingerprint or detect a bot?"
|
||||
description: "How the Gamepad API works as a bot signal, why Firefox returns an empty getGamepads() array until a real gesture, and why matching that shape beats a stub."
|
||||
parent: "Browser Identity"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 31
|
||||
---
|
||||
|
||||
|
||||
# Can the Gamepad API fingerprint or detect a bot?
|
||||
|
||||
Short version: it helps a detector cross-check your user agent, and it cannot detect
|
||||
you on its own. The [Gamepad API](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad_API) is a rarely-audited input surface, which is exactly
|
||||
why it is worth getting right. Most stealth work pours effort into canvas, WebGL and
|
||||
`navigator.webdriver`, and leaves the small input APIs answering in whatever way a
|
||||
patch happened to leave them. A detector that has run out of the obvious checks reaches
|
||||
for the unobvious ones, and an input API that reports the wrong shape for the browser
|
||||
it claims to be is a cheap, quiet tell.
|
||||
|
||||
This page is what [`navigator.getGamepads()`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/getGamepads) actually returns, why an empty array is the
|
||||
correct answer rather than a suspicious one, how the shape functions as a user-agent
|
||||
consistency check, how to read it through invisible_playwright, and the honest limit of
|
||||
what any of this fixes.
|
||||
|
||||
## What the Gamepad API actually exposes
|
||||
|
||||
The surface is small. `navigator.getGamepads()` is a function that returns a snapshot of
|
||||
the game controllers the browser currently knows about, plus [`gamepadconnected` and
|
||||
`gamepaddisconnected`](https://www.w3.org/TR/gamepad/) events that fire when one appears or leaves. That is nearly all of
|
||||
it from a fingerprinting point of view: a function that is either present or not, and an
|
||||
array whose contents and length are the interesting part.
|
||||
|
||||
Three properties of that surface matter for detection:
|
||||
|
||||
- **It requires a secure context.** On an insecure origin the API is not exposed the way
|
||||
it is on `https://`, so a page served over plain HTTP sees a different shape than one
|
||||
served over TLS. A test page on `https://example.com` sees the full surface.
|
||||
- **It stays empty until real input arrives.** A browser does not report a connected
|
||||
controller just because one is plugged in. Firefox surfaces a gamepad only after it
|
||||
reports input following a genuine user gesture, which is a deliberate privacy gate: a
|
||||
page cannot silently enumerate your controllers on load.
|
||||
- **Its shape differs by engine.** Before any controller is active, Firefox returns an
|
||||
empty array. Other engines pre-fill a fixed-length array with null entries. That
|
||||
difference is small, stable, and trivial to read from JavaScript.
|
||||
|
||||
So the API contributes almost nothing to a per-visitor fingerprint on its own. What it
|
||||
contributes is a consistency signal, and consistency is where automated browsers get
|
||||
caught. It sits in the same family as the other small, OS-backed surfaces covered in
|
||||
[what data a website collects about your browser](what-data-websites-collect-about-your-browser.md).
|
||||
|
||||
## Why an empty array is the correct answer
|
||||
|
||||
An empty array is the correct answer: it is what a real, unmodified Firefox returns
|
||||
whenever no controller is reporting input. The instinct when hardening a browser is
|
||||
instead to make every surface look busy and populated; for the Gamepad API that instinct
|
||||
is wrong, and acting on it is more detectable than doing nothing.
|
||||
|
||||
A real person driving a real Firefox, with no controller in use, produces an empty
|
||||
result from `getGamepads()`. That is the overwhelmingly common case: most desktop
|
||||
sessions have no gamepad reporting input. An empty array is not a suppressed signal or a
|
||||
blocked probe; it is the honest, ordinary answer that the reference browser gives. The
|
||||
[how-to-test-bot-detection method](how-to-test-bot-detection.md) warns that a blank
|
||||
section is usually a failure rather than a pass, and this is the exception that proves
|
||||
the rule: here the blank is what the stock browser returns, and a comparison against a
|
||||
stock browser on the same machine confirms it.
|
||||
|
||||
The failure modes are the opposite of emptiness:
|
||||
|
||||
- **A stub that reports a connected controller.** A page that reads an active gamepad in
|
||||
a headless session with no gesture history has caught a browser inventing input that
|
||||
never happened. Real input is gated behind a user gesture; a fabricated pad is a claim
|
||||
the browser cannot back up.
|
||||
- **A stub that returns the wrong-engine shape.** A fixed-length, null-filled array under
|
||||
a Firefox user agent is a direct contradiction: the string says Firefox, the array
|
||||
says a different engine.
|
||||
- **An over-eager patch that changes the function's signature or throws.** Anything that
|
||||
makes `getGamepads` look overridden, non-native, or inconsistent with a fresh copy of
|
||||
the built-in is exactly what tampering detectors like [CreepJS](creepjs-explained.md)
|
||||
look for.
|
||||
|
||||
The real invisible_playwright build does none of these. It behaves as stock Firefox
|
||||
does on this surface: secure-context gated, empty until a genuine gesture, engine-correct
|
||||
in shape. Nothing extra is spoofed here, because the correct value is the one the
|
||||
unmodified browser already produces. This is the same principle as
|
||||
[maxTouchPoints reading 0 on a spoofed desktop](navigator-maxtouchpoints-pointer.md): the
|
||||
honest, boring value is the one that matches, and inventing a livelier one only creates a
|
||||
contradiction to be found.
|
||||
|
||||
## The shape is a user-agent cross-check
|
||||
|
||||
The reason this obscure API earns a place in a detector's toolbox is that it turns the
|
||||
user-agent string into a testable claim.
|
||||
|
||||
A user agent is free text. Anything can send any string. What a detector wants is a
|
||||
behaviour that is expensive to fake and that should agree with that string. The Gamepad
|
||||
API is one such behaviour: given a user agent that names Firefox, the empty-array shape,
|
||||
the secure-context gating, and the gesture requirement should all match what a real
|
||||
Firefox of that version does. When they do not, the mismatch is decisive in the same way
|
||||
a [TLS handshake that disagrees with the user agent](tls-fingerprint-user-agent-mismatch.md)
|
||||
is decisive, and for the same reason: the string is cheap, the behaviour is not.
|
||||
|
||||
This is why "just set the user agent" does not survive contact with a careful detector.
|
||||
Every value you assert by hand has to agree with every value you did not, and the small
|
||||
input APIs are among the values people forget they did not set. The
|
||||
[checklist for being detected on one site](playwright-detected-as-bot.md) starts with
|
||||
exactly this class of mistake, because it is the most common and the most avoidable.
|
||||
|
||||
The practical consequence: a browser that matches stock Firefox on the Gamepad API is
|
||||
not passing because the API was cleverly spoofed. It is passing because the engine
|
||||
underneath is a real Firefox that answers the question the same way a real Firefox always
|
||||
would. There is no stub to catch out, because there is no stub.
|
||||
|
||||
## Reading getGamepads() through invisible_playwright
|
||||
|
||||
The launch is the two-line change from stock Playwright; everything after it is the
|
||||
Playwright API you already know. Here is the whole operation this page is about, reading
|
||||
the surface from a secure context and confirming its shape.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# seed=42 makes the whole identity reproducible, so this read is repeatable
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com") # a secure context, so the API is exposed
|
||||
|
||||
report = page.evaluate("""() => {
|
||||
const pads = navigator.getGamepads();
|
||||
return {
|
||||
present: typeof navigator.getGamepads === 'function',
|
||||
native: /\\[native code\\]/.test(navigator.getGamepads.toString()),
|
||||
length: pads.length,
|
||||
connected: Array.from(pads).filter(Boolean).length,
|
||||
secure: window.isSecureContext,
|
||||
};
|
||||
}""")
|
||||
|
||||
print(report)
|
||||
# {'present': True, 'native': True, 'length': 0,
|
||||
# 'connected': 0, 'secure': True}
|
||||
```
|
||||
|
||||
The `browser` object is a real `playwright.sync_api.Browser`, so `new_page`, `goto` and
|
||||
`evaluate` are the stock methods documented upstream. Nothing here is a wrapped subset.
|
||||
|
||||
The measurement worth making is the comparison, not the single read. Open the same
|
||||
snippet against a stock Firefox on the same machine and diff the two `report` objects
|
||||
field by field. On the honest build they match: `present` true, `native` true, `length`
|
||||
0, `connected` 0, `secure` true. A page-level spoofing layer bolted on top would move at
|
||||
least one of those (`native` flips to false when the function is a JavaScript override,
|
||||
or `connected` reports a phantom pad), and that single differing field is the entire
|
||||
finding. Reading it twice in one session should also return the identical result, since
|
||||
nothing here randomises per call.
|
||||
|
||||
If you want to see the surface with a controller actually active, note that it will stay
|
||||
empty until a genuine gesture produces input; a scripted `dispatchEvent` does not satisfy
|
||||
the gesture gate, which is the whole point of the gate.
|
||||
|
||||
## What matching stock Firefox does not fix
|
||||
|
||||
This is the honest boundary, and it is the same boundary every page in this set draws.
|
||||
|
||||
invisible_playwright is built to look like a real browser driven by a real person, and
|
||||
that is why it passes most detection checks: the fingerprint, the TLS handshake and the
|
||||
driver layer all read as a genuine Firefox, and the Gamepad API is one more surface that
|
||||
reads correct because the engine underneath is real. That covers the browser. It does not
|
||||
cover everything a modern detector weighs.
|
||||
|
||||
Specifically, a perfect Gamepad API shape does nothing for:
|
||||
|
||||
- **IP reputation.** A datacenter address or a known, recycled proxy IP is flagged before
|
||||
a single JavaScript surface is read. You supply a clean exit; the browser cannot.
|
||||
- **Per-account quotas and rate limits.** These are counted server-side against your
|
||||
account and your address. No browser property changes a counter.
|
||||
- **Behaviour and timing.** A pointer that teleports, a form filled in eighty
|
||||
milliseconds, requests at a metronome's interval. You supply human pacing.
|
||||
|
||||
The Gamepad API also has **no effect on any of these** in either direction. It is a
|
||||
consistency signal about the browser, and it lives entirely inside the browser. Getting
|
||||
it right removes one way to be caught; it does not touch the network or the behaviour that
|
||||
a challenge-free clean fingerprint still has to get past. That larger picture is the
|
||||
subject of [why you can be blocked with a clean fingerprint](why-blocked-with-a-clean-fingerprint.md).
|
||||
|
||||
## Conclusion
|
||||
|
||||
The Gamepad API cannot detect a bot by itself, and it is not a rich fingerprint. What it
|
||||
is, is a quiet cross-check on your user-agent claim: a real Firefox returns an empty array
|
||||
until a genuine gesture, gated behind a secure context, in an engine-specific shape. The
|
||||
correct move is to match that exactly, which invisible_playwright does by being a real
|
||||
Firefox rather than by spoofing the surface. An over-eager stub that invents a connected
|
||||
controller, returns the wrong-engine shape, or leaves the function looking overridden is
|
||||
more detectable than the honest empty array it was trying to improve on. Match the stock
|
||||
browser, supply a clean exit and human pacing yourself, and this surface becomes one less
|
||||
thing to worry about.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Can the Gamepad API detect a bot?** Not on its own. It is a consistency check on your
|
||||
user agent, and it flags a browser only when the reported shape disagrees with the engine
|
||||
the user agent claims.
|
||||
|
||||
**Why does getGamepads() return an empty array?** Because that is what a real Firefox
|
||||
returns until a controller reports input after a genuine user gesture. The empty array is
|
||||
the correct, common answer, not a suppressed one.
|
||||
|
||||
**Is an empty gamepad list suspicious?** No. Most desktop sessions have no active
|
||||
controller, so an empty result matches the overwhelming majority of real users. A
|
||||
fabricated connected pad is what looks wrong.
|
||||
|
||||
**Does the Gamepad API need HTTPS?** Yes. It requires a secure context, so a page on
|
||||
plain HTTP sees a different surface than one on `https://`. Test on a secure origin.
|
||||
|
||||
**Does invisible_playwright spoof the Gamepad API?** No extra spoof is needed. The build
|
||||
behaves as stock Firefox does on this surface, because the correct value is the one the
|
||||
unmodified engine already produces.
|
||||
|
||||
**Will fixing this stop me being blocked?** Only for this one signal. It does nothing for
|
||||
IP reputation, account quotas, rate limits or behaviour, which you supply with a clean
|
||||
proxy and human pacing.
|
||||
|
||||
## Sources
|
||||
|
||||
- The Gamepad API as implemented by Firefox: `navigator.getGamepads()`, the
|
||||
`gamepadconnected` / `gamepaddisconnected` events, the secure-context requirement, and
|
||||
the user-gesture gate before a controller is surfaced.
|
||||
- This project's fingerprint parity checks, which compare each browser surface against a
|
||||
stock Firefox on the same machine field by field rather than reading a verdict.
|
||||
|
||||
**See also:** [what data a website collects about your browser](what-data-websites-collect-about-your-browser.md)
|
||||
for the full JS-accessible surface this API sits inside,
|
||||
[maxTouchPoints and pointer consistency](navigator-maxtouchpoints-pointer.md) for the same
|
||||
match-the-boring-value principle on another input surface, and
|
||||
[the checklist for being detected on one site](playwright-detected-as-bot.md) for the order
|
||||
to work in when a single site flags you.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The surface that catches an
|
||||
automated browser is usually the one nobody thought to check.*
|
||||
@@ -0,0 +1,245 @@
|
||||
---
|
||||
title: "Geolocation API vs IP location: keep them consistent"
|
||||
description: "Three location signals a site cross-checks: Geolocation API coordinates, timezone and exit IP country. How to keep all three consistent in the same region."
|
||||
parent: "Network, Proxy and WebRTC"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 26
|
||||
---
|
||||
|
||||
|
||||
# Geolocation API vs IP location: keep them consistent
|
||||
|
||||
A site that cares where you are does not read one location. It reads three, from three
|
||||
different mechanisms, and then checks whether they agree. Grant a page precise
|
||||
coordinates in one country while your traffic leaves from another, and you have handed
|
||||
that site a contradiction that a single honest browser never produces.
|
||||
|
||||
This page separates the three signals, shows how a granted-coordinates prompt in the
|
||||
wrong place contradicts your exit, and gives a short runnable example that keeps all
|
||||
three in one region. It also draws the honest line: the browser can set the timezone
|
||||
and answer the permission prompt, but the country your traffic actually leaves from is
|
||||
the proxy's to decide, not the browser's.
|
||||
|
||||
## The three location signals a site cross-checks
|
||||
|
||||
They sound like one fact about you. They are not. They come from three unrelated places
|
||||
and can each say something different.
|
||||
|
||||
| Signal | What reports it | Who controls it |
|
||||
|---|---|---|
|
||||
| Geolocation API coordinates | [`navigator.geolocation.getCurrentPosition()`](https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition) | The browser, only after a permission prompt |
|
||||
| Timezone | [`Intl.DateTimeFormat().resolvedOptions().timeZone`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat) and the UTC offset | The browser, set from the OS or an override |
|
||||
| IP location | The country of the address the request left from | The network exit - your proxy |
|
||||
|
||||
A detector does not need any one of these to look strange. It needs two of them to
|
||||
disagree. Coordinates in the middle of Europe, a North American timezone, and an exit
|
||||
IP in a third country is three answers to one question, and no real machine gives three
|
||||
answers.
|
||||
|
||||
The Geolocation API is the sharpest of the three because it is the most precise. A
|
||||
timezone puts you on a continent; a country-level IP lookup puts you in a country; a
|
||||
granted coordinate puts you on a street. If that street is two thousand kilometres from
|
||||
where your packets emerge, the gap is trivial to compute and decisive to score.
|
||||
|
||||
## Where each signal comes from, and which ones you control
|
||||
|
||||
The confusion that produces mismatches is treating all three as things the browser sets.
|
||||
Only two of them are.
|
||||
|
||||
**The timezone is the browser's to set, and this wrapper sets it for you.** With the
|
||||
default `timezone="auto"`, the zone is derived from the proxy exit IP, resolved offline
|
||||
against a local database, so it agrees with the country your traffic leaves from without
|
||||
any per-launch call to a location service. The mechanics, and the reason the lookup is
|
||||
done offline, are in
|
||||
[offline timezone resolution from a proxy exit IP](offline-geoip-timezone-proxy.md).
|
||||
|
||||
**The Geolocation API coordinates are the browser's to set, but only if you ask.** A
|
||||
real browser does not hand out a position silently. It shows a permission prompt, and
|
||||
until the user grants it, `getCurrentPosition()` calls the error callback. In automation
|
||||
you grant the permission and supply the coordinates yourself, through
|
||||
[stock Playwright's context options](https://playwright.dev/python/docs/api/class-browser#browser-new-context).
|
||||
Nothing derives them from your exit for you - if you do not place them,
|
||||
either the prompt blocks the call or you supply a coordinate that came from somewhere
|
||||
else entirely.
|
||||
|
||||
**The IP location is not the browser's at all.** The country of your exit address is
|
||||
decided by the proxy, and no browser setting changes it. This is the honest floor of the
|
||||
whole page: you can align the two signals the browser owns to whatever the third one
|
||||
says, but you cannot make the third one say something else from JavaScript. If the exit
|
||||
is in the wrong country, the fix is a different exit, not a different coordinate.
|
||||
|
||||
So the alignment task is one-directional. Read what the exit is, then place the timezone
|
||||
and the coordinates to match it. The wrapper already does the timezone half; the
|
||||
coordinates are the half you have to place on purpose.
|
||||
|
||||
## Granting coordinates in the wrong country
|
||||
|
||||
Here is the mistake, concretely. You copied a geolocation snippet from somewhere, it had
|
||||
a latitude and longitude in it, and you never changed them because the page worked.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# Proxy exit is in the United States. timezone="auto" will resolve an American zone.
|
||||
proxy = {"server": "socks5://gate.example.com:1080", "username": "u", "password": "p"}
|
||||
|
||||
with InvisiblePlaywright(seed=42, proxy=proxy) as browser:
|
||||
# Coordinates left at a European default - this is the contradiction.
|
||||
context = browser.new_context(
|
||||
geolocation={"latitude": 48.85, "longitude": 2.35, "accuracy": 50},
|
||||
permissions=["geolocation"],
|
||||
)
|
||||
page = context.new_page()
|
||||
page.goto("https://example.com")
|
||||
```
|
||||
|
||||
Every layer here is individually fine. The browser is a genuine Firefox, the permission
|
||||
is granted the way a real user grants it, the coordinate is a valid point on the map. The
|
||||
problem is only visible when the three signals are read together: the timezone says
|
||||
America, the granted position says central Europe, and the IP says America again. Two
|
||||
against one, and the one that disagrees is the most precise of the three.
|
||||
|
||||
The failure mode is quiet. Nothing errors. The page gets its position, the script runs,
|
||||
and the session simply looks slightly impossible to anything that bothers to subtract one
|
||||
location from another. It is the same shape of bug as
|
||||
[a timezone left on the host's value behind a foreign proxy](timezone-proxy-mismatch.md):
|
||||
a value that is correct in isolation and wrong in company.
|
||||
|
||||
## Keeping all three aligned: a worked example
|
||||
|
||||
The fix is to place the coordinates in the same country the exit and the timezone already
|
||||
point at, and then read all three back to prove they agree.
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
# A US exit. timezone="auto" resolves an American zone from this exit, offline.
|
||||
proxy = {"server": "socks5://gate.example.com:1080", "username": "u", "password": "p"}
|
||||
|
||||
with InvisiblePlaywright(seed=42, proxy=proxy) as browser:
|
||||
# Coordinates placed in the SAME country as the exit, on purpose.
|
||||
context = browser.new_context(
|
||||
geolocation={"latitude": 40.71, "longitude": -74.01, "accuracy": 60},
|
||||
permissions=["geolocation"],
|
||||
)
|
||||
page = context.new_page()
|
||||
page.goto("https://example.com")
|
||||
|
||||
# 1. The coordinates the page can read, now that permission is granted:
|
||||
coords = page.evaluate("""() => new Promise(resolve => {
|
||||
navigator.geolocation.getCurrentPosition(
|
||||
p => resolve([p.coords.latitude, p.coords.longitude]),
|
||||
e => resolve("denied: " + e.message));
|
||||
})""")
|
||||
|
||||
# 2. The timezone the wrapper derived from the exit:
|
||||
tz = page.evaluate("Intl.DateTimeFormat().resolvedOptions().timeZone")
|
||||
|
||||
# 3. The UTC offset, which must agree with that zone for today's date:
|
||||
offset = page.evaluate("new Date().getTimezoneOffset()")
|
||||
|
||||
print("coords:", coords, "zone:", tz, "offset(min):", offset)
|
||||
```
|
||||
|
||||
The `browser` object is a real Playwright `Browser` and `context` is a real
|
||||
`BrowserContext`, so `new_context`, `geolocation`, `permissions` and `getCurrentPosition`
|
||||
are all stock, documented behaviour - the wrapper adds no new surface here. What it adds
|
||||
is the timezone half of the alignment: signal 2 already matches the exit before you touch
|
||||
anything.
|
||||
|
||||
Read the three lines of output together, not one at a time. The coordinate country, the
|
||||
timezone country, and the exit country all have to be the same country. Because every
|
||||
field is seed-derived, `seed=42` gives the same identity each run, so you can repeat this
|
||||
against the same exit and confirm the three stay locked together rather than drifting.
|
||||
|
||||
If you rotate exits across sessions, this is not a set-once value. Each new exit is a new
|
||||
country, and the coordinate you grant has to move with it. The timezone moves on its own
|
||||
because it is derived; the coordinate does not, because you set it.
|
||||
|
||||
## What this does and does not fix
|
||||
|
||||
invisible_playwright is built to look like a real browser driven by a real person, and
|
||||
that is why it clears most detection: the fingerprint, the TLS handshake and the driver
|
||||
layer read as a genuine Firefox rather than as an automation stack wearing a disguise.
|
||||
Aligning the three location signals removes one more specific contradiction from that
|
||||
picture.
|
||||
|
||||
It does not make you undetectable, and nothing on this page should be read that way.
|
||||
Aligning geolocation, timezone and exit country fixes exactly one class of tell: the
|
||||
one where your location signals disagree with each other. It does not touch:
|
||||
|
||||
- **IP reputation.** A perfectly consistent location on a datacenter address that a
|
||||
thousand other people are using this minute is still a bad address. The coordinates
|
||||
agreeing with it does not make it clean.
|
||||
- **Per-account quotas and rate limits.** These are counted server-side, per identity or
|
||||
per address, and no browser property changes the count.
|
||||
- **Behaviour and timing.** Pointer motion, typing rhythm, and the pace of a session are
|
||||
watched independently of where you claim to be. For agents specifically, see
|
||||
[the pause shaped like model latency](ai-browser-agents-stealth.md).
|
||||
|
||||
Those are the reader's to supply: a clean residential exit, human pacing, and sensible
|
||||
per-account limits. The browser gets the fingerprint and the location story right; the
|
||||
network and the behaviour are still yours to get right. When every location signal lines
|
||||
up and a block persists anyway, the cause is usually one of the three above, which is the
|
||||
subject of [why you can be blocked with a clean fingerprint](why-blocked-with-a-clean-fingerprint.md).
|
||||
|
||||
## Conclusion
|
||||
|
||||
Location is three signals, not one: the Geolocation API coordinates, the browser
|
||||
timezone, and the country of the exit IP. The browser owns the first two and the proxy
|
||||
owns the third, and a site that cares will check that all three tell the same story. This
|
||||
wrapper derives the timezone from the exit for you, so the one signal people most often
|
||||
forget is handled by default; the coordinates are the piece you place by hand, and the
|
||||
only rule is to place them in the same country the exit is already in. Get that right and
|
||||
you have removed a sharp, cheap-to-compute contradiction. You have not removed the need
|
||||
for a clean address and human pacing, and no honest tool claims to.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does setting `geolocation` in Playwright change my IP location?** No. It changes what
|
||||
`navigator.geolocation` reports to the page. The country of your exit address is the
|
||||
proxy's, and nothing in the browser moves it.
|
||||
|
||||
**Do I have to set coordinates at all?** Only if the site asks for them and you want to
|
||||
answer. If you never grant the permission, `getCurrentPosition()` calls its error
|
||||
callback, which is also what a real user who clicks "block" produces. What you must not
|
||||
do is grant coordinates that sit in a different country than your exit.
|
||||
|
||||
**Why does my timezone already match the proxy but my coordinates do not?** Because the
|
||||
wrapper derives the timezone from the exit automatically with `timezone="auto"`, but it
|
||||
does not invent coordinates for you. You supply those, so a stale default sits in the
|
||||
wrong place while the timezone has already moved.
|
||||
|
||||
**How far off can the coordinate be before it matters?** Country level is the line that
|
||||
matters. A site subtracts the granted point from the IP-derived location, and a gap of
|
||||
another continent is decisive. Being in the right country but the wrong city is not what
|
||||
gets scored.
|
||||
|
||||
**Does this make me undetectable?** No. It removes one contradiction between three
|
||||
location signals. IP reputation, account quotas, rate limits and behaviour are separate
|
||||
and unaffected, and a clean location on a burned address still loses.
|
||||
|
||||
**How do I confirm all three agree?** Read the coordinates, the timezone and the exit
|
||||
country in one session and check they name the same country. Reading one and assuming the
|
||||
others is how the mismatch survives.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's runtime timezone path, which resolves `timezone="auto"` from the proxy
|
||||
exit against a locally cached database, described in full in
|
||||
[offline timezone resolution from a proxy exit IP](offline-geoip-timezone-proxy.md).
|
||||
- Stock Playwright's `new_context` geolocation and permission options, used unchanged.
|
||||
- The [Configuration](configuration.md) page for the proxy and timezone settings the
|
||||
example above relies on.
|
||||
|
||||
**See also:** [when the timezone does not match the proxy](timezone-proxy-mismatch.md)
|
||||
for the other half of "the browser and the network disagree", and
|
||||
[the WebRTC surface behind a proxy](webrtc-leak-proxy.md), which is a fourth place the
|
||||
network can contradict 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 wrapper aligns the
|
||||
timezone with your exit for you; the granted coordinates are the one location signal you
|
||||
still have to place on purpose.*
|
||||
@@ -0,0 +1,214 @@
|
||||
---
|
||||
title: "getClientRects fingerprinting: subpixel geometry as ID"
|
||||
description: "getClientRects leak subpixel geometry that hashes into cross-platform fingerprints. Why they betray faked OS, and how real Windows renders stay self-consistent."
|
||||
parent: "Detectors, Explained"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 17
|
||||
---
|
||||
|
||||
|
||||
# getClientRects fingerprinting: subpixel geometry as ID
|
||||
|
||||
Most fingerprinting pages measure something you think of as visual: a canvas drawing,
|
||||
a WebGL string, an audio buffer. This one measures the position of text on the page,
|
||||
down to fractions of a pixel, and it does it without drawing anything you can see.
|
||||
|
||||
[`element.getClientRects()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getClientRects) and [`element.getBoundingClientRect()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect) return the geometry
|
||||
of a laid-out element: its top, left, width and height as [floating-point numbers](https://www.w3.org/TR/cssom-view-1/). Those
|
||||
numbers are not round. They carry a long fractional tail, and that tail is decided by
|
||||
the same stack a real browser cannot hide: the font rasterizer, the device pixel ratio,
|
||||
and the operating system's text layout. A script reads a handful of rects, hashes the
|
||||
floats, and now has a value that is stable for your machine and different for a machine
|
||||
pretending to be yours.
|
||||
|
||||
This page is what that measurement actually is, why it is a cross-platform tell in
|
||||
particular, and why a browser genuinely rendering on Windows produces Windows-shaped
|
||||
rects for free. It also answers the question honestly: matching geometry proves your
|
||||
platform is consistent, and nothing more.
|
||||
|
||||
## What the rects actually contain
|
||||
|
||||
When the layout engine positions a run of text, it does not snap glyphs to whole
|
||||
pixels. Fractional advances accumulate across characters, subpixel positioning nudges
|
||||
each glyph, and the resulting box has a width like `152.34375` rather than `152`. The
|
||||
exact fraction depends on:
|
||||
|
||||
- **The font rasterizer and its hinting.** How the platform turns an outline into
|
||||
positioned glyphs differs between operating systems, and the difference lands in the
|
||||
fractional part of every text box.
|
||||
- **The device pixel ratio.** A DPR that no real display uses, or one that disagrees
|
||||
with the reported screen, shifts the rounding and the fractional tail with it.
|
||||
- **The OS text layout and font stack.** Which fonts are actually installed, and which
|
||||
one the platform substitutes when the requested face is missing, changes the metrics
|
||||
the box is built from.
|
||||
|
||||
Read one box and it is just a number. Read a small panel of elements with different
|
||||
fonts, sizes and styles, and the collection of fractional tails is a signature. This is
|
||||
the same family of measurement as [text metrics fingerprinting](measuretext-textmetrics-fingerprinting.md):
|
||||
both read layout numbers a real render produces and a fake render cannot fake into
|
||||
agreement.
|
||||
|
||||
## Why float geometry is a cross-platform tell
|
||||
|
||||
Here is the part that turns a fingerprint into a detector.
|
||||
|
||||
The width of a text box is not a free parameter. It is a consequence of the platform.
|
||||
A browser claiming to be Windows in its user agent, but rendering with a Linux font
|
||||
stack and a Linux rasterizer, produces text boxes with the wrong fractional tails for
|
||||
Windows. Nothing on the page looks wrong to a human. The numbers are wrong to a script
|
||||
that knows what Windows rects look like.
|
||||
|
||||
So the detector does not ask "is this box unusual". It asks "does this geometry match
|
||||
the platform this browser claims". That is the more dangerous question, and it is the
|
||||
same shape as every other consistency check in this set: a value that is individually
|
||||
plausible and disagrees with a value it should match. A pinned user agent, a spoofed
|
||||
`navigator.platform`, a header generator that rewrites the OS string - none of them
|
||||
touch the layout engine, so none of them move the rects. The disguise says Windows and
|
||||
the geometry says something else.
|
||||
|
||||
You cannot patch your way out of this from JavaScript in a way that survives. Rounding
|
||||
the rects to whole numbers is itself a signal: real browsers return fractional values,
|
||||
so an integer-only response is a browser announcing it has been tampered with, the same
|
||||
trap that [canvas noise injection](canvas-fingerprint-noise.md) falls into. And
|
||||
generating plausible-looking fractions is generating a second thing that now has to
|
||||
agree with the fonts, the DPR and the screen you also reported. The only response that
|
||||
is consistent with the claimed platform is the one an actual render on that platform
|
||||
produces.
|
||||
|
||||
## Why a real Windows render stays self-consistent
|
||||
|
||||
This is where the product does something a spoof cannot.
|
||||
|
||||
invisible_playwright is a Firefox patched at the C++ level, and when it runs on real
|
||||
Windows the layout engine is genuinely rasterizing text on the Windows font stack at
|
||||
the reported device pixel ratio. The rects it returns are Windows rects because they
|
||||
were produced by Windows, not written to look like Windows. There is no separate
|
||||
geometry spoof to keep in agreement with the fonts, because the fonts, the rasterizer
|
||||
and the DPR are the ones actually doing the work. The `getBoundingClientRect` tail
|
||||
agrees with the font list agrees with the screen agrees with the user agent, because
|
||||
one real stack produced all of them.
|
||||
|
||||
That is the general principle behind the whole fingerprint here: consistency comes from
|
||||
a real render rather than from a correction layer.
|
||||
[Canvas and WebGL stay cross-platform-consistent for the same reason](canvas-webgl-cross-platform-consistency.md) -
|
||||
they are drawn by the machine they claim to be, so no field has to be talked into
|
||||
matching another.
|
||||
|
||||
The two-line launch, and the rect read this page is about:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
|
||||
# read the subpixel geometry a detector would hash
|
||||
rect = page.evaluate("""() => {
|
||||
const el = document.body;
|
||||
const r = el.getBoundingClientRect();
|
||||
return { top: r.top, left: r.left, width: r.width, height: r.height };
|
||||
}""")
|
||||
print(rect) # fractional values, Windows-shaped, because Windows produced them
|
||||
```
|
||||
|
||||
The `browser` object is a real Playwright `Browser`, so `page.evaluate`,
|
||||
`getClientRects` and every other method behave exactly as documented upstream. Nothing
|
||||
about reading geometry is special-cased.
|
||||
|
||||
Because the whole identity derives from the seed, the geometry is reproducible: the same
|
||||
`seed=42` gives the same screen, the same DPR and the same font stack, so a rect you
|
||||
read today you can read again next week while you bisect a failure. Change the seed and
|
||||
you get a different consistent machine, not a different set of contradictions.
|
||||
|
||||
```python
|
||||
# same seed -> same screen, same DPR, same font stack -> same rects, run after run
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
...
|
||||
```
|
||||
|
||||
## What matching geometry does not prove
|
||||
|
||||
The honest boundary, because this is the part that gets overstated.
|
||||
|
||||
Windows-consistent rects prove one thing: the browser's layout output matches the
|
||||
platform it claims, so this particular cross-platform tell reads clean. That is why
|
||||
invisible_playwright passes most fingerprint-level checks - the geometry, the fonts, the
|
||||
canvas, the TLS handshake and the driver layer all read as a genuine Firefox on the OS
|
||||
it says it is, because that is what they are. It is a real render, not a table of spoofed
|
||||
answers.
|
||||
|
||||
It does not prove the session is a trusted human, and it does not touch the things that
|
||||
live outside the browser:
|
||||
|
||||
- **IP reputation.** A perfectly consistent browser on a datacenter address is still on
|
||||
a datacenter address. Geometry does not move an IP. Supply a clean residential exit.
|
||||
- **Per-account quotas and rate limits.** Velocity is counted against your account and
|
||||
your address regardless of how real the rects are.
|
||||
- **Behaviour and timing.** A pointer that teleports, a form filled in eighty
|
||||
milliseconds, a perfectly uniform request cadence - none of that is a fingerprint, and
|
||||
none of it is fixed by geometry. You supply human pacing.
|
||||
|
||||
Matching geometry removes one reason to be flagged. It does not remove the others, and a
|
||||
page that promised otherwise would be lying to you. Treat it as one clean surface among
|
||||
several you are responsible for, in the order [the detection checklist](playwright-detected-as-bot.md)
|
||||
works through them.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Subpixel DOM geometry is a fingerprint because the fractional tails of `getClientRects`
|
||||
and `getBoundingClientRect` are decided by the font rasterizer, the device pixel ratio
|
||||
and the OS text layout, and a script can hash them into a stable value and check it
|
||||
against the platform you claim. It is a cross-platform tell in particular: a faked OS
|
||||
produces the wrong tails, and rounding or forging them only trades one signal for
|
||||
another. A Firefox genuinely rendering on real Windows returns Windows rects because
|
||||
Windows produced them, so the geometry agrees with the fonts, the screen and the user
|
||||
agent without a correction layer to keep in sync. That earns you a clean surface. It does
|
||||
not earn you a clean IP, a fresh quota, or human timing, and those are still yours to
|
||||
bring.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**What is getClientRects fingerprinting?** A script reads the floating-point geometry of
|
||||
laid-out elements and hashes the subpixel values into an identifier, because those
|
||||
fractions are decided by the font rasterizer, the DPR and the OS text layout.
|
||||
|
||||
**Why are the width and height not whole numbers?** Because the layout engine positions
|
||||
glyphs at fractional advances and does not snap boxes to whole pixels. The fractional
|
||||
tail is the part that carries the fingerprint.
|
||||
|
||||
**Can I just round the rects to hide it?** No. Real browsers return fractional values, so
|
||||
an integer-only response is itself a tampering signal, and forged fractions still have to
|
||||
agree with your fonts, DPR and screen.
|
||||
|
||||
**Why does a spoofed user agent fail this check?** Because changing the OS string does
|
||||
not change the layout engine, so the geometry keeps reporting the real platform while the
|
||||
user agent claims another. The two disagree, and the detector reads the disagreement.
|
||||
|
||||
**Does invisible_playwright pass geometry checks?** On real Windows the rects are Windows
|
||||
rects because the engine genuinely rendered on Windows, so this surface reads consistent
|
||||
with the rest of the fingerprint.
|
||||
|
||||
**If the geometry matches, am I safe?** You have cleared one cross-platform tell. IP
|
||||
reputation, account quotas, rate limits and behaviour are separate, and a consistent
|
||||
browser on a bad IP or with robotic timing still gets flagged.
|
||||
|
||||
## Sources
|
||||
|
||||
- The WHATWG and CSSOM View specifications for `getClientRects` and
|
||||
`getBoundingClientRect`, which define the returned rectangles as floating-point values.
|
||||
- This project's fingerprint gates, which compare a full field panel against a stock
|
||||
browser on the same machine rather than reading a verdict, and which treat a value that
|
||||
disagrees with the claimed platform as a failure.
|
||||
|
||||
**See also:** [text metrics fingerprinting](measuretext-textmetrics-fingerprinting.md) for
|
||||
the closely related layout-number tell, [cross-platform canvas and WebGL consistency](canvas-webgl-cross-platform-consistency.md)
|
||||
for why a real render needs no correction layer, and [how to test whether your browser is
|
||||
detected](how-to-test-bot-detection.md) for the compare-against-stock method that catches
|
||||
a geometry mismatch.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. The rects are Windows rects
|
||||
because Windows drew them, not because we wrote them down.*
|
||||
@@ -0,0 +1,218 @@
|
||||
---
|
||||
title: "ghost-cursor human mouse paths with Playwright"
|
||||
description: "ghost-cursor draws human-like Bezier mouse paths for Playwright. Where invisible_playwright fingerprint realness ends and pointer-behaviour realism begins."
|
||||
parent: "The Automation Layer"
|
||||
grand_parent: "Guides"
|
||||
nav_order: 29
|
||||
---
|
||||
|
||||
|
||||
# ghost-cursor human mouse paths with Playwright
|
||||
|
||||
Two things get a session flagged, and they are not the same thing. One is what the
|
||||
browser reports about itself: the GPU, the fonts, the screen, the driver flags. The
|
||||
other is what the browser does once it is on the page: where the pointer goes, how
|
||||
fast, and whether it ever moves at all before a click.
|
||||
|
||||
ghost-cursor addresses the second one. It generates human-like mouse paths using
|
||||
Bezier curves with realistic acceleration and overshoot, so a click arrives at a
|
||||
button along a plausible arc instead of appearing on it. This page is about how that
|
||||
layer fits with a browser that is already real at the fingerprint level, and, just as
|
||||
important, what it does not fix.
|
||||
|
||||
## Fingerprint realness and behaviour realness are two problems
|
||||
|
||||
invisible_playwright makes the browser look like a real Firefox driven by a real
|
||||
person. The patch lives in the C++ engine, so the values a detector reads come out
|
||||
consistent with each other: the GPU string matches the pixels it draws, the fonts
|
||||
match the platform, the driver flags read like a browser nobody automated. That is
|
||||
why it passes most fingerprint, TLS and driver checks. A page-level property patch
|
||||
cannot claim the same, because it is editing answers after the engine has already
|
||||
given a different one.
|
||||
|
||||
None of that is a statement about behaviour. Fingerprint realness answers "what is
|
||||
this browser"; behaviour realness answers "is a person driving it". They are
|
||||
measured by different code, they fail independently, and you need both. A perfectly
|
||||
consistent fingerprint that teleports its pointer from corner to corner is a real
|
||||
browser being driven by something that is obviously not a person, and some sites
|
||||
watch only for that.
|
||||
|
||||
## What invisible_playwright already does to the pointer
|
||||
|
||||
Switching from stock Playwright is two lines, and the pointer behaviour changes with
|
||||
it:
|
||||
|
||||
```python
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
page.click("#submit") # the pointer arcs to the button on a Bezier curve
|
||||
```
|
||||
|
||||
The `browser` object is a real Playwright `Browser`, so every method you already use
|
||||
works unchanged. What is different is that a `page.click()` routed through this class
|
||||
does not jump the cursor onto the target: a built-in cursor engine moves it there
|
||||
along a curved path first. You can select which engine drives that motion, or turn it
|
||||
off, with an environment variable:
|
||||
|
||||
```bash
|
||||
# python (default) drives the built-in path engine; "off" hands motion back to you
|
||||
export INVPW_CURSOR_ENGINE=off
|
||||
```
|
||||
|
||||
So for the ordinary case, click paths are already handled and you do not have to add
|
||||
anything. The reason this page exists is that click paths are one slice of pointer
|
||||
behaviour, not all of it.
|
||||
|
||||
## Where the gap still is
|
||||
|
||||
The built-in arc covers the pointer motion for clicks the class drives. Several
|
||||
common patterns fall outside that:
|
||||
|
||||
- **Moving without clicking.** If you call
|
||||
[`page.mouse.move(x, y)`](https://playwright.dev/python/docs/api/class-mouse#mouse-move)
|
||||
directly, that is a raw Playwright call and it teleports: Playwright's own docs
|
||||
say the default single-step call "emits a single `mousemove` event at the
|
||||
destination location," which is exactly the jump a detector can catch. Exploratory
|
||||
drift, moving toward an element to trigger a hover state, or repositioning between
|
||||
actions are all straight jumps unless something draws them.
|
||||
- **Hover before click.** A person's pointer is usually near a control before they
|
||||
commit to it. A driver that only ever moves at the moment of the click has a
|
||||
different signature from one that approaches first.
|
||||
- **The shape and timing you want.** If you need a specific approach, an overshoot
|
||||
and correction, or a particular pace, you want to own the path rather than accept a
|
||||
default.
|
||||
|
||||
For all of these you set `INVPW_CURSOR_ENGINE=off` so the two engines are not both
|
||||
trying to move the mouse, and you drive the pointer yourself. ghost-cursor is a
|
||||
convenient way to do that, because it produces the curved, accelerating motion for
|
||||
arbitrary moves and not only for clicks.
|
||||
|
||||
## Layering ghost-cursor for full control of the path
|
||||
|
||||
ghost-cursor started as a Node library; the Python port `python-ghost-cursor` drives
|
||||
a Playwright page directly. Because invisible_playwright hands you a genuine
|
||||
Playwright `Page`, the port attaches to it with no adapter:
|
||||
|
||||
```bash
|
||||
pip install invisible-playwright python-ghost-cursor
|
||||
```
|
||||
|
||||
```python
|
||||
import os
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
from python_ghost_cursor.playwright_sync import create_cursor
|
||||
|
||||
# hand pointer motion to ghost-cursor so the two engines do not fight over the mouse
|
||||
os.environ["INVPW_CURSOR_ENGINE"] = "off"
|
||||
|
||||
with InvisiblePlaywright(seed=42) as browser:
|
||||
page = browser.new_page()
|
||||
page.goto("https://example.com")
|
||||
|
||||
cursor = create_cursor(page)
|
||||
cursor.move("#menu") # curved approach, no click, sets up a hover
|
||||
cursor.click("#submit") # Bezier path to the target, then the click
|
||||
```
|
||||
|
||||
The identity stays reproducible: `seed=42` gives the same GPU, canvas hash, audio
|
||||
context and fonts on every run, so if a session is flagged you can replay it and tell
|
||||
a change in the site from a change in the machine. The pointer path from ghost-cursor
|
||||
is not seed-locked to that identity, but the fingerprint underneath it is, which is
|
||||
the part that has to stay stable for a bisect to mean anything.
|
||||
|
||||
If you would rather keep the built-in engine for clicks and add ghost-cursor only for
|
||||
the moves between them, leave `INVPW_CURSOR_ENGINE` at its default and use the cursor
|
||||
for `move` calls alone. Either arrangement is fine; what you must avoid is two engines
|
||||
animating the same click, which produces a doubled or contradictory motion that is
|
||||
worse than either alone.
|
||||
|
||||
## The honest boundary: what pointer realism does not fix
|
||||
|
||||
A human-shaped mouse path removes one tell. It does not remove the others, and it is
|
||||
worth being explicit so a smooth cursor is not mistaken for a solved session.
|
||||
|
||||
- **IP reputation.** A real browser with a lifelike pointer, arriving from a
|
||||
datacenter range or a public proxy everyone else is using this minute, still loses.
|
||||
The pointer path is invisible to the part of the system that scores the address.
|
||||
You supply a clean exit; see [configuration](configuration.md) for how the proxy is
|
||||
set and how the timezone is derived from it.
|
||||
- **Pacing and rate.** ghost-cursor shapes a single motion. It says nothing about how
|
||||
many actions you take, how close together, or whether a form is filled in eighty
|
||||
milliseconds. Per-account quotas and rate limits are counted server-side and no
|
||||
cursor library touches them. Human pacing between actions is yours to add.
|
||||
- **Session rhythm overall.** Scrolling, reading pauses, the gap between landing and
|
||||
the first interaction, and for automated agents
|
||||
[the pause shaped like model latency](ai-browser-agents-stealth.md) are all
|
||||
behaviour that a mouse-path library does not cover.
|
||||
|
||||
The rule from the rest of this site holds here: stealth means looking real, not
|
||||
suppressing a signal. A pointer that never moves is not a neutral absence, it is a
|
||||
signal, in the same way that a
|
||||
[trust score is built from many surfaces agreeing](browser-trust-score-explained.md)
|
||||
rather than from any one of them being silent. ghost-cursor fills one of those
|
||||
surfaces. It does not fill the rest, and no honest page would claim it makes a session
|
||||
undetectable.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Fingerprint realness and behaviour realness are separate problems with separate
|
||||
fixes. invisible_playwright covers the first at the engine level and already arcs the
|
||||
pointer for the clicks it drives; ghost-cursor lets you own the full pointer path when
|
||||
you need motion beyond those clicks. Layer them by handing motion to one engine at a
|
||||
time, keep the seed fixed so failures are reproducible, and remember that a lifelike
|
||||
cursor is one honest improvement among several the reader still has to supply: a clean
|
||||
exit, human pacing, and a session rhythm that is not all one speed.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Does invisible_playwright already move the mouse on a curve?** Yes. A `page.click()`
|
||||
routed through the class arcs the pointer to the target on a Bezier path by default.
|
||||
ghost-cursor is for pointer motion beyond those clicks, or when you want to own the
|
||||
path yourself.
|
||||
|
||||
**Do I still need ghost-cursor then?** Only for what the built-in click arc does not
|
||||
cover: moving without clicking, hovering before a click, or a specific shape and
|
||||
pace. For plain clicks you do not have to add anything.
|
||||
|
||||
**How do I stop the two cursor engines fighting?** Set `INVPW_CURSOR_ENGINE=off`
|
||||
before launch when ghost-cursor is driving the pointer, so only one engine animates
|
||||
the mouse. Never let both animate the same click.
|
||||
|
||||
**Does a human mouse path make me undetectable?** No. It removes the teleport-click
|
||||
tell and nothing else. IP reputation, rate limits, per-account quotas and overall
|
||||
timing are separate, and you still supply a clean proxy and human pacing.
|
||||
|
||||
**Does ghost-cursor need a special browser build?** No. invisible_playwright returns a
|
||||
standard Playwright `Page`, so `python-ghost-cursor` attaches to it the same way it
|
||||
would to any Playwright page.
|
||||
|
||||
**Will the pointer path be the same for a fixed seed?** The fingerprint is seed-locked
|
||||
and reproduces exactly; the ghost-cursor path is not tied to the seed. The identity
|
||||
underneath stays stable, which is what a bisect depends on.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's quickstart and configuration pages for the real launch API, the
|
||||
built-in cursor engine, and the `INVPW_CURSOR_ENGINE` variable.
|
||||
- [Playwright's own mouse API documentation](https://playwright.dev/python/docs/api/class-mouse#mouse-move)
|
||||
for how `page.mouse.move()` behaves with no engine layered on top of it.
|
||||
- The public ghost-cursor project and its Python port for the Bezier-path pointer
|
||||
motion, read from their own documentation.
|
||||
- The release notes for this site's separation of fingerprint surfaces from
|
||||
behavioural ones, which is why pointer realism is documented as a layer you add
|
||||
rather than a claim the engine makes for you.
|
||||
|
||||
**See also:** [what a browser trust score actually measures](browser-trust-score-explained.md),
|
||||
[stealth for AI browser agents](ai-browser-agents-stealth.md) for the timing tells a
|
||||
cursor path does not cover, and [the automation layer](guides-automation-layer.md) for
|
||||
why the driver itself is a surface.
|
||||
|
||||
---
|
||||
|
||||
*Written while maintaining [invisible_playwright](https://github.com/feder-cr/invisible_playwright),
|
||||
a Firefox patched at the C++ level driven by stock Playwright. It looks like a real
|
||||
browser and already arcs the pointer for its clicks; the rest of behaviour, and a
|
||||
clean exit, are still yours to supply.*
|
||||
@@ -0,0 +1,47 @@
|
||||
---
|
||||
title: "AI Agents and Frameworks"
|
||||
description: "Agent frameworks that drive a browser, checked from their own source rather than assumed - which ones use Playwright at all, which are CDP/Chromium-only, and what applies whichever one you picked."
|
||||
parent: "Guides"
|
||||
has_children: true
|
||||
nav_order: 5
|
||||
---
|
||||
|
||||
|
||||
# AI Agents and Frameworks
|
||||
|
||||
The newest category here, and the one with the most room to grow. An AI agent that
|
||||
drives a browser inherits every fingerprinting surface a human-scripted session
|
||||
does, plus one of its own: the rhythm of an agent's actions is not a human's rhythm,
|
||||
and that is checkable independently of any fingerprint work. Each page here is
|
||||
verified against the framework's actual source before anything is claimed about it -
|
||||
several candidates that looked like a fit by star count turned out not to use
|
||||
Playwright, or not to touch Firefox, at all.
|
||||
|
||||
## 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.
|
||||
- [smolagents: hand the agent an invisible_playwright tool](smolagents-invisible-playwright-tool.md) - smolagents' vision browser drives Chromium via helium, so register a custom tool instead.
|
||||
- [Stagehand and stealth: why a Firefox engine won't drop in](stagehand-firefox-engine-fit.md) - Stagehand is TypeScript and Chromium-channel only, so a Python-launched Firefox cannot drop in.
|
||||
- [crawl4ai stealth mode and custom browser engines](crawl4ai-stealth-custom-browser.md) - crawl4ai takes browser_type firefox but no executable_path, so you get Playwright's managed build.
|
||||
- [Give an MCP browser server a stealth Firefox engine](mcp-browser-server-stealth-firefox.md) - point Playwright MCP at a patched Firefox with browserName plus executablePath, minus the profile.
|
||||
|
||||
## 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.
|
||||
- [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.
|
||||
|
||||
## Running agents at scale and on servers
|
||||
|
||||
- [Running an AI browser agent headless on a server](headless-browser-agent-on-a-server.md) - the engine covers the GPU-less headless fingerprint; IP reputation stays yours to supply.
|
||||
- [Run parallel browser agents with distinct fingerprints](parallel-browser-agents-distinct-fingerprints.md) - each agent gets its own reproducible fingerprint, but one shared exit IP still links them.
|
||||
- [Give each AI agent a reproducible browser identity](reproducible-agent-browser-identity-seed.md) - one seed keeps a repeated task on one stable device fingerprint.
|
||||
- [Give a browser agent a persistent logged-in session](persistent-logged-in-session-browser-agent.md) - reuse saved storage_state or profile plus a pinned seed to stay logged in.
|
||||
- [Feed invisible_playwright pages into a RAG index](feed-invisible-playwright-pages-into-rag-index.md) - fetch JS-rendered gated pages as real HTML, then chunk and embed the text.
|
||||
@@ -0,0 +1,76 @@
|
||||
---
|
||||
title: "The Automation Layer"
|
||||
description: "The driver itself as a fingerprinting surface: what patching a page cannot fix, because the tell lives in how the browser is piloted, not in what it reports."
|
||||
parent: "Guides"
|
||||
has_children: true
|
||||
nav_order: 4
|
||||
---
|
||||
|
||||
|
||||
# The Automation Layer
|
||||
|
||||
A different category from the rest of this site: not what the browser reports, but
|
||||
what the act of automating it leaves behind. A debugger attached for evaluation
|
||||
changes timing. A driver's own artefacts show up in stack traces. A protocol version
|
||||
mismatch breaks silently on one specific call. None of this is a value you can
|
||||
override from the page, because the page is not where the tell originates.
|
||||
|
||||
## What the driver reveals about itself
|
||||
|
||||
- [Can Websites Detect Playwright?](can-websites-detect-playwright.md) - Which webdriver, protocol and fingerprint signals catch a run, and what a patched Firefox fixes.
|
||||
- [Does Playwright Change My Browser Fingerprint?](does-playwright-change-my-fingerprint.md) - Stock Playwright inherits the host's real values instead of randomizing, leaking past a spoofed user agent.
|
||||
- [Does Playwright Get Detected on the First Request?](does-playwright-get-detected-first-request.md) - The TLS handshake and HTTP/2 settings form a network fingerprint detectable before any JavaScript runs.
|
||||
- [Does Playwright Leave Traces a Website Can See?](does-playwright-leave-traces.md) - Which traces are page-visible, why the control-channel WebSocket is not, and how a patched Firefox reads as ordinary.
|
||||
- [Does Playwright Set navigator.webdriver to True?](does-playwright-set-navigator-webdriver.md) - Stock Playwright reports it true; why patching it in JavaScript is itself detectable.
|
||||
- [Does Playwright Support Firefox Stealth?](does-playwright-support-firefox-stealth.md) - Put the spoofs in a patched browser and keep the standard Playwright API.
|
||||
- [Is Playwright Firefox Harder to Detect Than Chromium?](is-playwright-firefox-harder-to-detect-chromium.md) - The one structural difference in injection, and where engine choice stops helping.
|
||||
- [Why Playwright's bundled Firefox is easy to detect](playwright-bundled-firefox-detectable.md) - Its version markers and runtime traits differ from a released build, and swapping the binary removes the tell.
|
||||
- [Function.prototype.toString and the [native code] check](tostring-native-code-detection.md) - Why toString spoofing fails the [native code] check, and what an engine-level build fixes.
|
||||
- [The ChromeDriver cdc_ variable, and why renaming it fails](cdc-variable-explained.md) - The cdc_ variable is a one-line test; renaming it raises the bar but leaves the tell.
|
||||
- [Why an attached debugger makes automation detectable](debugger-timing-detection.md) - A service reported developer_tools true with no devtools open: the framework's attached debugger, four separate leaks.
|
||||
- [Playwright isTrusted: are automated clicks real?](playwright-clicks-istrusted.md) - A JS-dispatched event never can be, but Firefox driven through Juggler synthesizes input on the native path.
|
||||
|
||||
## Connecting, protocol, and process lifecycle
|
||||
|
||||
- [Stock Playwright, patched Firefox: how they connect](stock-playwright-patched-binary.md) - Joining unmodified Playwright to a patched binary through a prefs and environment contract.
|
||||
- [Playwright connect_over_cdp does not work with Firefox](playwright-connect-over-cdp-firefox.md) - Firefox ships no DevTools Protocol; the Juggler-based connect() path that replaces it, with runnable code.
|
||||
- [Why a Playwright upgrade broke 97 of 133 tests overnight](playwright-protocol-drift.md) - One undeclared field broke tests while the browser launched fine: what protocol drift is and how to catch it.
|
||||
- [Firefox launches but Playwright can't drive it: packaging gap](juggler-missing-packaged-build.md) - A build launches and screenshots fine yet fails at launch with TargetClosedError; the cause is packaging, not the driver.
|
||||
- [Orphaned Firefox processes on Windows: the killed-runner leak](orphaned-browser-process-windows.md) - These come from a killed test runner; the fix binds the browser to an OS job object.
|
||||
- [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.
|
||||
|
||||
## 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.
|
||||
- [ghost-cursor human mouse paths with Playwright](ghost-cursor-human-mouse.md) - Where fingerprint realness ends and pointer-behaviour realism begins.
|
||||
- [Why humanized mouse movement can fail on hover()](hover-mouse-movement-bug.md) - A hit-target check moves the pointer first, collapsing the humanized path to a near-teleport; the cause and fix.
|
||||
- [Drag and drop elements in Playwright with drag_to](drag-and-drop-playwright-firefox-drag-to.md) - How to drag and drop, why the pointer events come back trusted, and the honest limit on programmatic paths.
|
||||
- [Playwright dialog and popup handling without a tell](playwright-dialog-popup-handling.md) - The instant always-cancel default for JS dialogs is both a functional bug and a non-human tell.
|
||||
|
||||
## Sessions, profiles, and per-context identity
|
||||
|
||||
- [Why automating login is riskier than reusing a session](automating-login-vs-session-reuse.md) - A login form runs the most monitored flow; a saved session skips it if the fingerprint still matches.
|
||||
- [Can I Use My Real Browser Profile With Playwright?](can-i-use-my-real-browser-profile-playwright.md) - Reusing your daily profile leaks personal cookies and the host fingerprint; use a dedicated seed-fixed profile.
|
||||
- [Save and reuse login with storage_state in Playwright](save-reuse-login-storage-state-playwright.md) - Save and restore cookies and localStorage to skip the login form, plus the seed and exit IP that must match.
|
||||
- [Playwright persistent profile: what it fixes and breaks](persistent-profiles.md) - Keeps logins but carries three traps: a stale seed, a permission disabling WebRTC protection, and an inconsistent age.
|
||||
- [Isolate identities with a browser context per session](isolate-identities-browser-context-per-session.md) - One context per account keeps cookies, storage and cache from bleeding; storage isolation is not IP isolation.
|
||||
- [Playwright new_page vs new_context: the viewport tell](playwright-new-page-vs-new-context.md) - new_page can ship the stock viewport and skip your per-context fingerprint defaults; new_context does not.
|
||||
- [Read and set cookies in a Playwright context](read-set-cookies-playwright-context.md) - Read the cookie jar and seed a consent flag or auth token, plus the caveat on hand-set attributes.
|
||||
- [Set geolocation and permissions per Playwright context](set-geolocation-permissions-per-playwright-context.md) - Set coordinates and grant the permission per context, and why they must agree with your IP, timezone and locale.
|
||||
- [Playwright mobile emulation on Firefox and isMobile](playwright-firefox-mobile-emulation.md) - Why iPhone and mobile presets misbehave: isMobile is unsupported and the seeded engine owns the screen size.
|
||||
|
||||
## Network interception and traffic
|
||||
|
||||
- [When to use an HTTP client vs a real browser](http-client-vs-real-browser.md) - A decision flowchart: an HTTP client when the data is in the response, a real browser when JavaScript builds the page.
|
||||
- [Migrating from requests + BeautifulSoup to a browser](migrate-requests-beautifulsoup-to-browser.md) - Move a scraper to a real browser when the data is JavaScript-rendered, while keeping BeautifulSoup as the parser.
|
||||
- [Intercept and mock network requests with page.route](intercept-and-mock-requests-page-route-playwright.md) - Intercept, mock, abort or rewrite requests, with the honest caveat on forged responses and edited headers.
|
||||
- [Record and replay HTTP traffic with HAR in Playwright](record-replay-http-traffic-har-playwright.md) - Record to a HAR and replay offline, why the replay is a stale fixture, and why a HAR holds real session data.
|
||||
- [Handle HTTP basic auth in Playwright (http_credentials)](http-basic-auth-playwright-http-credentials.md) - Pass credentials to answer a 401 challenge, why that differs from an HTML login form, and how to keep the secret out of code.
|
||||
|
||||
## Files, downloads, and recorded artifacts
|
||||
|
||||
- [Playwright download files with Firefox and the tell](playwright-download-files-firefox.md) - Using expect_download: accept_downloads defaults on, no save dialog appears, and the file is not page-visible.
|
||||
- [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.
|
||||