← ClaudeAtlas

testdrivermouse-downlisted

Press the mouse button without releasing it
testdriverai/testdriverai · ★ 243 · Testing & QA · score 72
Install: claude install-skill testdriverai/testdriverai
<!-- Generated from mouse-down.mdx. DO NOT EDIT. --> ## Overview The `mouseDown()` method pushes the mouse button at the location of an element. It does not release the button. Use this for drag operations, custom gestures, or when you need precise control of the mouse events. You can call it on an [`Element`](/core-concepts/elements) instance. Or you can use it with a selector. ## Syntax ```javascript // Mouse down on an element await element.mouseDown(); // Mouse down using a selector await ai.mouseDown('selector'); ``` ## Parameters When called on an `Element`, no parameters are required. When called directly on the AI client: | Parameter | Type | Description | |-----------|------|-------------| | `selector` | `string` | The selector describing the element where the mouse button should be pressed | ## Returns It returns a `Promise<void>`. The promise resolves when TestDriver pushes the mouse button. ## Examples ### Basic Drag Operation ```javascript // Start dragging an item const dragItem = await ai.find('file to drag'); await dragItem.mouseDown(); // Move to drop target const dropTarget = await ai.find('folder to drop into'); await dropTarget.hover(); // Release await ai.mouseUp(); ``` ### Drag and Drop with Direct Selectors ```javascript await ai.mouseDown('draggable card'); await ai.hover('drop zone'); await ai.mouseUp(); ``` ### Selecting Multiple Items ```javascript import { test } from 'vitest'; import { chrome } from '@testdriver/sdk'; test('se