xcui Reference (Scriptable Simulator UI & Accessibility Testing)
Complete reference for xcui, the Axiom-bundled CLI that makes iOS-simulator UI and accessibility testing scriptable for coding harnesses. It owns the test-harness semantics AXe and simctl lack — waiting on conditions, asserting on the accessibility tree, and toggling accessibility settings — and delegates input (tap/type/swipe) to AXe, which injects real HID touch. Every subcommand emits a single pretty-printed JSON object with a tool/version envelope, and exit codes drive pass/fail in scripts.
When to Use This Reference
Use this reference when:
- Looking up
xcui doctor/wait/assert/a11y set/a11y resetsubcommand flags - Interpreting an exit code (0 pass / 1 assertion-fail or wait-timeout / 2 environment error / 8 output-write error)
- Checking which accessibility toggles
a11y setsupports and how each is applied (nativesimctl uivsdefaults write+ relaunch) - Understanding how
xcuiauto-resolves the booted simulator and when to pass--udid - Deciding what to drive with
xcuiversus what to call onaxedirectly (taps, typing, gestures) - Switching between JSON (default) and
--humanoutput - Diagnosing why a
doctorrun reports exit 2 (AXe missing or no booted sim)
Example Prompts
- "How do I wait for an element to appear on the simulator before asserting?"
- "How do I assert a VoiceOver label and trait on an element?"
- "How do I turn on Dynamic Type or Increase Contrast on the simulator?"
- "What does
xcui doctorcheck, and how do I install AXe?" - "Why did
xcui assertexit 1?" - "Why isn't my accessibility toggle taking effect until I relaunch the app?"
What's Covered
- Invocation —
xcuiis on PATH as a bare command (pluginbin/is auto-resolved); runxcui <subcommand> doctorsubcommand — verifies AXe, Homebrew, Xcode, and a booted simulator;--installrunsbrew install cameroncooke/axe/axe(explicit/consented, never silent);--humanfor prose. Always auto-resolves the booted simwaitsubcommand —--for-element <id>,--gone <id>, or--idle, with--timeoutand--poll; polls the accessibility tree until the condition holds or the deadline passes (the headless equivalent ofwaitForExistence)assertsubcommand —--id <id>plus optional--label,--value,--trait, and--single;--singleasserts the id resolves to exactly one element;--traitmatches a bare word (button,image) against the AX role or typea11y set/a11y reset— the four verified toggles and how each is applied (see table below);--app <bundle-id>triggers an app relaunch for the toggles that need it- Input via AXe —
xcuidoes not re-wraptap/type/swipe/touch; callaxedirectly for real HID input, andaxe describe-uifor the raw treexcuiparses - Output envelope & exit codes — single JSON object with
tool/versionfirst;--humanfor prose; exit0pass ·1assertion-fail/wait-timeout ·2environment error ·8output-write error - CLI grammar gotcha — Go's flag parser stops at the first positional, so always use the all-flag forms (
assert --id …, notassert <id> …)
Accessibility Toggles
a11y set --toggle <name> --value <…> supports the following, all verified against the booted simulator. a11y reset clears them (deletes the defaults keys, sets content_size large, sets increase_contrast disabled).
| Toggle | Mechanism | --value | Relaunch |
|---|---|---|---|
dynamic-type | native simctl ui content_size | a size (large … accessibility-extra-extra-extra-large) | no |
increase-contrast | native simctl ui increase_contrast | on / off | no |
reduce-motion | defaults write com.apple.Accessibility ReduceMotionEnabled | on / off | yes (pass --app) |
reduce-transparency | defaults write com.apple.Accessibility ReduceTransparencyEnabled | on / off | yes (pass --app) |
voiceover, differentiate-without-color, and bold-text are not supported in v1 — they had no confirmable simulator mechanism (no native simctl ui setter, and their candidate defaults keys are not honored on the sim), so they were omitted rather than shipped unverified.
Documentation Scope
This page documents the xcui-ref reference skill — the bundled Axiom CLI for scriptable simulator UI and accessibility testing.
- For the agent that drives
xcuilive (set toggles, wait, assert on the tree), see the simulator-tester agent - For static accessibility source scanning (the read-only counterpart that pairs with live validation), see the accessibility-auditor agent
- For the input primitives
xcuidelegates to, see AXe (Simulator Automation) - For the
/axiom:uicommand wrapper, see /axiom:ui - For the sibling bundled tools, see Console Capture (xclog) and Crash Symbolication (xcsym)