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

# press(forDuration:)

Sends a press-and-hold gesture to a hittable point the system computes for the element, holding for the duration you specify.

## Declaration

```swift
func press(forDuration duration: TimeInterval)
```

## Parameters

- `duration`: The duration of the press, in seconds.

## Discussion

Discussion If the element exists within a scrollable view but is offscreen, XCTest attempts to scroll the element onscreen before performing the press.

## See Also

### Tapping and pressing

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