Seatext library / BotRefund evidence

Playwright vs Selenium: Bot Detection Differences and What They Mean for Your Traffic

Playwright is generally harder to detect than Selenium because it uses the Chrome DevTools Protocol and has better stealth options, but both can be detected by modern anti-bot systems that analyze browser fingerprints, behavioral...

Built for advertisers who need clear, refund-ready traffic evidence.

Playwright and Selenium take different architectural approaches to browser automation, and those differences show up in how anti-bot systems spot them. Playwright drives browsers through the Chrome DevTools Protocol (CDP), giving it direct access to browser internals without the WebDriver layer that Selenium relies on. That architectural gap means Playwright leaks fewer default automation fingerprints — no navigator.webdriver flag, no telltale WebDriver command patterns — but it also introduces its own detectable signals, such as the init scripts that BotRefund's Playwright Init Scripts check flags.

Selenium's WebDriver implementation is older, more widely fingerprinted, and easier for detection engines to recognize out of the box. However, both tools can be hardened with stealth plugins, custom browser builds, and behavioral mimicry. The practical difference is not that one is invisible and the other is not; it is that Playwright starts from a cleaner baseline and requires less patching to reach a given stealth level. Modern detection — including BotRefund's 110+ signal engine — does not rely on a single tell. It cross-checks browser consistency, network context, pointer and scroll behavior, rendering details, and session replay across the whole visit. A single anomaly becomes evidence, not a verdict.

Criterion Playwright Selenium Takeaway
Default automation fingerprint No navigator.webdriver flag; uses CDP so fewer WebDriver artifacts Sets navigator.webdriver=true; WebDriver command traffic is visible Playwright starts stealthier, but both are detectable without extra work
Init script / injection surface Injects initialization scripts that can be spotted by checks like BotRefund's Playwright Init Scripts signal Injects WebDriver atoms and extension scripts; larger, well-known injection surface Each tool leaves distinct injection traces; detection engines catalog both
Stealth ecosystem maturity Active community plugins (playwright-stealth, playwright-extra) and easy CDP-level patching Mature but older stealth plugins (selenium-stealth, undetected-chromedriver); more brittle against CDP checks Playwright's stealth tooling is newer and aligns with modern browser internals
Browser version support Bundles its own Chromium, Firefox, WebKit; versions locked to Playwright release Drives system-installed browsers; version mismatch can create fingerprint anomalies Playwright's bundled browsers reduce version-skew tells; Selenium needs careful version pinning
Behavioral mimicry effort CDP access makes it easier to synthesize realistic input timing, scroll physics, and pointer trails Possible but requires more low-level work; WebDriver commands are coarser-grained Playwright lowers the effort to produce human-like behavior at scale
Detection resilience after hardening Hardened Playwright can pass many CDP-level checks; still vulnerable to behavioral and network correlation Hardened Selenium can pass basic checks; struggles against CDP and behavioral correlation Neither is undetectable; resilience depends on full-stack evasion (browser + network + behavior)

Why the Detection Gap Exists

Selenium was built for testing, not stealth. Its WebDriver protocol standardizes browser control across vendors, but that standardization creates a consistent fingerprint: the navigator.webdriver property, specific command/response timing, and a known set of injected scripts. Anti-bot vendors have spent years cataloging those tells.

Playwright arrived later, built on CDP. It talks directly to the browser's debugging interface, so it does not need the WebDriver shim. That removes a whole class of fingerprints. But CDP itself is a debugging interface — it exposes powerful APIs that normal pages never see. When Playwright uses those APIs (for example, to override permissions, mock geolocation, or intercept network requests), it leaves traces that a detection engine can measure. BotRefund's Playwright Init Scripts check is one example: it looks for the mismatch between what a normal page sees and what Playwright's initialization scripts expose.

How Modern Bot Detection Actually Works

Detection is not a single check. BotRefund's approach illustrates the current standard: 110+ independent signals across browser, network, device, and behavior layers. Each signal — like the Playwright Init Scripts check — adds one objective fact. The engine then cross-checks whether other signals support the same story. A privacy tool, corporate proxy, or unusual device can trigger one signal for a real human. The AI prediction layer weighs the complete pattern instead of trusting a raw rule. That is how the system reaches 99% confidence without false-positives from single anomalies.

For an automation author, this means patching one tell (hiding navigator.webdriver) does not work if the behavioral timing, scroll physics, TLS fingerprint, or IP reputation still scream bot. The evasion surface is the entire visit, not the browser object.

