前言
之前的一篇文章介绍了python+appium的简单安卓UI测试,之前一直是用android6.0机器测试的,今天换了android7.0,突然发现appium版本太低了,所以升级appium1.6,中间发生了不少坑,这边记录一下
排坑一
环境要求:
- node最新版本
按照网上搜的方法:
1.命令行中输入:npm uninstall -g appium
2.命令行输入:npm cache clean
3.命令行输入:npm install -g appium
cmd下输入
npm install -g appium
安装失败,日志如下:
C:\Users\dsc\AppData\Roaming\npm\appium -> C:\Users\dsc\AppData\Roaming\npm\node_modules\appium\build\lib\main.js
> appium-chromedriver@3.1.4 install C:\Users\dsc\AppData\Roaming\npm\node_modules\appium\node_modules\appium-chromedrive
r
> node install-npm.js
info Chromedriver Install Installing Chromedriver version '2.33' for platform 'win' and architecture '32'
info Chromedriver Install Opening temp file to write chromedriver_win32 to...
info Chromedriver Install Downloading https://chromedriver.storage.googleapis.com/2.33/chromedriver_win32.zip...
RequestError: Error: read ECONNRESET
at new RequestError (C:\Users\dsc\AppData\Roaming\npm\node_modules\appium\node_modules\request-promise\lib\errors.js
:11:15)
at Request.RP$callback [as _callback] (C:\Users\dsc\AppData\Roaming\npm\node_modules\appium\node_modules\request-pro
mise\lib\rp.js:60:32)
at self.callback (C:\Users\dsc\AppData\Roaming\npm\node_modules\appium\node_modules\request\request.js:186:22)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at Request.onRequestError (C:\Users\dsc\AppData\Roaming\npm\node_modules\appium\node_modules\request\request.js:878:
8)
at emitOne (events.js:116:13)
at ClientRequest.emit (events.js:211:7)
at TLSSocket.socketErrorListener (_http_client.js:387:9)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)
at emitErrorNT (internal/streams/destroy.js:64:8)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\appium\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any
"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! appium-chromedriver@3.1.4 install: `node install-npm.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the appium-chromedriver@3.1.4 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\dsc\AppData\Roaming\npm-cache\_logs\2018-02-08T04_32_40_212Z-debug.log
解决方案
先输入:
set CHROMEDRIVER_CDNURL=[http://npm.taobao.org/mirrors/chromedriver/](http://npm.taobao.org/mirrors/chromedriver/)
在输入:
npm install -g appium@1.6.4 -no-shrinkwrap
耐心等待,
C:\Windows\System32> npm install -g appium@1.6.4 -no-shrinkwrap
npm WARN deprecated babel-core@5.8.24: Babel 5 is no longer being maintained. Upgrade to Babel 6.
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated line-numbers@0.2.0: Copy its ~20 LOC directly into your code instead.
C:\Users\dsc\AppData\Roaming\npm\appium -> C:\Users\dsc\AppData\Roaming\npm\node_modules\appium\build\lib\main.js
> appium-chromedriver@3.3.0 install C:\Users\dsc\AppData\Roaming\npm\node_modules\appium\node_modules\appium-chromedrive
r
> node install-npm.js
info Chromedriver Install Installing Chromedriver version '2.35' for platform 'win' and architecture '32'
info Chromedriver Install Opening temp file to write chromedriver_win32 to...
info Chromedriver Install Downloading http://npm.taobao.org/mirrors/chromedriver//2.35/chromedriver_win32.zip...
info Chromedriver Install Writing binary content to C:\Users\dsc\AppData\Local\Temp\201818-15120-x8vkxd.r1bvk\chromedriv
er_win32.zip...
info Chromedriver Install Extracting C:\Users\dsc\AppData\Local\Temp\201818-15120-x8vkxd.r1bvk\chromedriver_win32.zip to
C:\Users\dsc\AppData\Local\Temp\201818-15120-x8vkxd.r1bvk\chromedriver_win32
info Chromedriver Install Creating C:\Users\dsc\AppData\Roaming\npm\node_modules\appium\node_modules\appium-chromedriver
\chromedriver\win...
info Chromedriver Install Copying unzipped binary, reading from C:\Users\dsc\AppData\Local\Temp\201818-15120-x8vkxd.r1bv
k\chromedriver_win32\chromedriver.exe...
info Chromedriver Install Writing to C:\Users\dsc\AppData\Roaming\npm\node_modules\appium\node_modules\appium-chromedriv
er\chromedriver\win\chromedriver.exe...
info Chromedriver Install C:\Users\dsc\AppData\Roaming\npm\node_modules\appium\node_modules\appium-chromedriver\chromedr
iver\win\chromedriver.exe successfully put in place
.
.
.
.
.
> appium-windows-driver@0.6.0 install C:\Users\dsc\AppData\Roaming\npm\node_modules\appium\node_modules\appium-windows-d
river
> node install-npm.js
info WinAppDriver You must use WinAppDriver version 1.0
info WinAppDriver Verifying WinAppDriver version 1.0 is installed via comparing the checksum.
info WinAppDriver WinAppDriver.exe doesn't exist at the correct version 1.0, setting up
WARNING: You are not running as an administrator so WinAppDriver cannot be installed for you; please reinstall as admin
WinAppDriver was not installed; please check your system and re-run npm install if you need WinAppDriver
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\appium\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any
"} (current: {"os":"win32","arch":"x64"})
+ appium@1.6.4
added 752 packages in 199.478s
至此,appium1.6.4安装成功
检查
输入:
appium
appium -v
appium.png
说明安装成功
排坑二
由于脚本中使用的命令,启动appium服务,运行命令
start appium :p 4754 bp 4721 device:WTKGY17811000030
启动服务失败,这边忘记截图了。
解决方案
node版本降级
卸载最新node,重新安装老版本node,问题解决
总结
总结起来就是一句话:
安装时需要node最新版本,脚本中命令行启动appium服务,需要node老版本
网友评论