Core API
type()
Simulates human-like typing in input fields.
type(selector: string | Element, text: string, options?: { delay?: number })
Automates keyboard typing sequentially with randomized human-like delays into HTML <input> and <textarea> elements.
It first clicks to focus the element, pushes text into .value, and fires input events automatically tracking each character to behave like a realistic interaction timeline.
Use Cases
- Typing into a text input: Simulating step-by-step how to fill out a form (e.g., login or registration).
- Typing a keyword into a search box: Showing users the autocomplete functionality or instant search results of your app.
Options
| Property | Type | Default | Description |
|---|---|---|---|
delay | number | 100 | Base millisecond delay injected between character strokes. |
Example
const cursor = new Cursor();
cursor
.hover('#username-field')
.type('#username-field', 'hello@cursor.js', { delay: 60 });