[Feature] Companion package for behavioral bot detection: cloakbrowser-human
Hey! This is a companion package, not a replacement — CloakBrowser remains the core, this just adds a behavioral layer on top. It's also a temporary community-built solution while we wait for native behavioral humanization in CloakBrowser. It works now and passes current detection benchmarks, but the proper long-term fix belongs in the CloakBrowser binary itself — especially for signals like coalesced pointer events that can't be fully addressed from a JS wrapper.
Problem
CloakBrowser handles fingerprint-based detection perfectly — WebDriver, CDP, headless flags, GPU inconsistencies. But some sites now analyze behavioral signals: mouse movement patterns, typing speed, click coordinates, scroll velocity. Plain Playwright calls produce instant, straight-line interactions that get flagged.
Solution
cloakbrowser-human — a drop-in wrapper that replaces Playwright methods with human-like implementations. Change one import line, everything else stays the same.
// Before
import { launch } from 'cloakbrowser';
// After
import { launch } from 'cloakbrowser-human';
What it does
- Mouse: Bezier curves with easing, wobble, burst patterns, 15% overshoot chance
- Keyboard: Full keydown/hold/keyup per character, Shift wrapping, random "thinking" pauses
- Scroll: mouse.wheel() with accelerate → cruise → decelerate pattern
- Clicks: Realistic aim points (left third for inputs, center for buttons), mousedown/hold/mouseup timing
- Coalesced events patch (experimental)
Test results
Demo
| Without wrapper (bot) | With wrapper (human) |
![]() |
![]() |
Without wrapper: isBot: true, suspiciousClientSideBehavior: true, superHumanSpeed: true
With wrapper: isBot: false — all 23 detection flags return false.
Install
npm install cloakbrowser-human
pip install cloakbrowser-human
Works with JS and Python. Two presets: default (normal speed) and careful (slower, more deliberate).
What can't be fixed from a wrapper
Coalesced pointer events: human average is 2.7 points per event, CDP produces exactly 1. The current JS patch via page.evaluate() fabricates fake points but advanced anti-fraud can detect it via toString(), cross-origin iframes, or web workers. A real fix requires a Chromium source patch in pointer_event_manager.cc.
Full docs and demo: https://github.com/evelaa123/cloakbrowser-human
Happy to discuss and collaborate!
This is great work. Clean architecture, smart design (storing originals before patching, shared cursor per context), and it solves a real gap.
We're already planning to add input-level fixes in upcoming binary builds — coalesced pointer events, event timestamp jitter, and pointer pressure defaults. These are signals that CDP can't produce correctly from JS, so they have to live in the binary.
But the behavioral layer — mouse curves, typing cadence, scroll patterns — is exactly the right complement on top, and it works today without waiting for the binary update.
Rather than two separate packages, would you be interested in contributing this directly into cloakbrowser? Both JS and Python. One package, one install:
const browser = await cloakbrowser.launch({ humanize: true });
browser = cloakbrowser.launch(humanize=True)
End users get fingerprint stealth + behavioral humanization out of the box without juggling two packages. Full credit in the changelog and git history.
Let us know what you think.
Thanks for the offer — I'm in.
Behavioral layer (JS + Python):
- Mouse: Bézier curves with easing, wobble, burst pauses, ~15% overshoot with correction
- Keyboard: per-character keydown/hold/keyup, Shift wrapping, random thinking pauses
- Scroll: wheel events with accelerate → cruise → decelerate pattern
- Click targeting: realistic aim points (left third for inputs, center for buttons), hold timing
- Config: two presets (
default,careful), full parameter overrides
Integration approach:
humanize: trueflag inlaunch()/launch_context()activates patching- Originals stored in
page._originalfor direct access when needed newPage()delegates tonewContext()internally (avoids slow CDP round-trips — was a 60x speedup in testing)- Coalesced events patch injected via
page.evaluate()aftergoto()as a temporary measure until the binary fix lands
Out of scope (for the binary team):
- Coalesced pointer events (
pointer_event_manager.cc) - Event timestamp jitter
- Pointer pressure defaults
Test results (deviceandbrowserinfo.com):
- Without humanize:
isBot: true,suspiciousClientSideBehavior: true,superHumanSpeed: true - With humanize:
isBot: false, all 23 flagsfalse
Let me know the target branch and preferred directory structure (human/, humanize/, etc.) and I'll open a PR.
Based on the repo structure, I'd suggest placing the behavioral layer in cloakbrowser/human/ (Python) and js/src/human/ (TypeScript), then wiring humanize: true into the existing launch() in __init__.py and js/src/index.ts. Happy to adjust if you prefer a different layout.
Sounds good. Target branch: main. Directory structure as you suggested:
cloakbrowser/human/(Python)js/src/human/(TypeScript)
Wire humanize into the existing launch() / launch_async() in both wrappers. Looking forward to the PR.
Two things to include in the PR:
-
page.fill()interception — many users usefill()instead oftype(). It should redirect to the humanizedtype(), otherwise it bypasses humanization silently. -
Idle micro-movements —
humanIdle()exists in your code but isn't wired into the page patch. Real users have small drift between actions. Maybe opt-in via config since it adds latency.
Integrated directly into cloakbrowser by @evelaa123 in #30. The latest binary release (v145.0.7632.159.3) also ships CDP input stealth patches that complement the behavioral layer — binary handles low-level event signals, humanize handles high-level behavior. Thanks for the proposal and implementation!

