Documentation
¶
Overview ¶
config.go
curve.go
human.go
keyboard.go
mouse.go
Index ¶
- type Config
- type Cursor
- func (c *Cursor) Click(el *rod.Element) error
- func (c *Cursor) ClickAndType(el *rod.Element, text string) error
- func (c *Cursor) ClickHold(el *rod.Element, holdMs int) error
- func (c *Cursor) DoubleClick(el *rod.Element) error
- func (c *Cursor) DragDrop(from, to *rod.Element) error
- func (c *Cursor) KeyCombo(modifiers []input.Key, key input.Key)
- func (c *Cursor) Move(el *rod.Element) error
- func (c *Cursor) MoveSteady(el *rod.Element) error
- func (c *Cursor) MoveToPoint(x, y float64)
- func (c *Cursor) Pos() (float64, float64)
- func (c *Cursor) PressKey(key input.Key)
- func (c *Cursor) RightClick(el *rod.Element) error
- func (c *Cursor) Scroll(deltaX, deltaY float64)
- func (c *Cursor) Type(text string)
- func (c *Cursor) TypeWithSpeed(text string, minDelayMs, maxDelayMs int)
- type Option
- func Beginner() Option
- func Casual() Option
- func Direct() Option
- func Fast() Option
- func Swift() Option
- func WithClickTiming(holdMin, holdMax, dwellMin, dwellMax int) Option
- func WithConfig(cfg Config) Option
- func WithDirect(on bool) Option
- func WithHesitation(chance float64) Option
- func WithMicroPause(chance float64) Option
- func WithSteadiness(s float64) Option
- func WithThinkPause(chance float64) Option
- func WithTypingSpeed(minMs, maxMs int) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Direct bypasses all human-like mouse movement, click timing, and
// keystroke delays. When true, interactions use rod's native element
// methods directly. It will also use JS-based versions of some methods to avoid issues in headless mode.
Direct bool
// Hesitation is the probability of pausing before mouse movement (0-1).
Hesitation float64
// MicroPause is the probability of a brief pause mid-movement (0-1).
MicroPause float64
// Steadiness controls curve straightness (0 = wobbly, 1 = straight).
Steadiness float64
// ClickHold is the [min, max] ms to hold a mouse button during click.
ClickHold [2]int
// ClickDwell is the [min, max] ms to pause after a click.
ClickDwell [2]int
// TypeDelay is the [min, max] ms between keystrokes.
TypeDelay [2]int
// ThinkPause is the probability of a longer pause while typing (0-1).
ThinkPause float64
}
Config controls cursor timing and behavior.
type Cursor ¶
type Cursor struct {
// contains filtered or unexported fields
}
Cursor wraps a rod.Page and tracks the virtual cursor position.
func (*Cursor) ClickAndType ¶ added in v1.0.2
ClickAndType clicks on an element, clears any existing value, then types the given text with human-like keystroke timing.
func (*Cursor) DoubleClick ¶
DoubleClick moves to the element and double-clicks.
func (*Cursor) MoveSteady ¶
MoveSteady moves to the element with a straight trajectory.
func (*Cursor) MoveToPoint ¶
MoveToPoint moves the cursor to exact coordinates.
func (*Cursor) RightClick ¶
RightClick moves to the element and right-clicks.
func (*Cursor) TypeWithSpeed ¶
TypeWithSpeed types text with custom per-key delay range in milliseconds.
type Option ¶
type Option func(*Config)
Option configures a Cursor.
func Beginner ¶
func Beginner() Option
Beginner returns a configuration with more human-like imperfections.
func Direct ¶ added in v1.0.4
func Direct() Option
Direct returns a configuration that bypasses all human-like simulation.
func Swift ¶
func Swift() Option
Swift returns a configuration that is faster than average but still human-like.
func WithClickTiming ¶
WithClickTiming sets click hold and post-click dwell ranges in ms.
func WithDirect ¶ added in v1.0.4
WithDirect sets the direct mode flag.
func WithHesitation ¶
WithHesitation sets the pre-move pause probability (0-1).
func WithMicroPause ¶
WithMicroPause sets the mid-move pause probability (0-1).
func WithSteadiness ¶
WithSteadiness sets curve straightness (0 = wobbly, 1 = straight).
func WithThinkPause ¶
WithThinkPause sets the probability of longer pauses while typing (0-1).
func WithTypingSpeed ¶
WithTypingSpeed sets the per-key delay range in ms.