How XDriver patches Playwright
Patchright is a separate forked package you install instead of Playwright; XDriver takes a different route and edits the Playwright you already have installed. x_driver activate backs up the driver/package folder to driver/package_1, copies its patched files over the originals, and tweaks playwright/__init__.py. Your scripts keep importing the normal playwright module but now run on the hardened driver — zero code changes.
The patched files close several automation tells. They avoid Runtime.enable (a CDP command anti-bot scripts watch for) and use Page.createIsolatedWorld instead; they strip and randomise Playwright's own markers in injected scripts; they hide binding names inside isolated worlds; they filter WebRTC ICE candidates so your real IP cannot leak (WebRTC is the browser's peer-to-peer feature that can expose local network addresses); and they block service-worker registration, which can otherwise be used to fingerprint automation.
Coverage and the version-lock trade-off
The project reports passing Cloudflare, Turnstile, Kasada, DataDome, PerimeterX, Imperva and Fingerprint.com, plus 100% anonymous on CreepJS and strong scores on BrowserScan, Rebrowser, and Whoer (these are public fingerprinting and bot-detection test sites). The trade-off is maintenance risk. Because it patches exact file internals, XDriver is locked to Playwright 1.52.0; it is a one-person beta (v1.0.1), works only with Chromium, and if the backup gets corrupted you have to restore by hand. It is invasive by design — it rewrites files inside your library folder.
XDriver vs Patchright — which to pick
Both deliver similar Chromium CDP stealth, just in different ways. XDriver: replaces files in place, needs no import changes, and toggles on and off easily — but it is pinned to one Playwright version and maintained by a single author. Patchright: a separately maintained package that keeps pace with new Playwright releases, supports Python, Node.js and .NET, and has an active community — but you import from patchright instead of playwright. Pick XDriver for quick testing on a codebase you cannot modify; pick Patchright for production and version flexibility.
