Could not extract PIDs from ps output. PIDS: [], Procs: ["/system/bin/sh: grep: not found"])'解决方案
Posted on 2017-07-31 23:20 Young哥哥 阅读(545) 评论(0) 收藏 举报原错如下:
selenium.common.exceptions.WebDriverException: Message: u'A new session could not be created. (Original error: Could not extract
PIDs from ps output. PIDS: [], Procs: ["/system/bin/sh: grep: not found"])'
解决方案:
编辑adb.js脚本;路径 {Appium application package}/Contents/Resources/node_module/appium/lib/devices/android/adb.js)
Search for the function ADB.prototype.getPIDsByName
Replace the line:
this.shell("ps | grep '" + name + "'", function(err, stdout) {
with
this.shell("ps '" + name + "'", function(err, stdout) {
Add procs.shift(); after the line var procs = stdout.split("\n");
var procs = stdout.split("\n");
procs.shift();
Save the file, and restart Appium server.
It should looks like this in final:
this.shell("ps '" + name + "'", function(err, stdout) {
if (err) return cb(err);
stdout = stdout.trim();
if (!stdout) {
logger.info("No matching processes found");
return cb(null, []);
}
var procs = stdout.split("\n");
procs.shift();
浙公网安备 33010602011771号