Skip to content

Lib.moveMouse method

Lib › moveMouse

Moves the mouse pointer to the given web-contents coordinates using a **trusted** Electron pointer move.

A trusted move (injected via Electron's webContents.sendInputEvent) updates the real pointer state in the CSS engine, so :hover rules genuinely apply — unlike dispatchEvent(new MouseEvent('mouseover')), which is untrusted and never sets :hover. It targets the single shared window's **global** pointer, so only one element is hovered at a time.

This is the low-level primitive: it performs a single move and does **not** wait for any state to settle (callers poll their own readiness signal). Prefer Lib.hoverElement / Lib.unhoverElement for element-relative moves; use moveMouse directly when an element-relative target does not fit (e.g. an element spanning the full viewport width).

Synchronous: injecting the trusted move does no real awaiting, so the caller does not need to await it.

Signature:

moveMouse(this: void, params: MoveMouseParams): void

Parameters:

ParameterTypeDescription
thisvoid
paramsMoveMouseParamsThe web-contents DIP coordinates to move to.

Returns: void