<!--
{
  "availability" : [
    "Xcode: 16.3.0 -",
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "XCUIAutomation",
  "identifier" : "/documentation/XCUIAutomation/XCUIElement/wait(for:toEqual:timeout:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "XCUIAutomation"
    ],
    "preciseIdentifier" : "s:So11XCUIElementC14XCUIAutomationE4wait3for7toEqual7timeoutSbs7KeyPathCyABxG_xSdtSQRzlF"
  },
  "title" : "wait(for:toEqual:timeout:)"
}
-->

# wait(for:toEqual:timeout:)

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

```
@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 [`XCUIElement`](/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

This method returns <doc://com.apple.documentation/documentation/Swift/false> if the timeout expires before the observed property equals the expected value.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)