Installing the Android SDK
Android SDK (software Development Kit, Software Development Kit) provides Android API libraries and development tools to build, test and debug applications. In simple terms, the Android SDK can be seen as a software for developing and running Android apps.
1. Download the Android SDK
I did not find the download link for the standalone Android SDK on the official website, and it is recommended to download Android Studio with Android SDK.
Android Studio & Android SDK:HTTPS://DEVELOPER.ANDROID.COM/STUDIO/INDEX.HTML?HL=ZH-CN
Drag to the bottom of the page, you will find the download link, according to your own platform select the corresponding link to download.
On the one hand is the installation package of Android Studio containing Android SDK is very large. On the other hand they are not strongly correlated either. Because Appium also uses the Android SDK, Android Studio can also call the real machine to run Android programs.
So, the Android SDK (which is what we want):
Http://tools.android-studio.org/index.php/sdk
You can download it from other websites, and it's an essential skill for it practitioners to use search tools and scientific Internet tools.
Unzip the downloaded Android SDK to get the following directory.
Figure Android SDK Directory
2. Set the Android environment variable
The following sets the ANDROID environment variable, similar to the Java environment variable. The result of my local directory is:
D:\android\android-sdk-windows
Set Environment variables below:
"My Computer" right-click menu, Properties, advanced-environment variables, system variables-New ...
| Variable name |
Variable Value |
| Android_home |
D:\android\Android\sdk |
Locate the PATH variable name, "edit" to add:
| Variable name |
Variable Value |
| PATH |
;%android_home%\platform-tools;%android_home%\tools; |
3. Install Android version
Double-click SDK Manage.exe to Launch SDK Manager.
You need science to surf the internet, or find a home Android image to install a version of Android virtual machine. You can choose to install the Android 5.0/5.1/6.0/7.0 version according to your preference.
A website is recommended here: http://www.androiddevtools.cn/
3. Start Genymotion Simulator
Gennymotion Installation Note: Be sure to choose a newer version, and the Virtual-box version of the package can not be too low, genymotion registered after the use of a free check for the good. Download the corresponding version of the image
Installing Python-client
In fact, Python-client project name is called: Appium-python-client.
Recommended PIP Installation:
(venv) λ pip install Appium-Python-ClientCollecting Appium-Python-Client Using cached Appium-Python-Client-0.24.tar.gzRequirement already satisfied: selenium>=2.47.0 in d:\pyflask\venv\lib\site-packages (from Appium-Python-Client)Building wheels for collected packages: Appium-Python-Client Running setup.py bdist_wheel for Appium-Python-Client ... done Stored in directory: C:\Users\fnngj\AppData\Local\pip\Cache\wheels\2e\cf\10\0e3f177c9869147b16584d402f79d9007df1139105ea3ecc2cSuccessfully built Appium-Python-ClientInstalling collected packages: Appium-Python-ClientSuccessfully installed Appium-Python-Client-0.24
Then build the Python script: test.py
#Coding=utf-8
From Appium import Webdriver
Import time
Desired_caps = {}
desired_caps[' platformname ' = ' Android '
desired_caps['platformversion '] = ' 6.0 '
#安卓镜像名, Contents: C:\Users\Administrator\AppData\Local\Genymobile\Genymotion\ova
desired_caps[' devicename '] = ' genymotion_vbox86p_6.0_170320_193253 '
Desired_caps[ ' apppackage '] = Com.android.calculator2 '
Desired_caps[ ' appactivity '] = . Calculator '
Driver = webdriver. Remote ( ' Http://localhost:4723/wd/hub ', desired_caps)
Driver.find_element_by_name ( "9"). Click ()
Driver.find_element_by_name ( "+"). Click ()
Driver.find_element_by_name ( "6"). Click ()
Driver.find_element_by_name (
Note: Some version of the location will be invalid, you can use Name,id and so on to try, or directly change the Android phone version
2. Install the Android SDK