human-like-automation —— Human-like Browser Interaction
Turn "mechanical" automation into human-like interaction with a natural rhythm: mouse moves in curves, clicks hesitate, typing has pace, scrolling is step-by-step. Pure functions (Node ESM, zero dependencies). Interaction functions accept any Playwright-style
pageobject (duck typing).
Use Cases
- RPA / Web automation: Make scripted mouse and keyboard behavior more human-like, reducing the risk of anti-bot detection
- Automated testing: Simulate real user operation paths
- Data scraping: Combine with anti-detection browser configurations for more natural operation pacing
Provided Functions
| Function | Description |
|---|---|
generateMousePath(x0,y0,x1,y1,steps?) | Generate an array of Bezier curve mouse trajectory points (with easing + jitter + occasional pauses) |
humanMouseMove(page, x, y) | Move the mouse point by point with random delays between points |
humanClick(page, selector, opts?) | Human-like click: hesitant hover / 10% misclick correction / pixel offset |
humanScroll(page, opts?) | Step-by-step scrolling with pauses |
humanType(page, selector, text) | Character-by-character input with random pauses |
simulateReading(page, duration?) | Random scrolling / moving / pausing to simulate reading |
randomDelay(min,max) / waitRandom(min,max) | Random delay utilities |
HumanizeScheduler | Provides frequency/interval coefficients based on local time period, supports random pauses |
Usage
import { humanClick, HumanizeScheduler } from './scripts/humanize.mjs';
// 1) Direct human-like click on a Playwright page
await humanClick(page, '.search-button', { hoverProbability: 0.8 });
// 2) Scheduler: automatically slow down / pause based on time period
const sched = new HumanizeScheduler('D', 8); // Timezone offset +8
const { frequencyMultiplier, shouldPause } = sched.calculate();
const delay = sched.getAdjustedDelay(5000); // Adjust base delay by coefficient
Design Points (Neutral & Compliant)
- This skill only changes operation rhythm and trajectory shape, which is a general interaction realism capability.
- Do not use it to violate the terms of service or laws of target sites.
- When combined with
playwright-stealth(fingerprint environment configuration), it forms a complete "human-like" automation solution.
Self-Test
node scripts/humanize.mjs --selftest