https://www.cnblogs.com/qianmaoliugou/p/8506111.html
https://www.cnblogs.com/tangdongchu/p/4432808.html
https://www.jianshu.com/p/c3ef4584e6d8
1.安装jdk(具体方法和配置就不在具体说明了)
2.安装Android sdk,配置sdk环境
下载地址:http://tools.android-studio.org/index.php/sdk/
下载后解压,双击运行SDK Manager.exe文件,勾选Android版本,然后点击‘Install XX packages’按钮


配置sdk环境变量
(1)新增ANDROID_HOME:Android sdk的安装路径

(2)path中增加变量:%ANDROID_HOME%\tools 和 %ANDROID_HOME%\platform-tools
(3)验证是否配置成功,cmd中输入命令:adb --version,出现版本信息说明配置成功

3.连接手机
(1)Android SDK模拟器
双击AVD Manager,在Android virtual Device Manager界面点击Create按钮。选择想要的模拟器。填写相应的参数后,点击ok按钮


(2)下载mumu模拟器(自己上网找)

下载后打开应用,在设置—>开发者选项中启动USB调试
在cmd中 adb connect 127.0.0.1:7555 连接模拟器,再执行 adb devices 查看已连接设备(7555是mumu模拟器默认端口)
(3)genimotion模拟器
下载地址:https://www.genymotion.com/download/

genimotion依赖virtualBox虚拟机,如果本地已安装virtualBox,点击‘without VirtualBox’下载,否则下载‘with VirtualBox’
下载安装后启动,选择Android API和机型,点击install安装,安装后再my installed devices中显示

选择启动机型,点击start启动模拟器。

启动后在设置(Settings)—>Developer Options—>USB Debugging开启


然后cmd中执行:adb devices 可查看
(4)连接实体机
使用USB线连接手机,打开USB调试,adb devices查看连接情况
4.安装python
参考:https://www.jianshu.com/writer#/notebooks/17498469/notes/18167803
5.安装node.js
下载地址:https://nodejs.org/download/ 或cmd进入python安装目录下,运行命令:pip install nodejs 安装
安装完成后,输入node -v 命令和 npm 命令,出现以下信息说明安装成功:

6.安装appium
下载地址:https://github.com/appium/appium-desktop/releases/tag/v1.4.0

windows下安装完成。
下面是mac下的安装方法:
先安装brew:/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
再安装npm:brew install npm
安装cnpm:npm install -g cnpm --registry=https://registry.npm.taobao.org
用cnpm安装appium:cnpm install -g appium
安装好appium后在终端输入appium,如果出现如下界面说明安装成功

如果执行appium报错:Fatal TypeError: Class constructor BaseDriver cannot be invoked without 'new' (如下),查找原因发现是1.9版本不行,卸载后安装1.8版本即可ok。

卸载原appium——> cnpm uninstall -g appium
安装appium1.8版本——> cnpm install -g appium@1.8.1
最后运行命令:appium-doctor,出现以下表示配置成功:

如果执行appium-doctor提示找不到命令,则使用:npm install -g appium-doctor 先安装appium-doctor,再执行
安装selenium或Appium-python-client
(1)首先要安装pip:sudo easy_install pip
(2)然后安装appium-python-client,在终端窗口输入命令:sudo pip install Appium-Python-Client
提示:You are using pip version 9.0.1, however version 18.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' comm
and.
网上搜到解决办法,执行命令:python -m pip install --upgrade pip
但是报错:

此时在终端中输入python,然后输入import appium(或import selenium),如果不报错说明安装成功
参考资料:
mac下环境搭建:https://www.jianshu.com/p/c91e073cb859
mac下Android自动化测试配置和脚本编写:https://www.jianshu.com/p/fd068f80f9b2
解决mac下python3不识别appium的情况:https://www.cnblogs.com/meitian/p/5699315.html
安装问题参考:https://www.jianshu.com/p/244a929e5584
网友评论