Instance Method

element(matching:)

An element that matches the predicate.

Declaration

func element(matching predicate: NSPredicate) -> XCUIElement

Parameters

predicate

The predicate to match.

Discussion

The predicate is evaluated against objects that conform to the XCUIElementAttributes protocol.

See Also

Accessing Matched Elements

var allElementsBoundByAccessibilityElement: [XCUIElement]

Immediately evaluates the query and returns an array of elements bound to the resulting accessibility elements.

var allElementsBoundByIndex: [XCUIElement]

Immediately evaluates the query and returns an array of elements bound by the index of each result.

var count: Int

Evaluates the query and returns the number of elements that match.

var element: XCUIElement

The query’s single matching element.

func element(boundBy: Int) -> XCUIElement

An element that uses an index into the query’s results to determine which underlying accessibility element to use.

func element(matching: XCUIElement.ElementType, identifier: String?) -> XCUIElement

An element that matches the provided element type and identifier.

subscript(String) -> XCUIElement

Returns a descendant element matching the identifier specified by key.

func element(at: Int) -> XCUIElement

Returns an element that will resolve to the index into the query’s result set.

Deprecated