| name | axiom-axe-ref |
| description | Use when automating iOS Simulator UI interactions beyond simctl capabilities. Reference for AXe CLI covering accessibility-based tapping, gestures, text input, screenshots, video recording, and UI tree inspection. |
| license | MIT |
| metadata | {"version":"1.0.0"} |
AXe Reference (iOS Simulator UI Automation)
AXe is a CLI tool for interacting with iOS Simulators using Apple's Accessibility APIs and HID functionality. Single binary, no daemon required.
Installation
brew install cameroncooke/axe/axe
axe --version
Critical Best Practice: describe_ui First
ALWAYS run describe_ui before UI interactions. Never guess coordinates from screenshots.
Best practice: Use describe-ui to get precise element coordinates prior to using x/y parameters (don't guess from screenshots).
axe describe-ui --udid $UDID
axe tap --id "loginButton" --udid $UDID
axe tap --label "Login" --udid $UDID
axe tap -x 200 -y 400 --udid $UDID
Priority order for targeting elements:
--id (accessibilityIdentifier) - most stable
--label (accessibility label) - stable but may change with localization
-x -y coordinates from describe-ui - fragile, use only when no identifier
Core Concept: Accessibility-First
AXe's key advantage: Tap elements by accessibility identifier or label, not just coordinates.
axe tap -x 200 -y 400 --udid $UDID
axe tap --id "loginButton" --udid $UDID
axe tap --label "Login" --udid $UDID
Always prefer --id or --label over coordinates.
Getting the Simulator UDID
AXe requires the simulator UDID for most commands:
UDID=$(xcrun simctl list devices -j | jq -r '.devices | to_entries[] | .value[] | select(.state == "Booted") | .udid' | head -1)
axe list-simulators
Touch & Tap Commands
Tap by Accessibility Identifier (Recommended)
axe tap --id "loginButton" --udid $UDID
axe tap --label "Submit" --udid $UDID
Tap by Coordinates
axe tap -x 200 -y 400 --udid $UDID
axe tap -x 200 -y 400 --pre-delay 0.5 --post-delay 0.3 --udid $UDID
axe tap -x 200 -y 400 --duration 1.0 --udid $UDID
Low-Level Touch Events
axe touch down -x 200 -y 400 --udid $UDID
axe touch up -x 200 -y 400 --udid $UDID
Swipe & Gesture Commands
Custom Swipe
axe swipe --start-x 200 --start-y 600 --end-x 200 --end-y 200 --udid $UDID
axe swipe --start-x 200 --start-y 600 --end-x 200 --end-y 200 --duration 0.5 --udid $UDID
Gesture Presets
axe gesture scroll-up --udid $UDID
axe gesture scroll-down --udid $UDID
axe gesture scroll-left --udid $UDID
axe gesture scroll-right --udid $UDID
axe gesture swipe-from-left-edge --udid $UDID
axe gesture swipe-from-right-edge --udid $UDID
axe gesture swipe-from-top-edge --udid $UDID
axe gesture swipe-from-bottom-edge --udid $UDID
Text Input
Type Text
axe type "user@example.com" --udid $UDID
axe type "password123" --char-delay 0.1 --udid $UDID
echo "Hello World" | axe type --stdin --udid $UDID
axe type --file /tmp/input.txt --udid $UDID
Keyboard Keys
axe key 40 --udid $UDID
axe key-sequence 40 43 40 --delay 0.2 --udid $UDID
Hardware Buttons
axe button home --udid $UDID
axe button lock --udid $UDID
axe button lock --duration 3.0 --udid $UDID
axe button side-button --udid $UDID
axe button siri --udid $UDID
axe button apple-pay --udid $UDID
Screenshots
axe screenshot --udid $UDID
axe screenshot --output /tmp/my-screenshot.png --udid $UDID
axe screenshot --stdout --udid $UDID > screenshot.png
Video Recording & Streaming
Record Video
axe record-video --output /tmp/recording.mp4 --udid $UDID
axe record-video --output /tmp/recording.mp4 --quality high --udid $UDID
axe record-video --output /tmp/recording.mp4 --scale 0.5 --udid $UDID
Stream Video
axe stream-video --udid $UDID
axe stream-video --fps 30 --udid $UDID
axe stream-video --format mjpeg --udid $UDID
axe stream-video --format jpeg --udid $UDID
axe stream-video --format ffmpeg --udid $UDID
axe stream-video --format bgra --udid $UDID
UI Inspection (describe-ui)
Critical for finding accessibility identifiers and labels.
Full Screen UI Tree
axe describe-ui --udid $UDID
Point-Specific UI Info
axe describe-ui --point 200,400 --udid $UDID
Example Output
{
"type": "Button",
"identifier": "loginButton",
"label": "Login",
"frame": {"x": 150, "y": 380, "width": 100, "height": 44},
"enabled": true,
"focused": false
}
Common Workflows
Login Flow
UDID=$(xcrun simctl list devices -j | jq -r '.devices | to_entries[] | .value[] | select(.state == "Booted") | .udid' | head -1)
axe tap --id "emailTextField" --udid $UDID
axe type "user@example.com" --udid $UDID
axe tap --id "passwordTextField" --udid $UDID
axe type "password123" --udid $UDID
axe tap --id "loginButton" --udid $UDID
sleep 2
axe screenshot --output /tmp/login-result.png --udid $UDID
Discover Elements Before Automating
axe describe-ui --udid $UDID > /tmp/ui-tree.json
cat /tmp/ui-tree.json | jq '.[] | select(.identifier != null) | {identifier, label, type}'
axe tap --id "discoveredIdentifier" --udid $UDID
Scroll to Find Element
for i in {1..5}; do
if axe describe-ui --udid $UDID | grep -q "targetElement"; then
axe tap --id "targetElement" --udid $UDID
break
fi
axe gesture scroll-down --udid $UDID
sleep 0.5
done
Screenshot on Error
if ! axe tap --id "submitButton" --udid $UDID; then
axe screenshot --output /tmp/error-state.png --udid $UDID
axe describe-ui --udid $UDID > /tmp/error-ui-tree.json
echo "Failed to tap submitButton - see error-state.png"
fi
Timing Controls
Most commands support timing options:
| Option | Description |
|---|
--pre-delay | Wait before action (seconds) |
--post-delay | Wait after action (seconds) |
--duration | Action duration (for taps, button presses) |
--char-delay | Delay between characters (for type) |
axe tap --id "button" --pre-delay 0.5 --post-delay 0.3 --udid $UDID
AXe vs simctl
| Capability | simctl | AXe |
|---|
| Device lifecycle | ✅ | ❌ |
| Permissions | ✅ | ❌ |
| Push notifications | ✅ | ❌ |
| Status bar | ✅ | ❌ |
| Deep links | ✅ | ❌ |
| Screenshots | ✅ | ✅ (PNG) |
| Video recording | ✅ | ✅ (H.264) |
| Video streaming | ❌ | ✅ |
| UI tap/swipe | ❌ | ✅ |
| Type text | ❌ | ✅ |
| Hardware buttons | ❌ | ✅ |
| Accessibility tree | ❌ | ✅ |
Use both together: simctl for device control, AXe for UI automation.
Troubleshooting
Element Not Found
- Run
axe describe-ui to see available elements
- Check element has
accessibilityIdentifier set in code
- Ensure element is visible (not off-screen)
Tap Doesn't Work
- Check element is enabled (
"enabled": true in describe-ui)
- Try adding
--pre-delay 0.5 for slow-loading UI
- Verify correct UDID with
axe list-simulators
Type Not Working
- Ensure text field is focused first:
axe tap --id "textField"
- Check keyboard is visible
- Try
--char-delay 0.05 for reliability
Permission Denied
AXe uses private APIs - ensure you're running on a Mac with Xcode installed and proper entitlements.
Resources
GitHub: https://github.com/cameroncooke/AXe
Related: xcsentinel (build orchestration)
Skills: axiom-xctest-automation, axiom-ui-testing
Agents: simulator-tester, test-runner