appium在android 7.0真机上运行报错command failed shell:............ps:'uiautomator"的解决方式
appium版本:1_4_16
在CSDN中找到相关解决的方案,根据此解决方案顺利的解决了让人惆怅的问题,再次记录。
1、找到appium安装目录下的adb.js文件,目录为:Appium\node_modules\appium\node_modules\appium-adb\lib
2、打开adb.js,可使用notepad++编辑器等打开文件(说明:在修改代码的时候先注释掉以前的代码,并且添加自己容易识别的标记,以防出错后还有回旋的余地,或者将代码备份也可行),找到如下代码:
ADB.prototype.shell = function (cmd, cb) {
if (cmd.indexOf('"') === -) {
cmd = '"' + cmd + '"';
}
var execCmd = 'shell ' + cmd;
this.exec(execCmd, cb);
};
在这段代码下面加入如下代码:
ADB.prototype.shell_grep = function (cmd, grep, cb) {
if (cmd.indexOf('"') === -) {
cmd = '"' + cmd + '"';
}
var execCmd = 'shell ' + cmd + '| grep ' + grep;
this.exec(execCmd, cb);
};
再次找到如下代码:
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) !== -) {
procs.push(outline);
}
});
if (procs.length < ) {
logger.debug("No matching processes found");
return cb(null, []);
}
var pids = [];
_.each(procs, function (proc) {
var match = /[^\t ]+[\t ]+([-]+)/.exec(proc);
if (match) {
pids.push(parseInt(match[], ));
}
});
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);
});
};
将以上代码注释掉,替换成如下代码:
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 ]+([-]+)/.exec(proc);
if (match) {
pids.push(parseInt(match[], ));
}
});
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);
});
};
3、重启appium,连接手机成功运行看到解决问题已ok
appium在android 7.0真机上运行报错command failed shell:............ps:'uiautomator"的解决方式的更多相关文章
- appium java 在android7.0真机上测试程序时报错command failed shell "ps 'uiautomator'"的解决方式
1.找到appium的安装目录下的adb.js文件,目录为:Appium\node_modules\appium\node_modules\appium-adb\lib 2.打开adb.js,找到如下 ...
- 使用appium1.4在android8.0真机上测试程序时报错command failed shell "ps 'uiautomator'"的解决方式
appium1.4,运行自动化脚本时提示 org.openqa.selenium.SessionNotCreatedException: A new session could not be crea ...
- 使用appium在android9.0真机上测试程序时报错command failed shell “ps ‘uiautomator’”的解决办法
appium目前最新的windows版本是1.4.16,在android9.0真机上测试程序时会报错:command failed shell “ps ‘uiautomator’”. 网上大多数人的解 ...
- xcode6 真机运行报错 Command /usr/bin/codesign failed with exit code 1
解决方法: 百度下载‘iphone配置实用工具’, 打开此软件之后,选择预配置描述文件, 选中iphone过期和重复的描述文件,按delete键删除.然后重启xcode即可
- Android 6.0以后的版本报错:open failed: EACCES (Permission denied)
Android 6.0以后的版本报错:open failed: EACCES (Permission denied) 在开发项目中,遇见要进行文件操作,遇见Caused by: android.sys ...
- Robotframework学习笔记之—Rrobotframework运行报错“command: pybot.bat --argumentfile”
Rrobotframework运行报错"command: pybot.bat --argumentfile" 解决方案: 1.可能是缺失文件: 1.1.检查python安装目录下的 ...
- appium_server_v1.4.16版本不适配android7.0系统,运行报错“Attempt to re-install io.appium.settings without first uninstalling”
要解决的问题:appium在androidV7.0系统上运行时报错 Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.a ...
- xcode 运行报错 Command /usr/bin/codesign failed with exit code 1
因为更换了证书,导致在运行时报错 Command /usr/bin/codesign failed with exit code 1,查看了网上各种方法,最后发现以下两个值没有同步更新
- Android studio环境配置(运行报错)
报错的种类有很多,下面的方法能解决大多数: 所有路径不能用中文,不能有空格,逗号句号也不能用中文,项目文件路径也不行 首先要配置Java环境,这个就不多说了, 这里有以下JAVA_HOME的配置,下图 ...
随机推荐
- CAN数据格式-ASC
Vector工具录制的数据,一般有ASC和BLF两种格式,本文介绍ASC. 1. ASC定义 ASC(ASCII)即文本文件,数据已可视化的文本存储. 2.ASC查看 通常情况下,用记事本就可以打开. ...
- 获取redis主从复制链SHELL脚本
获取redis主从复制链SHELL脚本 vi redisnode.sh #!/bin/sh master_host=$ master_port=$ auth=$ #判断输入密码是否为空,为空则转化为' ...
- 关于如何通过kali linux 攻击以及破解WPA/WPA2无线加密
http://blog.csdn.net/wingstudio_zongheng/article/details/51435212 1.前期准备 1)打开一个终端 执行命令: ifconfig ...
- 2013-9 OWASP论坛
Broken We Application Project ------这个PPT需要下载 OWASP BWA----- A Virtual machine---收集 Broken Web App ...
- PHP合并数组的三种方法的分析与比较
常用的合并数组的方法有三种:array_merge().array_merge_recursive().+,下面一个一个介绍 array_merge() 此函数合并一个或多个数组,当输入的数组中有相同 ...
- JavaScript引用类型-Object类型
创建Object的方式有两种: 第一种:使用new操作符后跟Object操作函数. var person = new Object(); person.name = "wang"; ...
- 让 Homebrew 走代理更新 + brew 管理 node 版本
0.前言 环境:MacOS 背景:整理下今天所做的配置. 1. 让 Homebrew 走代理更新 brew update 就卡住了,即使开了 shadowsocks 也不行.因为 shadowsock ...
- java基础- Collection和map
使用构造方法时,需要保留一个无参的构造方法 静态方法可以直接通过类名来访问,而不用创建对象. -- Java代码的执行顺序: 静态变量初始化→静态代码块→初始化静态方法→初始化实例变量→代码块→构造方 ...
- Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class android.sup
解决:找不到资源文件: 系统会根据分辨率来选择加载不同drawable下文件夹的资源,如果只在一个文件下放了资源文件,不同的分辨率设备的会报错.
- arcEngine开发之activeView.PartialRefresh(译)
为什么要使用partialRefresh arcMap应用程序窗口操作主要是由 IActiveView 控制的,并且它有 Map(data view) 和 PageLayout(layout view ...