XCUIElementQuery Class Reference

Inherits from NSObject
Conforms to XCUIElementTypeQueryProvider
Declared in XCUIElementQuery.h

Overview

Object for locating elements that can be chained with other queries.

  element

Returns an element that will use the query for resolution.

@property (readonly) XCUIElement *element

Declared In

XCUIElementQuery.h

  count

Evaluates the query at the time it is called and returns the number of matches found.

@property (readonly) NSUInteger count

Declared In

XCUIElementQuery.h

– elementAtIndex:

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

- (XCUIElement *)elementAtIndex:(NSUInteger)index

Declared In

XCUIElementQuery.h

– elementBoundByIndex:

Returns an element that will use the index into the query’s results to determine which underlying accessibility element it is matched with.

- (XCUIElement *)elementBoundByIndex:(NSUInteger)index

Declared In

XCUIElementQuery.h

– elementMatchingPredicate:

Returns an element that matches the predicate.

- (XCUIElement *)elementMatchingPredicate:(NSPredicate *)predicate

Declared In

XCUIElementQuery.h

– elementMatchingType:identifier:

Returns an element that matches the type and identifier.

- (XCUIElement *)elementMatchingType:(XCUIElementType)elementType identifier:(nullable NSString *)identifier

Declared In

XCUIElementQuery.h

– objectForKeyedSubscript:

Keyed subscripting is implemented as a shortcut for matching an identifier only. For example, app.descendants[“Foo”] -> XCUIElement.

- (XCUIElement *)objectForKeyedSubscript:(NSString *)key

Declared In

XCUIElementQuery.h

  allElementsBoundByAccessibilityElement

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

@property (readonly, copy) NSArray<XCUIElement*> *allElementsBoundByAccessibilityElement

Declared In

XCUIElementQuery.h

  allElementsBoundByIndex

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

@property (readonly, copy) NSArray<XCUIElement*> *allElementsBoundByIndex

Declared In

XCUIElementQuery.h

– descendantsMatchingType:

Returns a new query that finds the descendants of all the elements found by the receiver.

- (XCUIElementQuery *)descendantsMatchingType:(XCUIElementType)type

Declared In

XCUIElementQuery.h

– childrenMatchingType:

Returns a new query that finds the direct children of all the elements found by the receiver.

- (XCUIElementQuery *)childrenMatchingType:(XCUIElementType)type

Declared In

XCUIElementQuery.h

– matchingPredicate:

Returns a new query that applies the specified attributes or predicate to the receiver.

- (XCUIElementQuery *)matchingPredicate:(NSPredicate *)predicate

Declared In

XCUIElementQuery.h

– matchingType:identifier:

- (XCUIElementQuery *)matchingType:(XCUIElementType)elementType identifier:(nullable NSString *)identifier

– matchingIdentifier:

- (XCUIElementQuery *)matchingIdentifier:(NSString *)identifier

– containingPredicate:

Returns a new query for finding elements that contain a descendant matching the specification.

- (XCUIElementQuery *)containingPredicate:(NSPredicate *)predicate

Declared In

XCUIElementQuery.h

– containingType:identifier:

- (XCUIElementQuery *)containingType:(XCUIElementType)elementType identifier:(nullable NSString *)identifier

  debugDescription

@discussion Provides debugging information about the query. The data in the string will vary based on the time at which it is captured, but it may include any of the following as well as additional data: • A description of each step of the query. • Information about the inputs and matched outputs of each step of the query. This data should be used for debugging only - depending on any of the data as part of a test is unsupported.

@property (readonly, copy) NSString *debugDescription

Declared In

XCUIElementQuery.h