用Appium1.4.16.1测试Android8.1.0出现以下报错:

C:\ProgramData\Anaconda3\python.exe D:/python/appium_learn/calculator_test_1.0.py
Traceback (most recent call last):
File "D:/python/appium_learn/calculator_test_1.0.py", line 11, in <module>
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
File "C:\ProgramData\Anaconda3\lib\site-packages\appium\webdriver\webdriver.py", line 96, in __init__
super(WebDriver, self).__init__(command_executor, desired_capabilities, browser_profile, proxy, keep_alive)
File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "C:\ProgramData\Anaconda3\lib\site-packages\appium\webdriver\webdriver.py", line 137, in start_session
response = self.execute(RemoteCommand.NEW_SESSION, parameters)
File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\ProgramData\Anaconda3\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: A new session could not be created. (Original error: Command failed: C:\Windows\system32\cmd.exe /s /c "F:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -s BYYDDEV8YSJFNN7T shell "ps 'uiautomator'""
ps: uiautomator
)

首先解释一下关键提示信息:

A new session could not be created. (Original error: Command failed: C:\Windows\system32\cmd.exe /s /c "F:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -s BYYDDEV8YSJFNN7T shell "ps 'uiautomator'""
ps: uiautomator
)

新会话创建失败,具体的失败原因是:命令执行失败,我们知道C:\Windows\system32\cmd.exe 是调用命令行程序,

/c

执行 String 指定的命令,然后停止,

/s

修改 /c 或 /k 后对 String 的处理,

此处,string代表的就是:"F:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -s BYYDDEV8YSJFNN7T shell "ps 'uiautomator'""

下面我们再来拆分一下string部门的含义:F:\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe是adb在我本地的安装目录,adb-- Android Debug Bridge, Android 调试桥的缩写,-s <设备序列号> ,此处我们要执行的命令是adb  shell ps |  grep ‘uiautomator’,由于老版本的adb.js中定义的shell命令格式是:

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

从代码的含义上可以看出,这里面调用的命令为:adb  shell  ps ,缺少了‘ |  grep ‘uiautomator’’部分,故对上面的代码进行修改。

appium+python测试Android真机功能报错处理的更多相关文章

  1. 真机调试报错error ==Error Domain=NSURLErrorDomain Code=-1009 "似乎已断开与互联网的连接。"

    真机调试报错error ==Error Domain=NSURLErrorDomain Code=-1009 "似乎已断开与互联网的连接." 请注意,错误代码是-1009,网上关于 ...

  2. Xcode真机调试报错(证书的签发者无效)

    Xcode真机调试时报错: dyld: Library not loaded: @rpath/libswiftAVFoundation.dylib Referenced from: /var/mobi ...

  3. Android studio 3.1.3真机调试报错,no target device found

    Android studio 3.1.2 的 Android monitor 改为 Android profiler,直接点这个就可以真机调试,在手机安装相应app 如果不行,报错,"no ...

  4. 【Mac+Appium+Python】之用 uiautomator2 启动报错

    参数中添加了: automationName: Uiautomator2 运行如下: [UiAutomator2] Starting UIAutomator2 server 3.1.1 [UiAuto ...

  5. uni-app真机调试报错request:fail abort解决方法

    Android端真机调试访问本地接口数据时报错:request:fail abort 报错代码 onLoad: function(e) { uni.request({ url: 'http://loc ...

  6. 改动项目APP名字后,在真机执行报错:The provisioning profile specified in your build settings (“haotian”) has an AppI

    错误提醒:The provisioning profile specified in your build settings ("haotian") has an AppID of ...

  7. 小程序插件集成functional-page-navigator真机调试报错

    小程序集成插件 插件里面有functional-page-navigator标签 一."小程序开发版已过期,请重新扫码连接" 真机在调用插件的时候报错 "小程序开发版已过 ...

  8. 真机调试报错:Could not find Developer Disk Image 或 Could not locate device support files.

    废话不多说,原因是用的Xcode版本所支持的最高iOS系统低于真机iOS系统导致. 解决方案: 1.升级到最新的Xcode版本 2.不想升级Xcode,那就找已经把Xcode升级到最新版本的朋友,发给 ...

  9. Xcode真机调试报错:The application could not be verified.

    今天真机调试的时候遇到这个错误: The application could not be verified. 这还是第一次遇到,应该是手机上的app的证书跟如今的证书不一致导致. 解决方法有两个 x ...

  10. iOS 真机调试报错汇总

    1. iphone is busy: processing symbol files 引起原因第一次运行真机, 会处理一些文件, 上面会有一个进度条给予显示 等100%之后再编译 2. xcode c ...

随机推荐

  1. Bus Stop

    题目 题意: 大概就是在x轴上(一维),有n个房子的坐标,你要建立公交车站,使得每个房子离最近的车站不过10公里,求最少的车站. 思路: 很简单,之接贪心即可,每次判断当前房子的后20公里有没有房子, ...

  2. 钓鱼攻击之:WEB 钓鱼

    郑重声明: 本笔记编写目的只用于安全知识提升,并与更多人共享安全知识,切勿使用笔记中的技术进行违法活动,利用笔记中的技术造成的后果与作者本人无关.倡导维护网络安全人人有责,共同维护网络文明和谐. 钓鱼 ...

  3. echar 多个图形显示时,点击显示隐藏然后样式缺失,变得非常小

    原因:Echarts 图表是根据你定义的div 的样式来确定图表的大小,当图表隐藏时,Echarts会找不到div的宽和高,再次显示时它会给自己一个非常小的默认宽高值,所以在隐藏显示后会发现它变得非常 ...

  4. js替换字符中指定所有字符

    //js \n全部替换<br/> function tranceBr(str) { return str.replace(/\n/g, '<br/>'); }

  5. 3D数字孪生场景编辑器介绍

    1.背景 数字孪生的建设流程涉及建模.美术.程序.仿真等多种人才的协同作业,人力要求高,实施成本高,建设周期长.如何让小型团队甚至一个人就可以完成数字孪生的开发,是数字孪生工具链要解决的重要问题.目前 ...

  6. vue+mysql实现前端对接数据库

    下载引入相关依赖 1.cnpm install --save mysql 2.cnpm install --save axios 3.cnpm install --save body-parser 4 ...

  7. GPS地图生成01之概述

    图片来源: Author: Tang Email: jianbo.tang@csu.edu.cn

  8. mysql的双1设置是什么?

    innodb_flush_log_at_trx_commit和sync_binlog 两个参数是控制MySQL磁盘写入策略以及数据安全性的关键参数.如果innodb_flush_log_at_trx_ ...

  9. 4. Lighting 窗口

    Lighting 实现烘焙或者实时渲染都在这里设置,其他灯光或者反射探头的作用相当于允许 Lighting (窗口)烘焙或者实时渲染. 0bject: Lightmap Static: 把烘焙的对象设 ...

  10. No.2.3

    PC端网页和移动端网页的有什么不同? PC屏幕大,网页固定版心 手机屏幕小,网页宽度多数为100% 如何在电脑里面写代码边调试移动端网页效果? 谷歌模拟器 了解屏幕尺寸概念 屏幕尺寸:指的是屏幕对角线 ...