您的位置:首页 > 移动开发

Appium - iOS Mac环境结构

2015-08-08 14:05 369 查看
Appium - iOS Mac环境结构

笔者: Max.Bai

时间: 2014/10

1. iOS开发环境的搭建

1.1系统要求

MacOS X 10.7 or higher, 10.9.2 recommended

1.2 xcode要求

xcode6.0(Appium 1.3)。 xcode5.0(Appium1.2)

1.3 Apple Developer Tools (iPhone simulator SDK, command line tools)

安装ios SDK,command line tools

2. Node js安装

方法1. 打开http://nodejs.org/安装Node js

方法2. homebrew install node.js

成功安装命令行运行

Node -v 正确显示Node js 版本号

npm -v 显示npm 版本号

3. Appium安装

1.检查PATH包括/usr/local/bin

$PATH输出结果包括 /usr/local/bin

2.安装

切记:不要使用 sudo npm install -g appium 安装

cd /usr/local

sudo chown -Rf <当前用户>:staff /usr/local

npm install -g appium
npm install appium@版本

3. 假设安装出现例如以下错误:

npm ERR! fetch failed https://registry.npmjs.org/appium/-/appium-0.12.1.tgz
改动npm 配置:npm config set registry http://registry.npmjs.org
能够使用国内源安装

npm --registry http://registry.cnpmjs.org install -g appium

npm --registry https://registry.npm.taobao.org install -g appium


appium -v 显示版本安装正确

4. Webdriver 安装

npm install wd

5. Appium权限设置

sudo authorize_ios

6. Appium检測环境

node appium-doctor

7. Appium打开

开启Appium

Appium-a 192.168.9.63 -p 4723

假设须要须要连接Grid hub 的请自行开启hub,怎样开启hub

链接grid hub须要參数--nodeconfig /abs/path/to/nodeconfig.json

其它參数开启參数例如以下:
https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/server-args.md
nodeConfig.json

{
"capabilities":
[
{
"browserName": "Safari(or iPhone...)",
"version":"7.1",
"maxInstances": 1,
"platform":"Mac",
"platformName":"iOS",
"platformVersion":"7.1"
}
],
"configuration":
{
"cleanUpCycle":2000,
"timeout":30000,
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"url":"http://192.168.9.63:4723/wd/hub",
"maxSession": 1,
"port": 4723,
"host": "192.168.9.63",
"register": true,
"registerCycle": 5000,
"hubPort": 4444,
"hubHost": "192.168.9.60"
}
}
单机开启后

开启成功后能够通过链接查看http://192.168.9.63:4723/

显示That URL did not map to a valid JSONWP resource

说明开启成功

链接grid hub 的要到hub 上查看。 比方 192.168.9.60:4444/grid/console/

查看ios Appium是否已经连接上。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: