Appium Android Driver is a test automation tool for Android devices. Appium Android drivers automate native, hybrid and mobile Web applications that are tested on emulators, emulators, and real-world devices. Appium Android drivers are part of the Appium Mobile test automation tool.
Note : Issue tracking for this repo has been disabled. instead, use The main appium problem tracker .
installation
NPM Install Appium-android-driver
usage
Import android drivers, set Required Features and create a session:
Import {androiddriver} from ' appium-android-driver ' let defaultcaps = { app: ' path/to/your.apk ', devicename: ' A Ndroid ', platformname: ' Android '}; Let Driver = new androiddriver (); await driver.createsession (defaultcaps);
To run the command:
Await driver.setorientation (' LANDSCAPE '); Console.log (await driver.getorientation ()); ' LANDSCAPE '
specifying and selecting devices/emulators
The driver attempts to desiredCapabilities
connect to the device/emulator based on these properties in the object:
avd
: Starts or connects to the emulator with the given name.
udid
: Connect to the device using the given udid.
platformVersion
: The first device or active emulator connected to the operating system starting with the desired operating system. This means that if more than one is available, the first device is fetched from the output platformVersion: 5
5x
adb devices
.
If these features are not given, the driver will connect to the first device or the active emulator returned from the output adb devices
.
If multiple features in these features are given, the driver will only use the functionality in the order described above. That is avd
priority udid
, priority platformVersion
.
Command
1 Command2 Activateimeengine3 Availableimeengines4 Back5 background6 Clear7 Click8 Complextap9 DeactivateimeengineTen Defaultcontextname One Defaultwebviewname A Dokey - dotouchaction - Dotouchdrag the Drag - elementdisplayed - elementenabled - elementselected + Fakeflick - fakeflickelement + Findelorels A Fixrelease at flick - Getactiveimeengine - Getalerttext - getattribute - getcontexts - getcurrentactivity in Getcurrentcontext - Getdevicetime to getdisplaydensity + Getlocationinview - GetLog the Getlogtypes * GetName $ getnetworkconnectionPanax Notoginseng getorientation - Getpagesource the Getscreenshot + GetSize A getstrings the Getsystembars + GetText - getwindowsize $ Hidekeyboard $ Installapp - isappinstalled - isimeactivated the Iskeyboardshown - isLockedWuyi Iswebcontext the KeyEvent - Keys Wu Lock - Longpresskeycode About Onchromedriverstop $ opennotifications - opensettingsactivity - Parsetouch - performgesture A performmultiaction + Performtouch the Pinchclose - Pinchopen $ Postacceptalert the Postdismissalert the Presskeycode the Pullfile the Pullfolder - Pushfile in Removeapp the Replacevalue the Reset About Setalerttext the SetContext the setgeolocation the setlocation + setnetworkconnection - setorientation the SetValueBayi SetUrl the startactivity the Startchromedriverproxy - stopchromedriverproxies - Suspendchromedriverproxy the Swipe the Tap the Toggledata the Toggleflightmode - togglelocationservices the togglesetting the Togglewifi the TouchDown94 Touchlongclick the TouchMove the touchUp the Unlock98 Unlockwithhelperapp About unlockwithuiautomation -Wrapbootstrapdisconnect
API Notes
lock
The behavior in Android is different from the behavior in iOS. in Android, it does not have any parameters and locks the screen and returns immediately.
Developmenttranspile ES2015 Code
Gulp Transpile
Watch
NPM Run Watch
Test
NPM Test
Some tests require a specific emulator. They currently have two aspects:
- API Level 25: Add
ANDROID_25_AVD
The environment variable is set to the name of the AVD, or the default is "Nexus_5_API_25"
. If it does not exist, the test is skipped.
- API Level 24: Add
ANDROID_24_NO_GMS_AVD
The environment variable is set to the name of the AVD, or the default is "Nexus_5_API_24"
. If it does not exist, the test is skipped.
Some tests also require a specific version of Chromedriver (especially 2.20
), the test/assets
folder is available, or you can use the CHROME_2_20_EXECUTABLE
The environment variable is specified.
Drivers for Appium-android