click(forDuration:thenDragTo:withVelocity:thenHoldForDuration:)
Clicks and holds an element for a duration, drags it at a velocity, and holds it over another element for a duration, all of which you specify.
Declaration
func click(forDuration duration: TimeInterval, thenDragTo otherElement: XCUIElement, withVelocity velocity: XCUIGestureVelocity, thenHoldForDuration holdDuration: TimeInterval)Parameters
- duration:
The duration of the initial click and hold.
- otherElement:
The element over which to finish the drag.
- velocity:
The speed at which to move from the initial click position to the other element, expressed in pixels per second.
- holdDuration:
The duration for which to hold the dragged element over the other element.
Discussion
Specify a duration long enough to initiate a drag operation. If the element exists within a scrollable view but is offscreen, the framework attempts to scroll the element onscreen before performing the click.