Retrofit Accessibility Identifiers onto existing Xcode UI — and turn them into UI tests.
Suitable for large iOS codebases that grew up without consistent accessibilityIdentifiers. This suite walks .storyboard / .xib files, stamps readable, deterministic IDs, improves VoiceOver metadata, and emits CSV + WebdriverIO / Appium scaffolding so QA and automation can work from the same source of truth.
Manual accessibility IDs (or random UUIDs) don’t scale:
| Problem | What this suite does |
|---|---|
| Thousands of unlabeled controls | Batch-tags storyboards and xibs |
| Opaque IDs in test failures | Builds IDs like login-Home-button-ingresar |
| VoiceOver incomplete | Adds label, Spanish type-based hint, and traits |
| Tests written by hand from scratch | Emits CSV + WebdriverIO / Appium skeletons |
| Fear of running a batch script blind | Preview elements in a macOS drag-and-drop app |
Related predecessor: python-xcode-housekeeping (UUID-style IDs). This repo is the more advanced, production-oriented evolution.
accessibility-helper/
├── xcode-accessibility-generator/ # Main Python CLI
├── accessibility-scan-app/ # macOS SwiftUI preview app
├── appium-test-generator/ # CSV → Appium/WebdriverIO script
├── prepare-app-for-tests.sh # Example end-to-end CI-ish flow
└── LICENSE
| Component | Role |
|---|---|
| xcode-accessibility-generator | Retro-fits IDs + VoiceOver metadata; writes per-screen CSV and JS test skeletons |
| accessibility-scan-app | Native macOS app: drag a folder, browse elements and preview IDs before batch runs |
| appium-test-generator | Turns an accessibility CSV into a runnable Appium/WebdriverIO script |
| prepare-app-for-tests.sh | Example flow: rebase branch → generate IDs → simulator build → push |
Requirements: Python 3.
cd xcode-accessibility-generator
# Point BASE_PATH at your Xcode project root (edit the script):
# STORYBOARDS_PATH → …/Storyboards/Base.lproj
# MODULES_PATH → …/Modules
# Adjust if your layout differs.
python3 main_accessibility_generator.pyEffects:
- Updates
.storyboard/.xibin place (adds missing accessibility nodes) - Writes
Output/CSV/<name>_accessibility.csv - Writes
Output/JS/<name>_accessibility_tests.js(WebdriverIO-styleclient.$('~id')lookups)
Example ID shape:
login-Home-button-ingresar
# screen / module – view context – control type – control text
Requirements: Xcode 15+, macOS 13+.
- Open
accessibility-scan-app/AccessibilityScan/AccessibilityScan.xcodeproj - Run the app
- Drag a folder that contains
.storyboard/.xibfiles onto the window - Browse elements and the IDs that would be generated
cd appium-test-generator
# Set csv_file in AppiumScriptGenerator.py to your CSV path
python3 AppiumScriptGenerator.py
# → appium_generated_tests.jsEdit placeholders in prepare-app-for-tests.sh (MyApp, scheme, branches), then:
./prepare-app-for-tests.sh- Walk storyboards and feature modules (xibs)
- Keep interactive / meaningful control types (buttons, fields, switches, etc.)
- Normalize visible text into a stable camelCase fragment
- Compose:
context-viewController-type-text - Attach VoiceOver label, hint (Spanish defaults by type), and traits
- Export inventory (CSV) and test stubs (JS)
IDs stay stable across runs as long as context, type, and text don’t change — so tests don’t churn when you re-run the tool.
┌─────────────────────┐
│ accessibility-scan │ optional: preview a folder
│ (macOS) │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ xcode-accessibility │ batch: patch UI + CSV + JS
│ -generator │
└──────────┬──────────┘
│
├──────────────► Output/CSV ──► appium-test-generator
└──────────────► Output/JS ──► fill assertions / ship to QA
- Spot-check a module in the macOS app
- Run the generator on the full project (on a dedicated git branch)
- Review the storyboard/xib diff and the CSV
- Generate or extend Appium/WebdriverIO tests
- Open a PR for the accessibility retrofit
| Piece | Needs |
|---|---|
| Generator & Appium tools | Python 3 |
| Scan app | Xcode 15+, macOS 13+ (SwiftUI) |
prepare-app-for-tests.sh |
git, CocoaPods (if used), Xcode CLT |
No tokens or private API keys are required for the core tools.
MIT — Copyright (c) 2021–2026 Juan Carlos Correa Arango
Juan Correa (@serenoj)
| Repo | Relation |
|---|---|
| python-xcode-housekeeping | Earlier UUID-based accessibility tooling |
| ios-build-scripts | CI archive / test / distribute scripts |
| ios-analysis-toolkit | Periphery + Sourcery analysis helpers |