1.学习使用appium
我使用的appium为appium GUI 版本,目前不了解appium client/Server之间的关系。
由于测试过程中准备使用Python写测试脚本,所以需要下载appium-python-client,方法如下:https://testerhome.com/topics/1080
在安装过程中,遇到如下问题:
解决办法如下:
bogon:Appium-Python-Client-0.27 baishuang$ sudo python setup.py install
2.运行脚本出错
解决办法如下:卸载selenium,重新安装低版本,容易出现超时问题,可设置超时时间解决
pip --default-timeout=100 install -U selenium
3.下载pip工具
bogon:~ baishuang$ sudo easy_install pip
3.安装appium问题
本人之前安装dmg版本,运行打开手机计算器一直出错,错误提示:
selenium.common.exceptions.WebDriverException: Message: Parameters were incorrect. We wanted {"required":["desiredCapabilities"],"optional":["requiredCapabilities","sessionId","id"]} and you sent ["capabilities","desiredCapabilities"]
经上网试过不同方法无果后,发现自己的appium不能使用命令行方式打开,提示:comand not found.所以决定重新从命令行方式安装appium。过程如下:
(1)npm install -g appium提示请求拒绝,请切换root权限,但root权限安装会出现命令行打开appium打开失败 wIth root .所以采取修改文件权限来重新安装appium.坎坷。。。
bogon:~ baishuang$ sudo chmod -R 777 /usr/local/lib
bogon:~ baishuang$ npm uninstall appium -g
removed 535 packages in 4.555s
bogon:~ baishuang$ npm install -g appium
/usr/local/bin/appium -> /usr/local/lib/node_modules/appium/build/lib/main.js
> appium-chromedriver@4.0.0 install /usr/local/lib/node_modules/appium/node_modules/appium-chromedriver
> node install-npm.js
info Chromedriver Install Installing Chromedriver version '2.38' 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.38/chromedriver_mac64.zip...
RequestError: Error: connect ETIMEDOUT 172.217.160.80:443
at new RequestError (/usr/local/lib/node_modules/appium/node_modules/request-promise-core/lib/errors.js:14:15)
at Request.plumbing.callback (/usr/local/lib/node_modules/appium/node_modules/request-promise-core/lib/plumbing.js:87:29)
at Request.RP$callback [as _callback] (/usr/local/lib/node_modules/appium/node_modules/request-promise-core/lib/plumbing.js:46:31)
at self.callback (/usr/local/lib/node_modules/appium/node_modules/request/request.js:185:22)
at Request.emit (events.js:182:13)
at Request.onRequestError (/usr/local/lib/node_modules/appium/node_modules/request/request.js:877:8)
at ClientRequest.emit (events.js:182:13)
at TLSSocket.socketErrorListener (_http_client.js:382:9)
at TLSSocket.emit (events.js:182:13)
at emitErrorNT (internal/streams/destroy.js:82:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! appium-chromedriver@4.0.0 install: `node install-npm.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the appium-chromedriver@4.0.0 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! /Users/baishuang/.npm/_logs/2018-07-16T06_56_20_127Z-debug.log
bogon:~ baishuang$
bogon:~ baishuang$ sudo chmod -R 777 /usr/local
Password:
chmod: Unable to change file mode on /usr/local: Operation not permitted
bogon:~ baishuang$ sudo chmod -R 777 /usr/local/lib
bogon:~ baishuang$ npm uninstall appium -g
removed 535 packages in 4.555s
bogon:~ baishuang$ npm install -g appium
上述错误貌似不是导致问题的原因,通过命令行下载或通过dmg安装的版本,应该没有本质的区别。在appium GUI dmg安装版本中,经过selenium降版本(3.13-2.53.6,网上有好多降版本改的例子,尚不能确定是否有影响)
解决办法:(我的电脑里安装Python2.7 3.7 两个版本,并不影响)
from appium import webdriver -》from selenium import webdriver
-------
下载版本连接:https://github.com/appium/appium-desktop/releases/tag/v1.6.2
类似问题解决:https://www.cnblogs.com/test-xiaocai/p/5810888.html
参考连接如下:
appium在Mac中的安装与使用
https://www.jianshu.com/p/612c2fa1dbe9
appium安装权限问题
https://testerhome.com/topics/1494