function getRandomInt(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } // CDP Input.dispatchMouseEvent creates MouseEvent where // .screenX/.screenY equal .clientX/.clientY. Cloudflare Turnstile detects // this (Chromium issue 40280325). Patch with realistic screen coords. // Source: ObjectAscended/CDP-bug-MouseEvent-.screenX-.screenY-patcher // Ported from ReinerBRO/grok-register + Git-creat7/grokRegister-cpa. // old method wouldn't work on 4k screens let screenX = getRandomInt(800, 1200); let screenY = getRandomInt(400, 600); Object.defineProperty(MouseEvent.prototype, "screenX", { value: screenX }); Object.defineProperty(MouseEvent.prototype, "screenY", { value: screenY }); // Best-effort: also cover PointerEvent if present (CF may read either). try { if (typeof PointerEvent !== "undefined" && PointerEvent.prototype) { Object.defineProperty(PointerEvent.prototype, "screenX", { value: screenX }); Object.defineProperty(PointerEvent.prototype, "screenY", { value: screenY }); } } catch (e) {}