Drivers for Appium-android

Source: Internet
Author: User
Tags appium

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:

    1. avd: Starts or connects to the emulator with the given name.
    2. udid: Connect to the device using the given udid.
    3. 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

lockThe 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:

    1. 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.
    2. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.