Error obtaining Ul hierarchy Reason: Error while obtaining Ul hierarchy XML file

简介: Error obtaining Ul hierarchy Reason: Error while obtaining Ul hierarchy XML file

一、前置说明


在运行完Appium测试脚本之后,再次使用uiautomatorviewer定位页面元素时,经常会报错:

Error  obtaining  Ul  hierarchy
Reason:
Error  while  obtaining  Ul  hierarchy  XML  file:
com.android.ddmlib.SyncException:  Remote  object  doesn't  exist!



二、解决办法


出现该问题的原因是: Appium Session未结束,当前APP仍处于测试脚本控制之中,所以使用uiautomatorviewer定位页面时,会报"设备不存在"的错误。


方案一:使用quit()方法关闭Appium会话

driver.quit()


方案二:等待一段时间,让Android设备自动断开会话

等待设备自动断开当前会话,断开的标志是:自动退出测试脚本操作的页面,回到首页


三、其他说明


出现该问题,可能还有其他未知的原因,如果上面两种方法仍不能解决问题,那就重启设备、重启uiautomatorviewer。

请相信:有时候,重启可以解决大部分问题,哈哈


请参考 一键重启appium环境,一键启动过程如下:

  1. 启动模拟器
  2. 开启Android设备远程调试,并连接设备
  3. 启动uiautomatorviewer,用于定位元素
  4. 启动Appium Server,用于自动化移动应用程序的测试
目录
相关文章
|
8月前
Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger failed with multiple
Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger failed with multiple
61 1
|
4月前
|
Docker 容器
ADD failed: file not found in build context or excluded by .dockerignore: stat irap_rule_center: fil
ADD failed: file not found in build context or excluded by .dockerignore: stat irap_rule_center: fil
|
7月前
|
存储 缓存 自然语言处理
“error“: { “root_cause“: [{ “type“: “circuit_breaking_exception“, “reason“: “[parent] D【已解决】
“error“: { “root_cause“: [{ “type“: “circuit_breaking_exception“, “reason“: “[parent] D【已解决】
57 1
|
前端开发
【前端异常】Module build failed: Error: ENOENT: no such file or directory, scandir ‘G:\OPWeb\public\node_m
【前端异常】Module build failed: Error: ENOENT: no such file or directory, scandir ‘G:\OPWeb\public\node_m
318 0
|
8月前
|
XML Android开发 数据格式
Error obtaining Ul hierarchy Reason_ Error while obtaining Ul hierarchy XML file
Error obtaining Ul hierarchy Reason_ Error while obtaining Ul hierarchy XML file
92 0
|
JavaScript
Uncaught runtime errors: × ERROR Avoided redundant navigation to current location: “/xxx“.
Uncaught runtime errors: × ERROR Avoided redundant navigation to current location: “/xxx“.
217 0
成功解决:ERROR StatusLogger No log4j2 configuration file found.
成功解决:ERROR StatusLogger No log4j2 configuration file found.
|
Unix Linux 异构计算
成功解决 ERROR: An error occurred while performing the step: “Building kernel modules“. See /var/log/nv
成功解决 ERROR: An error occurred while performing the step: “Building kernel modules“. See /var/log/nv
成功解决 ERROR: An error occurred while performing the step: “Building kernel modules“. See  /var/log/nv
|
前端开发 数据库
Failed to load response dataNo data found for resource with given identifier
Failed to load response dataNo data found for resource with given identifier
1792 0
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179)
466 0

相关课程

更多