Activity:
Start Activity:
Start an Android activity by providing package name and activity name
Get the name of the current Android activity
Syntax:
Get the name of the current Android package
String package = driver.getCurrentPackage();
Install the given app onto the device
driver.installApp("/Users/johndoe/path/to/app.apk");
Check whether the specified app is installed on the device
driver.isAppInstalled("com.example.AppName");
Launch the app-under-test on the device
Send the currently running app for this session to the background
Close an app on device
driver.closeApp();
Reset the currently running app for this session
driver.resetApp();
Remove an app from the device
Activate the given app onto the device
Terminate the given app on the device
For Android:
driver.terminateApp('com.apple.Preferences');
For IOS:
driver.terminateApp('io.appium.android.apis');
Get the given app status on the device
For Android:
driver.queryAppState('com.apple.Preferences');
For IOS:
driver.queryAppState('io.appium.android.apis');
Get app strings
Map<String, String> appStrings = driver.getAppStringMap("en", "/path/to/file");
Get test coverage data
driver.endTestCoverage("Intent", "/path");
Get the content of the system clipboard
driver.getClipboard(ClipboardContentType.PLAINTEXT); // get plaintext
driver.getClipboardText();
Set the content of the system clipboard
// base64Content is Base64-encoded content
driver.setClipboard("label", ClipboardContentType.PLAINTEXT, base64Content);
driver.setClipboardText("happy testing");
Emulate power state change on the connected emulator.
Emulate power capacity change on the connected emulator.
driver.setPowerCapacity(100);
Place a file onto the device in a particular place
driver.pushFile("/data/local/tmp/foo.bar", new File("/Users/johndoe/files/foo.bar"));
Retrieve a file from the device's file system
Retrieve a folder from the device's file system
Perform a shake action on the device
Lock the device
driver.lockDevice();
Unlock the device
driver.unlockDevice();
Check whether the device is locked or not
boolean isLocked = driver.isDeviceLocked();
Rotate the device in three dimensions
Press a particular key on an Android Device
See https://developer.android.com/reference/android/view/KeyEvent.html for reference of available Android key code values
Press and hold a particular key code on an Android device
driver.longPressKeyCode(AndroidKeyCode.HOME);
Hide soft keyboard
driver.hideKeyboard();
boolean isKeyboardShown = driver.isKeyboardShown();
Toggle airplane mode on device
driver.toggleAirplaneMode();
Switch the state of data service
driver.toggleData();
Switch the state of the WiFi service
Switch the state of the location service
Simulate an SMS message (Emulator only)
driver.sendSMS("555-123-4567", "Hey lol");
Make GSM call (Emulator only)
driver.makeGsmCall("5551234567", GsmCallActions.CALL);
Set GSM signal strength (Emulator only)
Set GSM voice state (Emulator only)
driver.setGsmVoice(GsmVoiceState.HOME);
Set network speed (Emulator only)
Returns the information of the system state which is supported to read as like cpu, memory, network traffic, and battery
List<List<Object>> performanceData = driver.getPerformanceData("my.app.package", "cpuinfo", 5);
Returns the information types of the system state which is supported to read as like cpu, memory, network traffic, and battery
List<String> performanceTypes = driver.getSupportedPerformanceDataTypes();
Start recording screen
driver.startRecordingScreen();
driver.startRecordingScreen(new BaseStartScreenRecordingOptions(....));
driver.stopRecordingScreen();
driver.stopRecordingScreen(new BaseStopScreenRecordingOptions(....));
Simulate a touch id event (iOS Simulator only)
driver.performTouchID(false); // Simulates a failed touch
driver.performTouchID(true); // Simulates a passing touch
Toggle the simulator being enrolled to accept touchId (iOS Simulator only)
driver.toggleTouchIDEnrollment(true);
Open Android notifications (Emulator only)
driver.openNotifications();
Retrieve visibility and bounds information of the status and navigation bars
Map<String, String> systemBars = driver.getSystemBars();
Retrieve display density(dpi) of the Android device
driver.getDeviceDensity();
Authenticate users by using their finger print scans on supported emulators.
driver.fingerPrint(1);
For Android emulator. Authenticate users by using their finger print scans.
Touch ID by iOS is here.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.