Skip to main content

Crate veilus_human_input

Crate veilus_human_input 

Source
Expand description

Human-like input for browser automation: mouse paths, wheel scrolling and typing rhythm.

Every function is pure: it takes the parameters and a random number generator and returns points, deltas or durations. Sending them (CDP, WebDriver, OS events) is the caller’s job, so the crate has no I/O and no async runtime, and a seeded RNG makes every result reproducible.

use rand::{rngs::StdRng, SeedableRng};
use veilus_human_input::{keyboard, mouse};

let mut rng = StdRng::seed_from_u64(7);
let params = mouse::MouseParams::default();
let steps = mouse::path((40.0, 40.0), (600.0, 320.0), 80.0, &params, &mut rng);
assert_eq!(steps.last().map(|s| (s.x, s.y)), Some((600.0, 320.0)));

let keys = keyboard::timings("hello", &keyboard::TypingParams::default(), &mut rng);
assert_eq!(keys.len(), 5);

The Default parameter sets are reasonable starting points, not a measurement of any particular person. Tune them for your own use.

Modules§

keyboard
Typing rhythm and US keyboard layout.
mouse
Mouse paths and click timing.
wheel
Mouse-wheel scrolling.