← ClaudeAtlas

testdrivermouse-downlisted

Press the mouse button without releasing it
testdriverai/testdriverai · ★ 242 · Testing & QA · score 71
Install: claude install-skill testdriverai/testdriverai
<!-- Generated from mouse-down.mdx. DO NOT EDIT. --> ## Overview The `mouseDown()` method presses the mouse button at an element's location without releasing it. This is useful for drag operations, custom gestures, or when you need precise control over mouse events. You can either call it on an [`Element`](/v7/core-concepts/elements) instance or use it directly 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 Returns a `Promise<void>` that resolves when the mouse button is pressed. ## 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('selects multiple item