<!--
{
  "availability" : [
    "Xcode: 16.3.0 -",
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "XCUIAutomation",
  "identifier" : "/documentation/XCUIAutomation/XCUIElementQuery/matching(identifier:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "XCUIAutomation"
    ],
    "preciseIdentifier" : "c:objc(cs)XCUIElementQuery(im)matchingIdentifier:"
  },
  "title" : "matching(identifier:)"
}
-->

# matching(identifier:)

Returns a new query that matches elements that have an identifying property that matches a provided identifier.

```
func matching(identifier: String) -> XCUIElementQuery
```

## Parameters

`identifier`

A string to match against any one of each element’s identifying properties: [`identifier`](/documentation/XCUIAutomation/XCUIElementAttributes/identifier), [`title`](/documentation/XCUIAutomation/XCUIElementAttributes/title), [`label`](/documentation/XCUIAutomation/XCUIElementAttributes/label), [`value`](/documentation/XCUIAutomation/XCUIElementAttributes/value), or [`placeholderValue`](/documentation/XCUIAutomation/XCUIElementAttributes/placeholderValue).

## Return Value

A new query that defines a search that extends the search criteria of the receiver. The new search matches elements that match the original search and have an identifying property that matches a provided identifier.

## Discussion

---

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)