---
title: "wait(for:toEqual:timeout:)"
framework: xcuiautomation
role: symbol
role_heading: Instance Method
path: "xcuiautomation/xcuielement/wait(for:toequal:timeout:)"
---

# wait(for:toEqual:timeout:)

Waits a specified amount of time for a property value to equal a specified value.

## Declaration

```swift
@MainActor @preconcurrency func wait<V>(for keyPath: KeyPath<XCUIElement, V>, toEqual expectedValue: V, timeout: TimeInterval) -> Bool where V : Equatable
```

## Parameters

- `keyPath`: The observed property on an doc://com.apple.xcuiautomation/documentation/XCUIAutomation/XCUIElement.
- `expectedValue`: The desired value, which must conform to Equatable.
- `timeout`: The length of time in seconds to wait for the observed property to equal the expected value.

## Discussion

Discussion This method returns false if the timeout expires before the observed property equals the expected value.

## See Also

### Querying element state

- [waitForExistence(timeout:)](xcuiautomation/xcuielement/waitforexistence(timeout:).md)
- [waitForNonExistence(timeout:)](xcuiautomation/xcuielement/waitfornonexistence(timeout:).md)
- [exists](xcuiautomation/xcuielement/exists.md)
- [isHittable](xcuiautomation/xcuielement/ishittable.md)
- [debugDescription](xcuiautomation/xcuielement/debugdescription.md)
