Skip to main content
Press the left mouse button on an element and keep it held down. Use it with hover() and mouseUp() to drag and drop:

element.mouseDown()

Moves the mouse to the point where find() located the element, then presses the left button. The button stays down until you call mouseUp(). It’s the same as element.click('mouseDown').
It takes no parameters.

Errors

Throws an ElementNotFoundError if find() didn’t locate the element. See click() for how to check found() first.

Press at coordinates

The client has no mouseDown() method. To press the button at a point on the screen, pass action: 'mouseDown' to testdriver.click():
Prefer the element methods, which keep working when the layout or screen size changes.

Examples

Reorder a list

Draw on a canvas

Complete example

tests/drag-and-drop.test.mjs