Appium新手常见问题

1、unknown error: com.android.chrome is not installed on device

问题:连接Appium的设备未安装浏览器com.android.chrome

解决: 1)安装对应的chrome浏览器

     2)更改Appium配置: android settings—— user Browser 勾选,选择Browser。此时使用手机自带浏览器com.android.browser

 

2、command failed shell “ps ‘uiautomator’”

问题:命令“ps ‘uiautomator’”不支持,

解决:需要更改安装文件 XXXX\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js文件代码。兼容此命令:

1)找到如下代码:

在之后添加

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)替换如下代码段

全部注释掉,然后替换为如下代码:

ADB.prototype.getPIDsByName = function (name, cb) {
  logger.debug("Getting all processes with '" + name + "'");
  this.shell_grep("ps", name, function (err, stdout) {
    if (err) {
      logger.debug("No matching processes found");
      return cb(null, []);
    }
    var pids = [];
    _.each(procs, function (proc) {
    var match = /[^\t ]+[\t ]+([0-9]+)/.exec(proc);
    if (match) {
    pids.push(parseInt(match[1], 10));
    }
    });
    if (pids.length !== procs.length) {
      var msg = "Could not extract PIDs from ps output. PIDS: " +
      JSON.stringify(pids) + ", Procs: " + JSON.stringify(procs);
      return cb(new Error(msg));
    }
    cb(null, pids);
  });
};

修改后重启Appium,问题解决

 

3、Failed to start an Appium session, err was: Error: Command failed: C:\windows\system32\cmd.exe /s /c "C:\Users\Administrator\AppData\Local\Android\Sdk\platform-tools\adb.exe -s VSORTCKVS4HI85FU install "D:\Program Files (x86)\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk""

Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.unlock without first uninstalling.]

问题:应用已经安装,需要卸载后重新安装   adb uninstall io.appium.unlock(报错的包名)

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值