INNER CODE UNIT · TypeScript

humanClickFn

CloakHQ/CloakBrowser · js/src/human/index.ts:277

  const humanClickFn = async (selector: string, options?: HumanActionOptions & { _skipChecks?: boolean }) => {
    await ensureCursorInit();
    const callCfg = mergeConfig(cfg, options?.human_config ?? options);
    const timeout = options?.timeout ?? 30000;
    const force = options?.force ?? false;
    const skipChecks = (options as any)?._skipChecks ?? false;
    const deadline = Date.now() + timeout;
    const remainingMs = () => Math.max(0, deadline - Date.now());

    if (!force && !skipChecks) {
      await ensureActionable(page, selector, CHECKS_CLICK, remainingMs(), force);
    }
    if (callCfg.idle_between_actions) {
      await humanIdle(raw, cursor.x, cursor.y, callCfg);
    }
    const { box, cursorX, cursorY, didScroll } = await scrollToElement(page, raw, selector, cursor.x, cursor.y, callCfg, remainingMs());
    cursor.x = cursorX;
    cursor.y = cursorY;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…