1. 必要条件
XCode >= 6.0, 7.1.1(注意Appiun并不一定支持最新版本的Xcode)
Appium
Mac OS X 10.10 or 更高, 建议使用10.11.1
Xcode 安装
APP Store安装
注意事项: Xcode 安装包很大(5G左右),Xcode移动到应用程序(10G左右)所以一定要有足够的空间来安装
Xcode安装完启动,有时候会卡在"正在检验Xcode"其实不是卡,是本生需要很长时间,耐心等待就可以。大概3-5分钟?
Appium安装
第一种安装方式:使用brew和node安装
查看brew,node是否安装
$ brew -v
Homebrew 0.9.5 (git revision 9107; last commit 2016-01-19)
$ node -v
v5.3.0
$ npm install -g appium #安装appium
$ appium #启动appium
$ npm install -g appium-doctor # 安装appium-doctor
检查appium-doctor是否安装成功
$ appium-doctor
这种安装经常出现下面的问题
1)使用非root权限,安装会出现下面问题
$ npm install -g appium
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/appium'
npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/appium']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/appium',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/appium',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23',
npm ERR! '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53',
npm ERR! 'Object.oncomplete (fs.js:107:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 13.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "appium"
npm ERR! cwd /Users/test2/temp
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! path /usr/local/lib/node_modules/appium
npm ERR! fstream_path /usr/local/lib/node_modules/appium
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules/appium'
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/test2/temp/npm-debug.log
npm ERR! not ok code 0
$ appium
error: Appium will not work if used or installed with sudo. Please rerun/install as a non-root user. If you had to install Appium using sudo npm install -g appium, the solution is to reinstall Node using a method (Homebrew, for example) that doesn't require sudo to install global npm packages.
localhost:temp test2$ sudo appium
error: Appium will not work if used or installed with sudo. Please rerun/install as a non-root user. If you had to install Appium using sudo npm install -g appium, the solution is to reinstall Node using a method (Homebrew, for example) that doesn't require sudo to install global npm packages.
$ sudo chmod -R 777 /usr/local/lib
安装以后显示如下
2. IOS 设置
1)使用官方提供的TestAPP执行第一个测试
下载地址:https://github.com/appium/sample-code
$ git clone [email protected]:appium/sample-code.git
2)使用官方提供 的TestApp设定Appium_IOS
地址 sample-code/sample-code/apps/TestApp/build/release-iphonesimulator/TestApp.app
错误Log
修改设备信息
设置好重新启动,启动成功如下显示