Selenium and Playwright on Anti-Detect Browsers β 2026 Guide
Driving anti-detect profiles from Selenium / Playwright code: connect, control, avoid driver fingerprints.
Selenium 4 and Playwright 1.40+ work with most anti-detect browsers through the same protocol Chrome DevTools uses. The catch: stock automation libs leak driver fingerprints that defeat the entire anti-detect.
Connecting
Afina, Multilogin, Octo, and most premium products expose a local API:
# Python + Playwright
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.connect_over_cdp("ws://localhost:3030/p/abc123")
context = browser.contexts[0]
page = context.new_page()
page.goto("https://spoofbrowser.com")
The local WebSocket URL is per-profile. Open the profile, get the URL, connect.
What anti-detect handles for you
Stock Chromium driven by Selenium leaks:
navigator.webdriver === truewindow.chrome.runtimepatterns- Chrome DevTools Protocol events
- WebGL renderer changes when in headless mode
A proper anti-detect intercepts all of these. The profile, when driven by automation, looks identical to the same profile driven by a human.
Behavioural humaniser
Even with clean fingerprints, mouse-perfect automation flags. Use a humaniser:
- Afina Scenarios β built-in
- Manual β random delays, random BΓ©zier mouse paths
- Library β
playwright-extra-stealth(works but redundant on Afina)
Tips
- Set viewport before navigation, not after
- Use
context.set_extra_http_headersfor any custom headers, notpage.set_extra_http_headersβ context-level is more consistent - Wait for
networkidleinstead of fixed sleeps where possible - Don't use headless mode with anti-detect β defeats the purpose
Verification
After automating, run the resulting profile against iphey.com and demo.fingerprint.com. Should be all-green. If anything is off, your automation is fingerprinting.
Bottom line
Selenium / Playwright on a proper anti-detect (Afina, Octo, Multilogin) is automation-grade. Adding stealth plugins on top is unnecessary and sometimes counter-productive.