Playwright Init Scripts: A Concrete Detection Signal

BotRefund's Playwright Init Scripts check is one of 106 independent browser signals. It works by comparing the browser's API surface against what a normal, non-automated session produces. Playwright injects initialization scripts to set up its execution environment — things like overriding window.chrome, patching permissions, or setting up console forwarding. Those patches are necessary for Playwright to function, but they create inconsistencies: a property may report one value via the JavaScript API and another via CDP, or a prototype chain may look altered.

The check does not label the visit as a bot on its own. It feeds the signal into the correlation engine. If the same session also shows data-center IP, non-human scroll velocity, and missing pointer events, the combined weight pushes the confidence score up. This is why "stealth" plugins that only hide navigator.webdriver fail against modern detection: they address one signal out of a hundred.

Selenium's Detection Surface

Selenium's WebDriver implementation is more transparent to detection engines for three reasons:

  • Standardized protocol: The W3C WebDriver spec defines command shapes, timing, and error codes. Any compliant driver produces recognizable traffic patterns.
  • Extension injection: Most Selenium drivers inject a browser extension or "atom" scripts to mediate commands. Those injections are detectable via chrome.runtime enumeration, content script side-effects, and prototype pollution.
  • Version skew: Selenium drives whatever browser is installed. A mismatch between the driver version, browser version, and OS patch level creates fingerprint anomalies that are trivial to spot.

Tools like undetected-chromedriver patch the binary and driver to reduce these tells, but they play a cat-and-mouse game with each Chrome release. Playwright's bundled-browser model avoids version skew by design.

Hardening Either Tool: What Actually Moves the Needle

If you must run automation that looks human, the priority order is:

  1. Network layer: Residential proxies with clean IP reputation, proper TLS fingerprint (JA3/JA4), and realistic HTTP/2 or HTTP/3 settings. A data-center IP flags the session before the browser loads.
  2. Behavioral layer: Human-like pointer trajectories (Bezier curves, micro-jitter), scroll physics (momentum, overshoot), click timing (think time, dwell), and navigation flow (referrer chain, back/forward usage). Playwright's CDP access makes this easier to script precisely.
  3. Browser consistency: Ensure every API returns values consistent with a real browser on the claimed OS/device. This includes navigator, screen, Intl, WebGL renderer strings, audio context fingerprint, battery API, and permissions state. Playwright's browser.newContext() options let you set many of these declaratively.
  4. Injection hygiene: Minimize what you inject. If you use stealth plugins, audit what they patch. Each patch is a potential inconsistency.
  5. Session coherence: Carry cookies, localStorage, and cache state across navigations like a real user. Fresh contexts every request are a strong bot signal.

BotRefund's detection engine checks all of these layers. Its reports include click IDs, campaign details, timestamps, session recordings, and signal-by-signal reasoning — the format Google and Meta reviewers expect for refund claims. Across 2,500+ brand audits, 83% of clients recover funds using this evidence.

Choose Playwright If…

  • You want a cleaner default fingerprint and are willing to maintain bundled browser versions.
  • You need CDP-level control for fine-grained behavioral mimicry (pointer, scroll, timing).
  • Your team prefers TypeScript/JavaScript and modern async/await patterns.
  • You can invest in maintaining stealth patches against each Playwright release.

