Cesium iOS Python SDK (cesium-ios)
Driverless, 100% WDA-Free iOS Automation & Telemetry Engine for Linux and Windows.
Completely eliminates WebDriverAgent (WDA), macOS Mac Minis, and Apple Developer certificate signing. Connects directly to physical iPhones and iPads (iOS 17+) over native Apple CoreDevice,universalhidservice, andaxAuditDaemon.
🌟 Key Architecture & Capabilities
- Zero-Boilerplate Test Flow Engine (
CesiumRunner): Write only your test logic (@runner.flow). The SDK automatically handles device discovery, dynamic port mapping, multi-threaded execution, and reporting. - Dynamic Multi-Device Scaling: Automate 1, 4, 10, or 50 physical iOS devices simultaneously with zero hardcoded UDIDs or ports.
- Custom CLI Arguments: Extend test scripts with custom command-line flags (
runner.add_argument(...)) integrated with standardargparse. - Sub-10ms Hardware Gestures: Injects true hardware digitizer touch events (taps, drags, swipes, scrolls) directly through Apple's native HID daemon.
- Sub-25ms App Lifecycle: Cold-launches and terminates any iOS application bundle directly over CoreDevice. Deep link payload URLs open in under 25ms.
- Direct Virtual Keyboard & Clipboard: Types text into input fields using native virtual keyboard modifier states (with 100% symbol & capital fidelity) and inspects/sets the iOS system pasteboard.
- Integrated Wi-Fi Control: Toggles radio interfaces, connects to SSIDs, and forgets networks.
- Sub-80ms Accessibility Tree: Queries visible UI elements, taps buttons by text, and checks toggle switch states (
[ON]/[OFF]) without OCR lag.
📦 Installation & Setup
In-Tree / Local Development
Add the cesium_sdk directory to your Python sys.path:
import sys, os
sys.path.insert(0, os.path.abspath("cesium_sdk"))
from cesium_ios import CesiumRunner, IOSDevice
Install as Python Package (Editable Mode)
cd cesium_sdk
pip install -e .
🚀 Quickstart: Writing a Universal Test Flow
With CesiumRunner, you do not write socket code, thread pools, or port mappings. You define your test interaction sequence:
#!/usr/bin/env python3
from cesium_ios import CesiumRunner, IOSDevice
runner = CesiumRunner(title="Settings App Automation")
# Register custom CLI flags for your test script
runner.add_argument("--bundle-id", default="com.apple.Preferences", help="Target App Bundle ID")
runner.add_argument("--scrolls", type=int, default=3, help="Number of feed scrolls")
runner.add_argument("--toggle-wifi", action="store_true", help="Cycle Wi-Fi state during test")
@runner.flow
def test_flow(dev: IOSDevice, args):
"""
Executes concurrently across all target devices (smartphones and tablets).
"""
dev.log("Step 1: Return to SpringBoard Home")
dev.home()
dev.sleep(1.0)
if args.toggle_wifi:
dev.log("Step 2: Toggling Wi-Fi interface...")
dev.toggle_wifi()
dev.sleep(2.0)
dev.toggle_wifi()
dev.sleep(2.0)
dev.log(f"Step 3: Launching '{args.bundle_id}'")
dev.launch_app(args.bundle_id)
dev.sleep(3.0)
for i in range(args.scrolls):
dev.log(f"Step 4: Scrolling content ({i + 1}/{args.scrolls})")
dev.scroll_down()
dev.sleep(1.5)
dev.log("Step 5: Clean up & return Home")
dev.terminate_app(args.bundle_id)
dev.home()
if __name__ == "__main__":
runner.run()
💻 Running Tests from the Command Line
1. Auto-discover all connected devices (Zero configuration)
python test_script.py --host 127.0.0.1
Automatically queries the Cesium platform, detects all connected iPhones and iPads, and runs the test flow across all of them in parallel.
2. Run on specific target devices
python test_script.py --udids 00008101-0016056E3A22601E 00008110-001155242680A01E
3. Use your custom arguments
python test_script.py --scrolls 5 --toggle-wifi
4. Automatic Multi-Device Summary Report
========================================================================
🚀 [Cesium Test Runner] Settings App Automation
📡 Host: 127.0.0.1 | 📱 Devices: 3 | 🧵 Workers: 3
========================================================================
[12:19:05] [..2680A01E] ▶️ Starting flow 'test_flow'
[12:19:05] [..0188801E] ▶️ Starting flow 'test_flow'
[12:19:05] [..3A68401E] ▶️ Starting flow 'test_flow'
[12:19:06] [..2680A01E] Step 3: Launching 'com.apple.Preferences'
[12:19:06] [..0188801E] Step 3: Launching 'com.apple.Preferences'
[12:19:06] [..3A68401E] Step 3: Launching 'com.apple.Preferences'
[12:19:12] [..2680A01E] ✅ Completed successfully in 7.05s
[12:19:12] [..0188801E] ✅ Completed successfully in 7.09s
[12:19:12] [..3A68401E] ✅ Completed successfully in 7.01s
========================================================================
📊 EXECUTION SUMMARY: Settings App Automation
========================================================================
Status # UDID Duration Details
------------------------------------------------------------------------
✅ PASS 1 00008110-001155242680A01E 7.05s Completed successfully
✅ PASS 2 00008101-001D30500188801E 7.09s Completed successfully
✅ PASS 3 00008110-001A38503A68401E 7.01s Completed successfully
========================================================================
Total: 3 | Passed: 3 | Failed: 0 | Total Time: 7.09s
🛠️ Complete IOSDevice API Reference
1. Navigation & System Gestures
| Method / Property | Description |
|---|---|
dev.home() |
Hardware gesture to return to SpringBoard Home screen. |
dev.app_switcher() |
Hardware gesture to open native iOS multitasking App Switcher. |
dev.back() |
Taps standard iOS top-left navigation back button (0.08, 0.065). |
dev.sleep(seconds) |
Pauses execution for the specified duration (seconds). |
dev.wait(seconds) |
Alias for dev.sleep(). |
dev.log(message) |
Prints a thread-safe message prefixed with timestamp and device UDID tag. |
dev.is_tablet |
Boolean property: returns True if connected device is an iPad, False for iPhones. |
2. Device Discovery & Port Resolution (Class Methods)
| Method | Description |
|---|---|
IOSDevice.get_connected_devices(host="127.0.0.1") |
Dynamically queries Cesium and returns {udid: engine_port} map for all connected devices. |
IOSDevice.list_devices(host="127.0.0.1") |
Returns a list of connected device UDIDs. |
IOSDevice.resolve_port_for_udid(udid, host="127.0.0.1") |
Dynamically resolves the active engine communication port for a given UDID. |
3. Touch Gestures & Hardware Digitizer
All coordinates are normalized fractions (0.0 to 1.0), making touch gestures device-agnostic across varying screen resolutions.
| Method | Description |
|---|---|
dev.tap(fx, fy, dwell_ms=80) |
Hardware digitizer tap at normalized coordinates (fx, fy). |
dev.swipe(x0, y0, x1, y1, duration_ms=300) |
Hardware digitizer swipe from (x0, y0) to (x1, y1). |
dev.scroll_down(duration_ms=300) |
Vertical swipe downwards (0.50, 0.70 to 0.50, 0.30). |
dev.scroll_up(duration_ms=300) |
Vertical swipe upwards (0.50, 0.30 to 0.50, 0.70). |
4. Application Lifecycle
| Method | Description |
|---|---|
dev.launch_app(bundle_id, url=None) |
Launches app cold via CoreDevice. Optional deep link URL opens in < 25ms. Includes automatic DVT fallback. |
dev.terminate_app(name_or_bundle_id) |
Instantly terminates running process matching bundle ID or executable name. |
dev.terminate_process(pid, signal=9) |
Terminates a process directly by its PID. |
dev.list_processes() |
Lists all active processes with PIDs and bundle identifiers. |
5. Text Input & Clipboard
| Method | Description |
|---|---|
dev.type(text) |
Types text into the focused field via CoreDevice Virtual Keyboard HID. |
dev.type_text(text, char_delay=0.04) |
Types text with calibrated modifier key support for symbols & capitals. |
dev.paste() |
Sends Command + V to paste the current system clipboard into the focused field. |
dev.set_clipboard(text) |
Sets iOS system clipboard directly via CoreDevice pasteboard service. |
dev.get_clipboard() |
Reads iOS system clipboard contents. |
6. Wi-Fi Management
| Method | Description |
|---|---|
dev.toggle_wifi() |
Toggles Wi-Fi interface state (On ↔ Off). |
dev.connect_wifi(ssid, password) |
Associates device with target Wi-Fi network. |
dev.forget_wifi(ssid) |
Forgets target Wi-Fi network profile. |
7. Accessibility & UI Element Finding
Inspects and interacts with on-screen elements (labels, buttons, switches) in sub-80ms:
| Method | Description |
|---|---|
dev.get_elements() |
Dumps all visible on-screen elements (UIElement objects). |
dev.find_element(text_or_predicate) |
Searches for visible element matching caption substring or predicate function. |
dev.tap_element(text_or_element) |
Finds element by caption and taps its exact center. |
dev.tap_toggle(row_name) |
Directly clicks the toggle switch for a row (e.g. "Wi-Fi", "Bluetooth", "Airplane Mode"). |
dev.get_toggle_state(row_name) |
Returns "ON" or "OFF" for a given switch row. |
dev.screenshot(save_path=None) |
Captures uncompressed PNG screenshot in ~78ms. |
dev.inspect() |
Prints an ASCII table of all visible UI elements, types, states, and coordinates. |
📋 UIElement Properties
When calling dev.get_elements() or dev.find_element(), each element provides:
el.text: Element text, label, or accessibility caption.el.element_type:"Button","Switch","Header","Label", or"Paragraph".el.state: State string (e.g."ON","OFF"for toggle switches, orNone).el.fx,el.fy: Normalized center coordinates(0.0 - 1.0)ready for hardware touch injection.el.left,el.top,el.width,el.height: Pixel bounding box dimensions.
📖 Practical Script Examples
Example 1: Interacting with Settings & Toggle Switches
from cesium_ios import IOSDevice
dev = IOSDevice()
# Launch Settings
dev.launch_app("com.apple.Preferences")
dev.sleep(2.0)
# Check Wi-Fi switch state and toggle it
state = dev.get_toggle_state("Wi-Fi")
dev.log(f"Current Wi-Fi Switch state: {state}")
dev.tap_toggle("Wi-Fi")
dev.sleep(2.0)
# Return Home
dev.home()
Example 2: Typing Text into Input Fields
from cesium_ios import IOSDevice
dev = IOSDevice()
# Tap input field at normalized coordinates (or by element name)
dev.tap(0.50, 0.25)
dev.sleep(0.5)
# Type text with special characters and uppercase letters
dev.type("LanforgePassword123!")
# Alternatively, set clipboard and paste instantly:
dev.set_clipboard("SecretTokenXYZ")
dev.paste()
Example 3: Inspecting UI Elements with ASCII Inspector Table
from cesium_ios import IOSDevice
dev = IOSDevice()
dev.launch_app("com.apple.Preferences")
dev.sleep(2.0)
# Prints full on-screen hierarchy table to terminal:
dev.inspect()
Output:
🔍 [Cesium Inspector] Detected 12 visible UI elements on 00008110-001155242680A01E (1170x2532):
================================================================================================
# Type Name / Element State Center (fx, fy)
------------------------------------------------------------------------------------------------
1 Header Settings - (0.500, 0.065)
2 Switch Airplane Mode Switch [OFF] [OFF] (0.875, 0.175)
3 Label Airplane Mode - (0.245, 0.175)
4 Switch Wi-Fi Switch [ON] [ON] (0.875, 0.235)
5 Label Wi-Fi - (0.180, 0.235)
6 Button Bluetooth - (0.500, 0.295)
================================================================================================
🚢 Building & Packaging the SDK
cd cesium_sdk
python -m build
Metadata
Release files for cesium-ios 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cesium_ios-0.1.5.tar.gz | 22.7 kB | Without provenance | Details for cesium_ios-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cesium_ios-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for cesium_ios-0.1.5-py3-none-any.whl |
Total release size: 41.7 kB
Release files / cesium_ios-0.1.5.tar.gz
| Download URL | cesium_ios-0.1.5.tar.gz |
|---|---|
| Size | 22.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
060e5b5e6f38cb003c6f218069c0660ac5773dfa69e2f43bf3817bca80b2dc71
|
|
BLAKE2b-256 checksum How to use checksums |
e721e8a12c798e9a62924188b26a67ca6303e81c300db8baf1a369c6511c8907
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.0
|
Release files / cesium_ios-0.1.5-py3-none-any.whl
| Download URL | cesium_ios-0.1.5-py3-none-any.whl |
|---|---|
| Size | 19.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c07618b8411b9876c03787043a8a372b85a1f6e898c3236dea858f8dd89b9914
|
|
BLAKE2b-256 checksum How to use checksums |
ecf2fad6764180b4d6321678cf9ac5fe5364aa364c141d223400df0cc7cbdfe5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.0
|
Security for cesium-ios 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.