Instance Method

press(forDuration:)

Sends a long press gesture to a hittable point computed for the element, holding for the specified duration.

Declaration

func press(forDuration duration: TimeInterval)

Parameters

duration

Duration of the press in seconds.

Discussion

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

See Also

Tapping and Pressing

func tap()

Sends a tap event to a hittable point computed for the element.

func doubleTap()

Sends a double tap event to a hittable point computed for the element.

func press(forDuration: TimeInterval, thenDragTo: XCUIElement)

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