appium 启动android 9 失败

报错  selenium.common.exceptions.SessionNotCreatedException: Message: A new session could not be created. (Original error: Could not extract PIDs from ps output. PIDS: [], Procs: ["ps: uiautomator"])

解决方法:

打开appium安装目录,进入..\Appium\node_modules\appium\node_modules\appium-adb\lib,打开adb.js

添加了如下一行,再次打开appium启动android 9 就可成功了

ADB.prototype.getPIDsByName = function (name, cb) {
logger.debug("Getting all processes with '" + name + "'");
this.shell("ps '" + name + "'", function (err, stdout) {
if (err) return cb(err);
stdout = stdout.trim();
var procs = [];
var outlines = stdout.split("\n");
outlines.shift();//添加了此行
_.each(outlines, function (outline) {
if (outline.indexOf(name) !== -1) {
procs.push(outline);
}
});
if (procs.length < 1) {
logger.debug("No matching processes found");
return cb(null, []);
}

猜你喜欢

转载自www.cnblogs.com/zhoulw/p/10177595.html
今日推荐