---
title: "press(forDuration:thenDragTo:)"
framework: xcuiautomation
role: symbol
role_heading: Instance Method
path: "xcuiautomation/xcuielement/press(forduration:thendragto:)"
---

# press(forDuration:thenDragTo:)

Initiates a press-and-hold gesture, then drags to another element.

## Declaration

```swift
func press(forDuration duration: TimeInterval, thenDragTo otherElement: XCUIElement)
```

## Parameters

- `duration`: The duration of the initial press-and-hold gesture.
- `otherElement`: The element over which to finish the drag. For example, when reordering table cells, this element is the reorder icon of the destination row.

## Discussion

Discussion This interaction is suitable for table-cell reordering and similar operations.

## See Also

### Tapping and pressing

- [tap()](xcuiautomation/xcuielement/tap().md)
- [doubleTap()](xcuiautomation/xcuielement/doubletap().md)
- [press(forDuration:)](xcuiautomation/xcuielement/press(forduration:).md)
- [press(forDuration:thenDragTo:withVelocity:thenHoldForDuration:)](xcuiautomation/xcuielement/press(forduration:thendragto:withvelocity:thenholdforduration:).md)
