美文网首页
appium在Mac下的环境安装与配置

appium在Mac下的环境安装与配置

作者: 人家小姐_01 | 来源:发表于2018-05-21 16:49 被阅读0次

MAC下appium的各种环境安装在历史几天后,终于安装并检测成功(一度想要放弃,各种出错真的是想让人吐血),所以必须要记录一下。

参考:https://testerhome.com/topics/8375

1:安装appium

推荐使用Homebrew进行安装

打开终端,运行:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2:安装Nodejs

brew install node

检查是否安装成功

node -v

npm -v

3:安装cnpm

由于npm源在国外,我们可以使用淘宝镜像进行安装

npm install -g cnpm --registry=https://registry.npm.taobao.org

检查是否安装成功

cnpm -v

之后安装均使用cnpm代替npm

4:安装appium

cnpm install -g appium

5:下载appium的客户端

搜索下载即可

6:安装Carthage(用于管理iOS开发依赖的包)

brew install carthage

7:安装语言依赖

这里以Python为例

brew install python3

检测是否安装成功

python3 -V

pip3 -V

8:使用pip安装

pip3 install Appium-Python-Client

9:安装Java JDK

brew update

brew cask install java

10:下载Android SDK

https://blog.csdn.net/qq629290/article/details/68938651

11:安装相关依赖

brew install libimobiledevice --HEAD #和iOS手机通讯使用

brew install ideviceinstaller # 安装app使用

cnpm install -g ios-deploy #在iOS10使用

gem install xcpretty 真机使用

12:配置环境变量

在.bash_profile中进行配置安卓和Java的环境变量(.bash_profile可能不存在,需要进行创建touch .bash_profile)

方法1:在finder中找到.bash_profile,找不到时可以command+shift+.显示隐藏的文件

方法2:打开终端,vi .bash_profile

输入i进入编辑模式,编辑后,输入esc :wq进行保存退出

配置完环境之后,需要在终端中运行source .bash_profile才可以生效

检测环境变量是否设置成功

终端中输入adb,只要不会输出command not find,证明配置成功

最后:检测appiun 的安装与环境配置是否成功

终端中运行appium-doctor

常见错误:

1:tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

解决:在终端输入

sudo xcode-select -switch /Applications/Xcode8.2.1.app/Contents/Developer//在application中找到xcode的路径

2:cnpm install -g ios-deploy 失败

解决:sudo npm install -g ios-deploy --unsafe-perm=true

3:You don't have write permissions for the /usr/bin directory.

解决:sudo gem install <你要安装的东西> -n/usr/local/bin

4:根据终端的提示去更新brew的版本。

相关文章

网友评论

      本文标题:appium在Mac下的环境安装与配置

      本文链接:https://www.haomeiwen.com/subject/auuzdxtx.html