1. 安装Node.js
安装包路径:https://nodejs.org/download/release/latest-v8.x/
安装后,验证:type “node –v” in cmd
2. 安装Android SDK
安装包路径:http://tools.android-studio.org/index.php/sdk
解压到“android-sdk”,然后打开SDK Manager.exe 安装 tools, platform tools
设置环境变量:ANDROID_HOME: D:\Program Files (x86)\android-sdk
Path: ;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools
Note:
Android Studio: http://www.android-studio.org/
3 安装JDK
安装包路径:http://www.oracle.com/technetwork/java/javase/downloads/index.html
安装后设置环境变量:JAVA_HOME:C:\Program Files\Java\jdk1.8.0_144
Path: ;%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin
4 安装 Apache Ant
安装包路径:http://ant.apache.org/bindownload.cgi
解压后设置环境变量:ANT_HOME: D:\Program Files (x86)\apache-ant-1.10.1
Path: ;%ANT_HOME%\bin
验证:type “ant”, “ant –v” in cmd
5 安装.net 4.5
安装包路径:https://www.microsoft.com/net/download/framework
6 配置Android版appium客户端
安装包路径:https://bitbucket.org/appium/appium.app/downloads/
http://appium.io/
安装.msi,配置环境变量: path: ; D:\Program Files (x86)\Appium\node_modules\.bin
Type “appium-doctor” to verify, it will prompt “All Checks were successfully”.
[detailed: http://www.cnblogs.com/ydnice/p/5787800.html]
7.1 使用Python
- pip install Appium-Python-Client
- 开启模拟器 或 真机 (真机与电脑USB连接,且须开启 USB debug;device name如下)
- 打开Appium,在”Android Settings\Capabilities” , Platform version 须与使用的模拟器或真机版本一致;并”Launch Appium Server”
- 通过Python脚本调用
【Note:
v Package: 打开应用程序 -> uiautomatorviewer.bat -> 查看 package
v Activity:
① 找源码,问开发者;
② 查日志:a) 在cmd中运行(run as administrator) adb logcat > xxx.log
b) 在手机打开App
c) 在cmd中按ctrl-c停止
d) 在xxx.log查找”package名/”,后面跟的就有Activity,不过可能会找到很多个,要自己过滤一下
③ 先在手机上运行App,再在cmd中执行“adb shell dumpsys window windows”,然后看mFocusedApp这一行的内容,我试过一些不同的App,有一些得出的Activity填到Appium之后,提示不能Launch,但是也可以试试,毕竟比②简单。
v 元素定位:打开应用程序 -> uiautomatorviewer.bat -> 查看 resource-id
7.2 安装Eclipse
安装包地址:https://www.eclipse.org/downloads/eclipse-packages/?show_instructions=TRUE#page-download,选择” Eclipse IDE for Java EE Developers”
Open Eclipse.exe, Help -> Install New Software -> Add
1) Name: TestNG
- Location: http://beust.com/eclipse
2) Name: SVN
Location: https://dl.bintray.com/subclipse/releases/subclipse/latest/
【建议勾选全部,详见https://github.com/subclipse/subclipse/wiki】
3) ADT: link1:https://pan.baidu.com/s/1sl2BZit
Link2: http://freewareupdate.com/download-android-developer-tools/
Open Eclipse.exe, Help -> Install New Software -> Add Achieve…, select the zip file and install all.
Note: Eclipse -> Window -> Preferences -> Android, set the SDK location to SDK folder, you will see the “Android”, if not, reinstall the ADT.
- Install related Android API through Andriod-SDK\...\SDK Manager, or Eclipse->Window->Android SDK Manager
Note:Wait till the progress in the right behind corner is done. Can also check from Help -> Install New Software -> Manage.. -> Install/Update\Available Software Sites.