Appium Android Driver is a test automation tool for Android devices. Appium Android Driver automates native, hybrid and mobile web apps, tested on simulators, emulators and real devices. Appium Android Driver is part of the Appium mobile test automation tool.
npm install appium-android-driver
Import Android Driver, set desired capabilities and create a session:
import { AndroidDriver } from `appium-android-driver`
let defaultCaps = {
app: 'path/to/your.apk',
deviceName: 'Android',
platformName: 'Android'
};
let driver = new AndroidDriver();
await driver.createSession(defaultCaps);
Run commands:
await driver.setOrientation('LANDSCAPE');
console.log(await driver.getOrientation()); // -> 'LANDSCAPE'
Command |
---|
activateIMEEngine |
availableIMEEngines |
back |
background |
clear |
click |
complexTap |
deactivateIMEEngine |
defaultContextName |
defaultWebviewName |
doKey |
doTouchAction |
doTouchDrag |
drag |
elementDisplayed |
elementEnabled |
elementSelected |
fakeFlick |
fakeFlickElement |
findElOrEls |
fixRelease |
flick |
getActiveIMEEngine |
getAlertText |
getAttribute |
getContexts |
getCurrentActivity |
getCurrentContext |
getDeviceTime |
getLocationInView |
getLog |
getLogTypes |
getName |
getNetworkConnection |
getOrientation |
getPageSource |
getScreenshot |
getSize |
getStrings |
getText |
getWindowSize |
hideKeyboard |
installApp |
isAppInstalled |
isIMEActivated |
isLocked |
isWebContext |
keyevent |
keys |
lock |
longPressKeyCode |
onChromedriverStop |
openNotifications |
openSettingsActivity |
parseTouch |
performGesture |
performMultiAction |
performTouch |
pinchClose |
pinchOpen |
postAcceptAlert |
postDismissAlert |
pressKeyCode |
pullFile |
pullFolder |
pushFile |
removeApp |
replaceValue |
reset |
setAlertText |
setContext |
setGeoLocation |
setLocation |
setNetworkConnection |
setOrientation |
setValue |
setUrl |
startActivity |
startChromedriverProxy |
stopChromedriverProxies |
suspendChromedriverProxy |
swipe |
tap |
toggleData |
toggleFlightMode |
toggleLocationServices |
toggleSetting |
toggleWiFi |
touchDown |
touchLongClick |
touchMove |
touchUp |
unlock |
wrapBootstrapDisconnect |
npm run watch
npm test