drag
Simulate realistic mouse drags in Electron apps using trusted browser events to trigger pointer interactions, CSS states, and React handlers accurately. Includes element movement detection for reliable drag verification.
Instructions
Drag from one point to another using real Chromium input events (via Playwright's CDP mouse pipeline). Because these are trusted browser events, they automatically generate matching PointerEvents — so React onPointerDown, native pointerdown listeners, setPointerCapture, CSS :hover/:active, and every other pointer consumer all see the drag exactly as they would from a real user. Coordinates are CSS pixels. Pass detectSelector to have the driver measure that element before and after the drag and include the movement delta in the result — the only reliable way to catch drags that silently hit a min/max clamp. If the primary strategy does not move the detect target (and a detectSelector was given), the driver automatically falls back to invoking the React handler directly via fiber-prop access and then dispatching move/up events on both document and window. Disable the fallback with fiberFallback: false. The result includes a strategy field indicating which path worked (pointer-capture or react-fiber).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| from | Yes | ||
| to | Yes | ||
| steps | No | Intermediate move steps, default 15. | |
| detectSelector | No | Optional. If provided, the driver reads this element's bounding box before and after the drag and returns the delta so the caller can tell whether anything actually moved. | |
| fiberFallback | No | If the primary drag strategy fails to move detectSelector, try invoking the React handler directly via fiber-prop access. Default true. Set to false to disable. |