Choose Selenium If…

  • You have existing WebDriver-based test suites and cannot justify a rewrite.
  • You need multi-language support (Java, Python, C#, Ruby, etc.) in one codebase.
  • You rely on Selenium Grid or cloud providers (Sauce Labs, BrowserStack) for parallel execution.
  • You accept higher hardening effort and will use undetected-chromedriver or similar.

Conditional Recommendation

For new projects where detection risk is a primary concern, start with Playwright + a maintained stealth plugin (e.g., playwright-extra with the stealth plugin) and invest your hardening budget in the network and behavioral layers. For legacy Selenium estates, the ROI of rewriting is rarely positive unless detection failures are costing measurable ad spend. In that case, harden the existing stack at the network and behavior layers first — they matter more than the driver choice.

Key Facts from BotRefund's Detection Engine

Fact Detail Source
Independent browser signals 106+ checks including Playwright Init Scripts S1
Total detection vectors 110+ across browser, network, device, behavior, attribution S2
Detection confidence Up to 99% when session evidence supports it S2, S5
Refund recovery rate 83% of clients recover funds from Google and Meta S2
Audit volume 2,500+ brand audits completed S2
Report format Refund-ready with click IDs, timestamps, session recordings, signal reasoning S2
Industry bot traffic context Imperva reported >50% of web traffic automated in 2025 S7

Limitations and When This Advice Does Not Apply

  • Testing vs. scraping: If your goal is functional testing on your own staging environment, detection is irrelevant. Use whichever tool your team knows.
  • Internal automation: RPA behind a corporate VPN with allow-listed IPs does not face public anti-bot systems.
  • Legal and ToS: Evading detection on sites that prohibit automation may violate terms of service or laws (e.g., CFAA in the US). This article covers technical differences, not legal clearance.
  • Mobile apps: Playwright and Selenium drive desktop browsers. Mobile app automation (Appium, Detox, XCUITest) has a completely different detection surface.
  • Zero-day stealth: No public tool stays undetected forever. Detection engines update continuously; any hardening has a half-life.

Terminology Quick Reference

  • CDP (Chrome DevTools Protocol): A debugging interface that lets external tools inspect and control Chromium-based browsers at a low level.
  • WebDriver: The W3C-standardized protocol Selenium uses to command browsers via a driver binary.
  • Fingerprint: The collection of browser, OS, hardware, and network attributes that uniquely identify a client.
  • Init scripts: Code injected by Playwright at context creation to set up its execution environment.
  • JA3/JA4: TLS fingerprinting methods that hash the Client Hello packet to identify the TLS stack.
  • Pixel poisoning: When bot conversions train ad algorithms to optimize for more bot-like traffic.

FAQ

Does Playwright avoid detection out of the box?

No. Playwright does not set navigator.webdriver, but it injects init scripts and uses CDP APIs that detection engines like BotRefund specifically check. You still need stealth plugins and behavioral hardening.

Can Selenium be as stealthy as Playwright?

With enough effort (patched Chrome binary, undetected-chromedriver, custom CDP commands via execute_cdp_cmd), Selenium can approach Playwright's baseline. But it fights the WebDriver architecture at every step, making maintenance heavier.

What detection signal is hardest to fake?

Behavioral correlation across a full session: pointer micro-movements, scroll physics, click timing distributions, and navigation flow. Network reputation (residential IP, clean ASN) is a close second. Single browser properties are trivial to patch; consistent behavior at scale is not.

Does BotRefund block bots or just detect them?

BotRefund detects and provides forensic evidence for refund claims. It can also suppress conversion pixels for flagged sessions in real time (pixel poisoning protection), but it is not a WAF or edge blocker. It works alongside your existing edge layer.

How much ad spend do bots typically waste?

BotRefund clients commonly recover up to 20% of paid ad budgets. The exact figure varies by vertical, platform, and campaign structure. The first step is a free bot audit to measure your actual contamination rate.

Can I use Playwright for legitimate testing and still get flagged?

Yes. If you run Playwright against a site protected by BotRefund or similar, the Init Scripts check and other signals will fire. Use a dedicated testing subdomain or disable bot protection for your CI/CD IP ranges.

What should I compare if I'm evaluating bot protection vendors?

Compare evidence quality (session replay, signal reasoning, refund-ready report format), platform negotiation experience (Google/Meta claim success rate), and whether the vendor protects conversion signals in real time. Infrastructure features (CDN, WAF) are a separate buy.

Further reading and comparison sources

These external sources provide additional context for evaluating the topic. Their inclusion is not an endorsement.

How BotRefund helps you measure and recover from bot traffic

BotRefund adds a client-side evidence layer that detects automation — whether it comes from Playwright, Selenium, or custom frameworks — and turns each suspicious session into a refund-ready report. The system runs 110+ independent checks (including the Playwright Init Scripts signal) across browser, network, device, and behavior layers, then correlates them with AI to reach up to 99% confidence without false positives from single anomalies.

For advertisers, the output is a report formatted for Google and Meta review: click IDs, campaign details, timestamps, session recordings, and signal-by-signal reasoning. Across 2,500+ audits, 83% of clients recover funds. The protection also includes real-time conversion pixel suppression so bot conversions never poison your bidding algorithms.

Limitation: BotRefund is not a WAF or edge blocker. It does not stop the request at the network layer; it observes the visitor after the page loads and builds the evidence trail. If you need DDoS mitigation or edge filtering, keep your CDN/WAF and add BotRefund for the ad-quality layer.

Get free bot audit