Skip to content

feat(browser): type() anti-detect — probabilistic paste branch for long text#9

Merged
iWedmak merged 1 commit into
masterfrom
feature/type-paste-antidetect
Jul 6, 2026
Merged

feat(browser): type() anti-detect — probabilistic paste branch for long text#9
iWedmak merged 1 commit into
masterfrom
feature/type-paste-antidetect

Conversation

@iWedmak

@iWedmak iWedmak commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Task 4109.

Browser.type(text, selector=...) probabilistically routes long text through the real-clipboard paste path (from 4091/4098) when BOTH gates pass:

  • len(text) > TYPE_PASTE_MIN_CHARS (500)
  • random() < TYPE_PASTE_PROBABILITY (0.625)

Otherwise falls through to per-char Ceki.typeText. Short text, no-selector calls, and the ~37.5% "keep humanized" case stay on the existing path. Constants at module scope.

paste() and the new branch share a private _hotkey_paste_into() helper — zero duplication. copy/paste (hotkey version) is already on master via #7; this PR only adds the type() anti-detect branch.

Test plan

  • tests/test_type_paste_branch.py 12/12 — paste-path gates, constant values, hotkey wire sequence, JSON-escape, statistical sanity
  • tests/test_copy_paste.py 11/11 still green (no regression)
  • ruff clean
  • reviewer: live smoke on real rental Chrome — long text fires a single paste event with insertFromPaste, short text stays per-char

Perfect per-key rhythm on a long string is a classic bot signal.
Route type(text, selector=...) through the real-clipboard paste path
(from the previous release) when the input passes both gates:

  len(text) > TYPE_PASTE_MIN_CHARS (500) AND random() < TYPE_PASTE_PROBABILITY (0.625)

Short text, no-selector calls, and the ~37.5% "keep humanized" case
stay on the existing per-char Ceki.typeText path. paste() and the new
type() branch share a private _hotkey_paste_into() helper — zero
duplication.

Minor bump to 2.35.0.
@iWedmak
iWedmak merged commit a3c729e into master Jul 6, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant