python appium Attempt to re-install io.appium.settings without first uninstalling.]解决方案

来源:互联网 发布:和外国人聊天的软件 编辑:程序博客网 时间:2024/06/06 13:05

好久没用appium了,然后就升级了一下,最新的node 和appium是不兼容的,没办法,降级node
装了appium 1.4
尝试了初始默认计算器调用,一直报错Attempt to re-install io.appium.settings without first uninstalling.

device_name = get_android_udid()stop_android_appium()start_android_appium(device_name)desired_caps = {    'platformName': 'Android',    'deviceName': device_name,    'platformVersion': '7.1.1',    'appPackage': 'com.android.calculator2',    'appActivity': 'com.android.calculator2.Calculator'}driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
原来 uiautomator 与android7.1.1不兼容,


解决方案:
1、更改C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android
更改为下图


2、然后再C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib
修改如下图

ADB.prototype.shell_grep = function (cmd, grep, cb) {    if (cmd.indexOf('"') === -1) {    cmd = '"' + cmd + '"';    }   var execCmd = 'shell ' + cmd + '| grep ' + grep;   this.exec(execCmd, cb);   };
this.shell_grep("ps", name, function (err, stdout) {     if (err) {     logger.debug("No matching processes found");     return cb(null, []);    }

然后重启appium  小华为的计算器就被调起来了


二〇一七年十二月二十日 14:57:29更新 android 7 appium1.4.6 win10

增加了默认使用 appium 键盘

desired_caps = {    'platformName': 'Android',    'deviceName': device_name,    'platformVersion': '7.1.1',    'unicodeKeyboard': True,    'resetKeyboard': True,    'appPackage': 'cn.zlddata.zldtest',    'appActivity': 'cn.zlddata.zldtest.MainActivity'}driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)

又会报错

执行

adb uninstall io.appium.android.ime

然后在执行 会有意外发现