> ## Documentation Index
> Fetch the complete documentation index at: https://momentic.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# mouseDrag

> Drag the mouse a relative delta from an origin.

Lower-level companion to `dragAndDrop`. Specify an origin (default: the current
pointer position) and a relative `delta` in pixels.

## Parameters

| Parameter | Type                 | Required | Description                                                                                     |
| --------- | -------------------- | -------- | ----------------------------------------------------------------------------------------------- |
| `delta`   | `string \| { x, y }` | Yes      | Relative pixel delta from the origin. Either `x, y` string or `{ x, y }` object.                |
| `from`    | `string`             | No       | Description of the origin element.                                                              |
| `css`     | `string`             | No       | CSS selector for the target. Use instead of the description key.                                |
| `coords`  | `string \| { x, y }` | No       | Absolute viewport coordinates. Either an `x, y` string (e.g. `120, 40`) or a `{ x, y }` object. |
| `x`       | `number \| string`   | No       | X coordinate. Must be provided together with `y`.                                               |
| `y`       | `number \| string`   | No       | Y coordinate. Must be provided together with `x`.                                               |
| `force`   | `boolean`            | No       | Force the action even when the element is not actionable.                                       |
| `iframe`  | `string`             | No       | URL or URL pattern of the iframe that contains the target element.                              |
| `steps`   | `number`             | No       | Number of mouse-move steps to interpolate.                                                      |
| `saveAs`  | `string`             | No       | Name of the variable to write this step's return value to.                                      |
| `retries` | `number`             | No       | Number of times to retry the step on failure before failing the test.                           |
| `skipped` | `boolean`            | No       | Skip this step at execution time.                                                               |

## Shorthand

`delta` as `x, y` from the current pointer position.

```yaml theme={null}
- mouseDrag: 200, 0
```

## Examples

```yaml theme={null}
- mouseDrag:
    delta:
      x: 11
      y: 22
```

```yaml theme={null}
- mouseDrag:
    from: the slider thumb
    delta: 200, 0
    steps: 20
```

## Related

* [Finding elements](/core-concepts/finding-elements)
* [Test format](/core-concepts/test-format)
