one sec WDA Automation
Bulk-create iOS Shortcuts automations that trigger "one sec" when apps are opened, driven by WebDriverAgent.
Prerequisites
- iPhone connected via USB with developer mode enabled
- WebDriverAgent running via xcodebuild:
xcodebuild test-without-building \ -xctestrun <path-to>/WebDriverAgentRunner_iphoneos*.xctestrun \ -destination id=<DEVICE_UDID> \ -allowProvisioningUpdates - WDA accessible at
http://localhost:8100(usepymobiledevice3 remote start-tunnel+ port forward if needed) - one sec app installed on the device with Shortcuts integration enabled
Usage
# Test with one app first
python3 /path/to/onesec_setup.py --test
# Run for all apps
python3 /path/to/onesec_setup.py
The script is at: <skill-dir>/scripts/onesec_setup.py
Workflow per App
- Tap "+" on Shortcuts Automation tab
- Select "App" trigger
- Search for and select the target app
- Confirm "Is Opened" trigger, tap Done
- Search for "one sec" action
- Select "Activate one sec (when app opens)"
- Tap Done to save
Screenshots are saved to /tmp/onesec_step* and /tmp/onesec_fail* for debugging.
Customization
Edit APPS_TO_PROTECT list in the script. Move completed apps to ALREADY_DONE to skip them on re-runs.
WDA Helpers
The script provides reusable WDA functions (no pip dependencies):
wda(method, path, data)— raw HTTP to WDAfind(using, value)/find_one(using, value)— element lookuptap(element_id)/tap_name(name)/tap_label(label)— tap elementstype_text(text)— type into active elementswipe(x1, y1, x2, y2)— drag gesturescreenshot(path)— save screenshot as PNG
Troubleshooting
- WDA connection refused: Ensure xcodebuild test is running and port 8100 is reachable
- pymobiledevice3 tunnel timeout: Restart tunnel with
sudo pymobiledevice3 remote start-tunnel - Element not found: Check screenshots in
/tmp/onesec_fail_*to see actual UI state - App not in picker: App name must match exactly as shown on device home screen