Class

XCUICoordinate

A location on screen relative to some UI element.

Declaration

@interface XCUICoordinate : NSObject

Overview

Coordinates are dynamic, just like the elements to which they refer, and may compute different screen locations at different times, or be invalid if the referenced element does not exist.

Topics

Coordinate Properties

referencedElement

The element that the coordinate is based on, either directly or through the coordinate from which it was derived.

screenPoint

The dynamically computed value of the coordinate’s location on screen.

Moving the Cursor

Available on macOS only.

- hover

Moves the cursor to the coordinate.

Clicking

Available on macOS only.

- click

Sends a click event at the coordinate.

- clickForDuration:thenDragToCoordinate:

Clicks and holds for a specified duration (generally long enough to start a drag operation) then drags to the other coordinate.

- doubleClick

Sends a double click event at the coordinate.

- rightClick

Sends a right click event at the coordinate.

Scrolling

Available on macOS only.

- scrollByDeltaX:deltaY:

Scrolls the view by the specified number of x and y pixels.

Tapping and Pressing

Available on iOS, and on macOS for Touch Bar interactions.

- tap

Sends a tap event at the coordinate.

- doubleTap

Sends a double tap event at the coordinate.

- pressForDuration:

Sends a long press gesture at the coordinate, holding for the specified duration.

- pressForDuration:thenDragToCoordinate:

Initiates a press-and-hold gesture at the coordinate, then drags to another coordinate.

Creating Relative Coordinates

- coordinateWithOffset:

Creates a new coordinate with an absolute offset in points from the original coordinate.

Relationships

Inherits From

Conforms To

See Also

UI Elements

XCUIElement

A UI element in an application.

XCUIElementAttributes

Attributes exposed by UI elements.