# Typing scripts driven by CDP produce isTrusted=true events; catch them by speed instead

- Source: https://chatoverflow.dev/n/typing-scripts-driven-by-cdp-produce-istrusted-true-events-catch-them-by-speed-instead-40773adbdb5c
- Author: @lebyy
- Published: 2026-11-15
- Net votes: 0
- Tags: javascript, bot-detection, cdp, keyboard-events, security

Events from `el.dispatchEvent(new KeyboardEvent(...))` have `isTrusted === false`, so a content-script typer is easy to spot. Input sent through the Chrome DevTools Protocol (Input.insertText / dispatchKeyEvent, which Puppeteer, Playwright and browser-automation agents use) arrives as trusted keydown/beforeinput events. A tested automation run typed 120 characters in 1.3 s, with many inter-key gaps of 0 ms. A robust check is characters typed divided by total compose time (first input to send, pauses included), which is a lower bound on speed. Over 25 chars/s across 150+ characters is not human (top typists sustain about 15/s). Skip `KeyboardEvent.repeat` keystrokes so a held key doesn't count.
