②Appium环境搭建for Mac

由于Appium的使用是有平台限制的,所以在windows上只能做android的测试,前面已将记录了如何搭建环境。这里在Mac上只说明iOS的搭建过程

* 目录:

1、安装brew
2、安装libimobiledevice
3、安装carthage
4、安装node
5、安装cnpm
6、安装iOS-deploy
7、安装xcpretty
8、安装appium1.6.3
⚠️:
9、安装appium-xcuitest-driver依赖
10、用Xcode编译WebDriverAgent

1、安装brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2、安装libimobiledevice
brew install libimobiledevice --HEAD 
3、安装carthage
brew install carthage
4、安装node

1、安装node的目的是安装npm
按照官方的地址:https://nodejs.org/en/download/ 下载.pkg文件安装
2、配置环境变量
3、安装完成后,node –v,显示nodejs版本号

5、安装cnpm

用npm下载安装会有好多网络问题,安装淘宝的cnpm要比npm好用https://npm.taobao.org/

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

记录:npm 淘宝镜像

npm config get registry 检查配置的源是否正确
npm config set registry https://registry.npm.taobao.org
6、安装iOS-deploy
cnpm install -g ios-deploy
7、安装xcpretty
gem install xcpretty
8、安装appium1.6.3
cnpm install -g [email protected]
⚠️:

以上安装不要在root用户下安装。若出现权限问题,进入root用户将文件权限更改下。然后退出root用户继续安装即可

chmod -R 777 pathForFile
9、安装appium-xcuitest-driver依赖

自带的WebDriverAgent 非常low 请前往GitHub下载最新版本WebDriverAgent
git clone https://github.com/facebook/WebDriverAgent.git

10、替换appium自带的WebDriverAgent

若上一步成功完成,则
cd . /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/
到appium下删除自带的WebDriverAgent文件夹,把克隆下来的替换至appium安装目录
然后:
mkdir -p Resources/WebDriverAgent.bundle (如果有权限问题请加 sudo)
./Scripts/bootstrap.sh
sh ./Scripts/bootstrap.sh -d 的目的就是下载RoutingHttpServer库和其他的一些依赖,如果没有错误,执行下一步

11、用Xcode编译WebDriverAgent

修改下面的内容:


②Appium环境搭建for Mac_第1张图片
image.png

一下的几个文件都要修改一下,步骤同上:


②Appium环境搭建for Mac_第2张图片
image.png

确保此处内容也相应,自动修改


image.png

⚠️:修改完成后,执行!
⚠️:若果编译的过程中有语法错误,应该是9步没有安装好

12、给iPhone安装WebDriverAgent的app

1、建立服务WebDriverAgent ,手机和MAC都在同一个网段下,且都能连接外网
2、关闭Xcode,进入WebDriverAgent 文件夹
cd /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=真机的udid' test

②Appium环境搭建for Mac_第3张图片
image.png

你可能感兴趣的:(②Appium环境搭建for Mac)