MobileAutomator class

Mobile-specific automator that works across Android and iOS.

Constructors

MobileAutomator({required PlatformAutomator platform})
Creates a new MobileAutomator.

Properties

hashCode int
The hash code for this object.
no setterinherited
platform PlatformAutomator
The parent platform automator.
final
resolvedAppId String
Returns the platform-dependent unique identifier of the app under test.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

closeNotifications() Future<void>
Closes the notification shade.
denyPermission() Future<void>
Denies the permission that the currently visible native permission request dialog is asking for.
disableAirplaneMode() Future<void>
Disables airplane mode.
disableBluetooth() Future<void>
Disables bluetooth.
disableCellular() Future<void>
Disables cellular (aka mobile data connection).
disableDarkMode({String? appId}) Future<void>
Disables dark mode.
disableWifi() Future<void>
Disables Wi-Fi.
doubleTap(CompoundSelector selector, {Duration? timeout, Duration? delayBetweenTaps, String? appId}) Future<void>
Double taps on the native view specified by selector.
enableAirplaneMode() Future<void>
Enables airplane mode.
enableBluetooth() Future<void>
Enables bluetooth.
enableCellular() Future<void>
Enables cellular (aka mobile data connection).
enableDarkMode({String? appId}) Future<void>
Enables dark mode.
enableWifi() Future<void>
Enables Wi-Fi.
enterText(CompoundSelector selector, {required String text, String? appId, KeyboardBehavior? keyboardBehavior, Duration? timeout, Offset? tapLocation}) Future<void>
Enters text to the native view specified by selector.
enterTextByIndex(String text, {required int index, String? appId, KeyboardBehavior? keyboardBehavior, Duration? timeout, Offset? tapLocation}) Future<void>
Enters text to the index-th visible text field.
getFirstNotification() Future<Notification>
Returns the first, topmost visible notification.
getNotifications() Future<List<Notification>>
Returns notifications that are visible in the notification shade.
getOsVersion() Future<int>
Gets the OS version.
grantPermissionOnlyThisTime() Future<void>
Grants the permission that the currently visible native permission request dialog is asking for.
grantPermissionWhenInUse() Future<void>
Grants the permission that the currently visible native permission request dialog is asking for.
isPermissionDialogVisible({Duration timeout = const Duration(seconds: 1)}) Future<bool>
Waits until a native permission request dialog becomes visible within timeout.
isVirtualDevice() Future<bool>
Checks if the app is running on a virtual device (simulator or emulator).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
openApp({String? appId}) Future<void>
Opens the app specified by appId. If appId is null, then the app under test is started (using resolvedAppId).
openNotifications() Future<void>
Opens the notification shade.
openPlatformApp({Object? androidAppId, Object? iosAppId}) Future<void>
Opens a platform-specific app.
openQuickSettings() Future<void>
Opens the quick settings shade on Android and Control Center on iOS.
openUrl(String url) Future<void>
Opens the URL specified by url.
pickImageFromGallery({CompoundSelector? imageSelector, int? index, Duration? timeout}) Future<void>
Pick an image from the gallery
pickMultipleImagesFromGallery({required List<int> imageIndexes, CompoundSelector? imageSelector, Duration? timeout}) Future<void>
Pick multiple images from the gallery
pressHome() Future<void>
Presses the home button.
pressRecentApps() Future<void>
Presses the recent apps button.
pressVolumeDown() Future<void>
Press volume down
pressVolumeUp() Future<void>
Press volume up
pullToRefresh({Offset from = const Offset(0.5, 0.5), Offset to = const Offset(0.5, 0.9), int steps = 50}) Future<void>
Simulates pull-to-refresh gesture.
selectCoarseLocation() Future<void>
Select the "coarse location" (aka "approximate") setting on the currently visible native permission request dialog.
selectFineLocation() Future<void>
Select the "fine location" (aka "precise") setting on the currently visible native permission request dialog.
sendKeyboardEnter() Future<void>
Sends the keyboard Enter/Return action to the currently focused input.
setMockLocation(double latitude, double longitude, {String? packageName}) Future<void>
Set mock location
stopMockLocation() Future<void>
Stops the mock location updates that were started by setMockLocation.
swipe({required Offset from, required Offset to, int steps = 12, String? appId, bool enablePatrolLog = true}) Future<void>
Swipes from from to to.
swipeBack({double dy = 0.5, String? appId}) Future<void>
Mimics the swipe back (left to right) gesture.
takeCameraPhoto({CompoundSelector? shutterButtonSelector, CompoundSelector? doneButtonSelector, Duration? timeout}) Future<void>
Take and confirm the photo
tap(CompoundSelector selector, {Duration? timeout}) Future<void>
Taps on the native view specified by selector.
tapAt(Offset location, {String? appId}) Future<void>
Taps at a given location.
tapOnNotificationByIndex(int index, {Duration? timeout}) Future<void>
Searches for the index-th visible notification and taps on it.
tapOnNotificationBySelector(CompoundSelector selector, {Duration? timeout}) Future<void>
Taps on the visible notification using selector.
toString() String
A string representation of this object.
inherited
waitUntilVisible(CompoundSelector selector, {String? appId, Duration? timeout}) Future<void>
Waits until the native view specified by selector becomes visible.

Operators

operator ==(Object other) bool
The equality operator.
inherited