/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.安装npm及cnpm
brew install -g node
npm install -g cnpm --registry=https://registry.npm.taobao.org
5.安装ios-deploy
cnpm install -g ios-deploy
注:如果报错stderr: xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
,执行sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
原因:Xcode安装路径非系统指定路径。
6.安装xcpretty
gem install xcpretty
7.通过npm install -g 安装以下依赖
babel-eslint@^7.1.1
eslint@^3.10.2
eslint-plugin-import@^2.2.0
eslint-plugin-mocha@^4.7.0
eslint-plugin-promise@^3.3.1
8.安装appium-xcuitest-driver
npm install -g appium-xcuitest-driver
9.配置appium-xcuitest-driver依赖
cd /usr/local/lib/node_modules/appium-xcuitest-driver/WebDriverAgent (如果WebDriverAgent 所在路径和此不同,请自行查找)
mkdir -p Resources/WebDriverAgent.bundle
sh ./Scripts/bootstrap.sh
10.编译WebDriverAgent 【复杂&重要】
cd /usr/local/lib/node_modules/appium-xcuitest-driver/WebDriverAgent
open WebDriverAgent.xcodeproj
如果装过xcode会直接打开为一个工程
更改开发者签名项,改为公司开发者。
编译WebDriverAgentLib
编译WebDriverAgentRunner
build成功后关闭XCode
注:WebDriverAgent的项目源码:https://github.com/facebook/WebDriverAgent/apple,感兴趣可以自己研究下
11.建立WebDriverAgent服务(手机和MAC都在同一个网段下,且都能连接外网)
将WebDriverAgentRunner编译到手机上:
cd /usr/local/lib/node_modules/appium-xcuitest-driver/WebDriverAgent
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=udid4phone' test
( idevice_id --list 命令,可以查看当前连接的所有手机udid )
12.安装appium
npm install -g appium
安装完成后,打开终端执行:appium测试是否成功
13.安装appium-desktop 客户端
appium.io 找downloads,自行下载。
浙公网安备 33010602011771号