xcuitest-element-finding

Installation
SKILL.md

XCUITest Element Finding

Source: Apple Developer Documentation – XCUIElement / XCUIElementQuery / NSPredicate matching

Purpose

Locate UI elements in the app's view hierarchy using a lazy two-phase query system: build an XCUIElementQuery with matching criteria, then resolve it to an XCUIElement for interaction or inspection.

When to Use

  • Finding buttons, text fields, cells, and other interactable elements before tapping, typing, or swiping.
  • Filtering large element trees with NSPredicate conditions (e.g., "the enabled button labeled 'Submit'").
  • Traversing the hierarchy: descendants(matching:) for deep search, children(matching:) for shallow.
  • Waiting for async elements to appear with waitForExistence(timeout:).

Basic Usage

let app = XCUIApplication()
app.launch()
Installs
1
First Seen
Jun 20, 2026