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,用于自动化移动应用程序的测试
目录
相关文章
|
7月前
Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger failed with multiple
Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger failed with multiple
41 1
|
3月前
|
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月前
|
XML Android开发 数据格式
Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class
Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class
62 0
|
7月前
|
XML 数据格式
android.view.InflateException: Binary XML file line #0: Attempt to invoke virtual
android.view.InflateException: Binary XML file line #0: Attempt to invoke virtual
32 0
|
7月前
|
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
81 0
成功解决:ERROR StatusLogger No log4j2 configuration file found.
成功解决:ERROR StatusLogger No log4j2 configuration file found.
|
前端开发 数据库
Failed to load response dataNo data found for resource with given identifier
Failed to load response dataNo data found for resource with given identifier
1638 0
|
XML Java 数据库连接
【Error】:BeanCreationException: Error creating bean(Could not resolve resource location)
【Error】:BeanCreationException: Error creating bean(Could not resolve resource location)
375 0
【Error】:BeanCreationException: Error creating bean(Could not resolve resource location)
​Error -4075: File not found. An error occurred merging module <MODULENAME> for feature <FEATURENAME>.
​Error -4075: File not found. An error occurred merging module <MODULENAME> for feature <FEATURENAME>.
123 0
​Error -4075: File not found. An error occurred merging module <MODULENAME> for feature <FEATURENAME>.
|
XML 数据格式
因为CircleImageView导致Binary XML file line #96: Error inflating class <unknown>
因为CircleImageView导致Binary XML file line #96: Error inflating class <unknown>
175 0