appium如何支持android7.0

1.报错shell "ps 'uiautomator'"   bad pid uiautomator

1.找到appium的安装目录下的adb.js文件,目录为:Appium\node_modules\appium\node_modules\appium-adb\lib

打开adb.js,找到1035行,如下代码:

     this.shell("ps '" + name + "'", function (err, stdout) {
     if (err) return cb(err);
     替换成
     this.shell_grep("ps", name, function (err, stdout) {
     if (err) {
     logger.debug("No matching processes found");
     return cb(null, []);

    }

 并增加上面用到的shell_grep函数:

ADB.prototype.shell_grep = function (cmd, grep, cb) {
if (cmd.indexOf('"') === -1) {
cmd = '"' + cmd + '"';
}
var execCmd = 'shell ' + cmd + '| grep ' + grep;
this.exec(execCmd, cb);
};

2.重启appium

2.避免重复安装setting、unlock、unicode_IME

1.setting和unlock

Appium\node_modules\appium\lib\devices\android.js

打开android.js,找到如下代码,将代码注释掉:
this.pushSettingsApp.bind(this),
this.pushUnlock.bind(this),

2.unicode_IME

Appium\node_modules\appium\lib\devices\android\android-common.js

注释:

androidCommon.pushUnicodeIME = function (cb) {
  cb()
  /*
  logger.debug("Pushing unicode ime to device...");
  var imePath = path.resolve(__dirname, "..", "..", "..", "build",
      "unicode_ime_apk", "UnicodeIME-debug.apk");
  fs.stat(imePath, function (err) {
    if (err) {
      cb(new Error("Could not find Unicode IME apk; please run " +
                   "'reset.sh --android' to build it."));
    } else {
      this.adb.install(imePath, false, cb);
    }
  }.bind(this));
  */
};


问题解决。
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值