IOSDriver API Reference
IOSDriver
drag()— not insupportedsetinstall_app()— not insupportedsetpress_button()—homeonly
IOSDriver.__init__
urlstr - iOS Portal URL (e.g., “http://127.0.0.1:6643”)bundle_identifiersList[str] | None - Optional list of custom app bundle identifiers
- Build and run the iOS Portal via Xcode (runs as a UI test)
- Forward port with
iproxy 6643 6643 - Use
http://127.0.0.1:6643as the URL
Lifecycle Methods
IOSDriver.connect
/device/date.
IOSDriver.ensure_connected
Input Action Methods
IOSDriver.tap
xint - X coordinateyint - Y coordinate
IOSDriver.swipe
x1int - Starting X coordinatey1int - Starting Y coordinatex2int - Ending X coordinatey2int - Ending Y coordinateduration_msfloat - Duration in milliseconds
IOSDriver.input_text
textstr - Text to input (supports Unicode)clearbool - Clear existing text before input
bool- True if input succeeded, False otherwise
IOSDriver.press_button
home
Raises ValueError for unsupported button names.
Arguments:
buttonstr - Button name (case-insensitive)
App Management Methods
IOSDriver.start_app
packagestr - Bundle identifier (e.g., “com.apple.MobileSMS”)activitystr | None - Ignored on iOS (for API compatibility)
str- Result message
- Messages:
com.apple.MobileSMS - Safari:
com.apple.mobilesafari - Settings:
com.apple.Preferences - Calendar:
com.apple.mobilecal - Photos:
com.apple.mobileslideshow - Maps:
com.apple.Maps - Contacts:
com.apple.MobileAddressBook
IOSDriver.list_packages
include_systembool - Include system apps (default: False)
List[str]- List of bundle identifiers
- Returns union of
bundle_identifiers+ system apps (if included) - Does not query device for installed apps
IOSDriver.get_apps
package (bundle identifier) and label (human-readable name).
System apps are mapped to friendly names (e.g., com.apple.mobilesafari → Safari). Third-party bundle identifiers are humanized from the last segment.
Arguments:
include_systembool - Include system apps (default: True)
List[Dict[str, str]]- List of dicts with ‘package’ and ‘label’ keys
State and Observation Methods
IOSDriver.screenshot
hide_overlaybool - Unused on iOS (for API compatibility)
bytes- Raw PNG image data
IOSDriver.get_ui_tree
GET /state?timeout=4, giving the portal a single 4-second state collection budget. There is no Mobilerun-side retry on iOS state fetches.
Returns:
Dictionary with:
a11y_tree- The accessibility tree elementsphone_state- Dict withcurrentAppandkeyboardVisibledevice_context- Additional device context
IOSDriver.get_date
str- Date string, or empty string on failure
Unsupported Methods
The following DeviceDriver methods are not insupported and will raise NotImplementedError:
drag()
Not supported on iOS.install_app()
Not supported on iOS.Instance Properties
Example Usage
ActionContext (see MobileAgent) rather than calling the driver directly.
See Also
- AndroidDriver - Android device driver
- DeviceDriver Base Class - Base class and architecture reference
- Device Setup — iOS - Full setup instructions

