---
title: snapshot()
framework: xcuiautomation
role: symbol
role_heading: Instance Method
path: xcuiautomation/xcuielementsnapshotproviding/snapshot()
---

# snapshot()

Returns a snapshot of an element’s attributes and descendant user interface hierarchy.

## Declaration

```swift
func snapshot() throws -> any XCUIElementSnapshot
```

## Return Value

Return Value A snapshot of an element’s attributes and descendant user interface hierarchy.
