IOSAutomator provides iOS-specific methods for native UI automation. Access it through $.platform.ios in your Patrol tests.
Accessing IOSAutomator
iOS-Specific Methods
Notifications
Closes the currently visible heads-up notification (banner).If no heads-up notification is visible, behavior is undefined.iOS only
Taps on a notification by its index in the notification center.Notification center must be opened first with
openNotifications().Parameters:index- Zero-based index of notificationtimeout- Max time to wait for notification
Taps on a notification using a selector.On iOS,
textContains, titleContains, and text properties are used.App Management
Opens a specific iOS app by bundle identifier.You can use
AppleApp enum for common apps or provide a custom bundle ID string.Configures the iOS automator with settings from
IOSAutomatorConfig.Element Interaction
Tapping
Taps on a native iOS UI element.Parameters:
selector- IOSSelector to locate the elementappId- Optional app bundle ID to targettimeout- Max time to wait
Double taps on a native element.Parameters:
selector- Element to tapappId- Optional app bundle IDtimeout- Max wait time
Taps at specific screen coordinates.Location values must be in the 0-1 range (normalized coordinates).
Text Entry
Enters text into a native iOS text field.The element must be a
TextField or SecureTextField.Parameters:selector- The text field to targettext- Text to enter (required)appId- Optional app bundle IDkeyboardBehavior- How to handle the keyboardtimeout- Max wait timetapLocation- Where to tap before entering text
Enters text into the nth visible text field.Parameters:
text- Text to enterindex- Index of the text field (required)appId- Optional app bundle IDkeyboardBehavior- Keyboard handlingtimeout- Max wait time
Gestures
Performs a swipe gesture.Parameters:
from- Starting point (0-1 range)to- Ending point (0-1 range)appId- Optional app bundle IDenablePatrolLog- Whether to log action
Performs an iOS back swipe gesture (left to right edge swipe).Parameters:
dy- Vertical position (0-1 range, default: 0.5)appId- Optional app bundle ID
Simulates a pull-to-refresh gesture.Parameters:
from- Starting point (default: center)to- Ending point (default: bottom-center)
UI Inspection
Returns the native iOS UI tree.Parameters:
selector- Optional selector to filter resultsiosInstalledApps- List of installed app bundle IDsappId- Specific app to inspect
Waits until an element becomes visible.
Camera & Photos
Takes and confirms a photo using the device camera.Parameters:
shutterButtonSelector- Custom shutter button selectordoneButtonSelector- Custom done button selectortimeout- Max wait time
Picks a single image from the Photos app.
Picks multiple images from the Photos app.
IOSSelector
The selector class for locating iOS UI elements:IOSElementType Enum
Selector Examples
AppleApp Enum
Common iOS apps:Usage Examples
Handle Face ID Authentication
Open Settings App
Handle Notification Banner
Simulator vs Device Limitations
Some features don’t work on iOS Simulator:- Control Center (
openQuickSettings) - Volume buttons
- Face ID / Touch ID (use runtime simulation instead)
- Camera (use Photos picker instead)
See Also
- PlatformAutomator - Cross-platform interface
- AndroidAutomator - Android-specific methods
- MobileAutomator - Shared mobile methods