**
(Mac 版)
**
步骤:
我用的是npm 下载appium 1.6.3的版本。
1.在下载之前先要安装brew 。
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" #下载
$ brew update #更新
下载完成后可查看是否安装成功
brew -v
2.安装node 和 npm
brew install node
node -v
brew install npm
3.使用npm来安装appium,2017/01/03目前最新的版本是 1.6.3 ,当然也可以在 Macos下bitbucket下载appium客户端,但是坑人的是最新版本是 1.5.3 支持的还只是 iOS10 以下的 UIAutomation 框架基础上测试,而 iOS10 以后苹果使用的却是基于 XCUITest ,所以只能采用npm安装咯。但是因为国内墙太高而使用npm却是从国外服务器下载,有时候使用npm需要非常长的时间,更多时候是失败,推荐使用cnpm来安装:淘宝 NPM 镜像 10分钟同步npmjs.org镜像,使用方式和npm完全一致
本人用的* proxy
npm install cnpm -g --registry=https://registry.npm.taobao.org
npm view appium versions #查看appium所有的版本号
npm install appium-doctor#安装appium-doctor
4.使用cnpm安装appium和appium-doctor:
cnpm install -g appium --no-cache
cnpm install -g appium
cnpm install -g appium-doctor
5.检查appium环境:
Java 环境和Android环境请自行百度安装。推荐虫师的博客。http://www.cnblogs.com/fnng/
6.安装appium客户端,上面的操作只是安装了server端,接下来需要安装测试代码运行所依赖的客户端,我们以python为例:
```
7.对于 iOS10 以上的测试,需要下载安装 appium-xcuitest-driver 驱动:Appium iOS driver, backed by Apple XCUITest , 当然也可以在 /usr/local/lib/node_modules/appium/node_modules/.2.5.1@appium-xcuitest-driver/WebDriverAgent/ 找到该项目,执行 carthage update , 选择 WebDriverAgentRunner 这个target编译即可。
其他相关的安装:
brew install libimobiledevice –HEAD # install from HEAD to get important updates brew install ideviceinstaller # 只是对iOS9有用
npm install -g ios-deploy # iOS10 以后的版本安装ios-deploy sudo gem install xcpretty # 真机需要安装 xcpretty
“`
也可参考Appium 官方文档https://github.com/appium/appium
安装完成后可测试Appium是否安装成功
问题:
1.npm 安装时需要*
2.如果有账户需要用sudo安装,即需要输入密码,安装命令如下:
sudo npm install -g appium
3.在安装出错后,需卸载appium 之后再重新安装,卸载命令:sudo npm uninstall appium
4.遇到如下报的错误,可以把下载地址拷贝到浏览器中下载。
bogon:~xxx $ sudo npm install -g appium
/usr/local/bin/appium -> /usr/local/lib/node_modules/appium/build/lib/main.js
sqlite3@3.1.8 install /usr/local/lib/node_modules/appium/node_modules/sqlite3
node-pre-gyp install –fallback-to-build
node-pre-gyp ERR! Tried to download(undefined): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.8/node-v48-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for sqlite3@3.1.8 and node@6.9.5 (node-v48 ABI) (falling back to source compile with node-gyp)
ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c
TOUCH Release/obj.target/deps/action_before_build.stamp
CC(target) Release/obj.target/sqlite3/gen/sqlite-autoconf-3150000/sqlite3.o
LIBTOOL-STATIC Release/sqlite3.a
CXX(target) Release/obj.target/node_sqlite3/src/database.o
../src/database.cc:133:18: warning: ‘ForceSet’ is deprecated
[-Wdeprecated-declarations]
info.This()->ForceSet(Nan::New(“filename”).ToLocalChecked(), info[0]…
^
/Users/xxx/.node-gyp/6.9.5/include/node/v8.h:2695:22: note: ‘ForceSet’ has
xxx/been explicitly marked deprecated here
bool ForceSet(Local key, Local value,
^
../src/database.cc:134:18: warning: ‘ForceSet’ is deprecated
[-Wdeprecated-declarations]
info.This()->ForceSet(Nan::New(“mode”).ToLocalChecked(), Nan::New(mo…
^
/Users/xxx/.node-gyp/6.9.5/include/node/v8.h:2695:22: note: ‘ForceSet’ has
been explicitly marked deprecated here
bool ForceSet(Local key, Local value,
^
../src/database.cc:144:9: warning: unused variable ‘status’ [-Wunused-variable]
int status = uv_queue_work(uv_default_loop(),
^
../src/database.cc:230:9: warning: unused variable ‘status’ [-Wunused-variable]
int status = uv_queue_work(uv_default_loop(),
^
../src/database.cc:525:9: warning: unused variable ‘status’ [-Wunused-variable]
int status = uv_queue_work(uv_default_loop(),
^
../src/database.cc:625:9: warning: unused variable ‘status’ [-Wunused-variable]
int status = uv_queue_work(uv_default_loop(),
^
6 warnings generated.
CXX(target) Release/obj.target/node_sqlite3/src/node_sqlite3.o
CXX(target) Release/obj.target/node_sqlite3/src/statement.o
../src/statement.cc:103:18: warning: ‘ForceSet’ is deprecated
[-Wdeprecated-declarations]
info.This()->ForceSet(Nan::New(“sql”).ToLocalChecked(), sql, ReadOnly);
^
/Users/xxx/.node-gyp/6.9.5/include/node/v8.h:2695:22: note: ‘ForceSet’ has
been explicitly marked deprecated here
bool ForceSet(Local key, Local value,
^
../src/statement.cc:118:9: warning: unused variable ‘status’ [-Wunused-variable]
int status = uv_queue_work(uv_default_loop(),
^
../src/statement.cc:322:5: warning: unused variable ‘status’ [-Wunused-variable]
STATEMENT_BEGIN(Bind);
^
../src/macros.h:125:9: note: expanded from macro ‘STATEMENT_BEGIN’
int status = uv_queue_work(uv_default_loop(), \
^
../src/statement.cc:370:5: warning: unused variable ‘status’ [-Wunused-variable]
STATEMENT_BEGIN(Get);
^
../src/macros.h:125:9: note: expanded from macro ‘STATEMENT_BEGIN’
int status = uv_queue_work(uv_default_loop(), \
^
../src/statement.cc:438:5: warning: unused variable ‘status’ [-Wunused-variable]
STATEMENT_BEGIN(Run);
^
../src/macros.h:125:9: note: expanded from macro ‘STATEMENT_BEGIN’
int status = uv_queue_work(uv_default_loop(), \
^
../src/statement.cc:504:5: warning: unused variable ‘status’ [-Wunused-variable]
STATEMENT_BEGIN(All);
^
../src/macros.h:125:9: note: expanded from macro ‘STATEMENT_BEGIN’
int status = uv_queue_work(uv_default_loop(), \
^
../src/statement.cc:601:5: warning: unused variable ‘status’ [-Wunused-variable]
STATEMENT_BEGIN(Each);
^
../src/macros.h:125:9: note: expanded from macro ‘STATEMENT_BEGIN’
int status = uv_queue_work(uv_default_loop(), \
^
../src/statement.cc:724:5: warning: unused variable ‘status’ [-Wunused-variable]
STATEMENT_BEGIN(Reset);
^
../src/macros.h:125:9: note: expanded from macro ‘STATEMENT_BEGIN’
int status = uv_queue_work(uv_default_loop(), \
^
8 warnings generated.
SOLINK_MODULE(target) Release/node_sqlite3.node
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9
COPY /usr/local/lib/node_modules/appium/node_modules/sqlite3/lib/binding/node-v48-darwin-x64/node_sqlite3.node
TOUCH Release/obj.target/action_after_build.stamp
appium-chromedriver@2.9.4 install /usr/local/lib/node_modules/appium/node_modules/appium-chromedriver
node install-npm.js
info Chromedriver Install Installing Chromedriver version ‘2.25’ for platform ‘mac’ and architecture ‘64’
info Chromedriver Install Opening temp file to write chromedriver_mac64 to…
info Chromedriver Install Downloading https://chromedriver.storage.googleapis.com/2.25/chromedriver_mac64.zip…
info Chromedriver Install Writing binary content to /usr/local/lib/node_modules/appium/node_modules/appium-chromedriver/201721-2404-hg3ybx.ldznx0qkt9/chromedriver_mac64.zip…
info Chromedriver Install Extracting /usr/local/lib/node_modules/appium/node_modules/appium-chromedriver/201721-2404-hg3ybx.ldznx0qkt9/chromedriver_mac64.zip to /usr/local/lib/node_modules/appium/node_modules/appium-chromedriver/201721-2404-hg3ybx.ldznx0qkt9/chromedriver_mac64
info Chromedriver Install Creating /usr/local/lib/node_modules/appium/node_modules/appium-chromedriver/chromedriver/mac…
info Chromedriver Install Copying unzipped binary, reading from /usr/local/lib/node_modules/appium/node_modules/appium-chromedriver/201721-2404-hg3ybx.ldznx0qkt9/chromedriver_mac64/chromedriver…
info Chromedriver Install Writing to /usr/local/lib/node_modules/appium/node_modules/appium-chromedriver/chromedriver/mac/chromedriver…
info Chromedriver Install /usr/local/lib/node_modules/appium/node_modules/appium-chromedriver/chromedriver/mac/chromedriver successfully put in place
appium-selendroid-driver@1.4.3 install /usr/local/lib/node_modules/appium/node_modules/appium-selendroid-driver
node ./bin/install.js
dbug AndroidDriver Getting Java version
info AndroidDriver Java version is: 1.8.0_65
info Selendroid Ensuring /usr/local/lib/node_modules/appium/node_modules/appium-selendroid-driver/selendroid/download exists
info Selendroid Downloading Selendroid standalone server version 0.17.0 from http://repo1.maven.org/maven2/io/selendroid/selendroid-standalone/0.17.0/selendroid-standalone-0.17.0-with-dependencies.jar –> /usr/local/lib/node_modules/appium/node_modules/appium-selendroid-driver/selendroid/download/selendroid-server-7cf7163ac47f1c46eff95b62f78b58c1dabdec534acc6632da3784739f6e9d82.jar