---
title: element
framework: xcuiautomation
role: symbol
role_heading: Instance Property
path: xcuiautomation/xcuielementquery/element
---

# element

The query’s single matching element.

## Declaration

```swift
var element: XCUIElement { get }
```

## Discussion

Discussion Use the element property to access a query’s result when you expect a single matching element for the query, but want to check for multiple ambiguous matches before accessing the result. The element property traverses your app’s accessibility tree to check for multiple matching elements before returning, and fails the current test if there isn’t a single matching element. In cases where you know categorically that there’s a single matching element, use the XCUIElementTypeQueryProvider firstMatch property instead. The firstMatch property stops traversing your app’s accessibility hierarchy as soon as it finds a matching element, speeding up element query resolution.

## See Also

### Related Documentation

- [firstMatch](xcuiautomation/xcuielementtypequeryprovider/firstmatch.md)

### Accessing matched elements

- [allElementsBoundByAccessibilityElement](xcuiautomation/xcuielementquery/allelementsboundbyaccessibilityelement.md)
- [allElementsBoundByIndex](xcuiautomation/xcuielementquery/allelementsboundbyindex.md)
- [count](xcuiautomation/xcuielementquery/count.md)
- [element(boundBy:)](xcuiautomation/xcuielementquery/element(boundby:).md)
- [element(matching:)](xcuiautomation/xcuielementquery/element(matching:).md)
- [element(matching:identifier:)](xcuiautomation/xcuielementquery/element(matching:identifier:).md)
- [subscript(_:)](xcuiautomation/xcuielementquery/subscript(_:).md)
- [element(at:)](xcuiautomation/xcuielementquery/element(at:).md)
