Contents

descendants(matching:)

Returns a query for all descendants of the element matching the type you specify.

Declaration

func descendants(matching type: XCUIElement.ElementType) -> XCUIElementQuery

Discussion

Because XCUIElement conforms to the XCUIElementTypeQueryProvider protocol, you can use the protocol’s properties as shorthand for calling descendants(matching:) for different element types. For example, rather than calling table.descendants(matching: .cell), you can use the cells property from the protocol to retrieve table.cells.

See Also

Querying descendant elements