真实设备与模拟器:uiautomator 不显示应用程序的资源 ID [英] real device Vs emulator : uiautomator does not show resource-id for the app

查看:45
本文介绍了真实设备与模拟器:uiautomator 不显示应用程序的资源 ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要我的 appium 的元素 ID - android 自动化测试.当我使用带有 UIAUTOMATOR 的真实设备时,我获得了资源 - id 来与元素进行交互,例如:

I need the element id for my appium - android automation testing. When I use real device with UIAUTOMATOR, I get the resource - id to interact with the element like :

driver.findElementById("com.xyz.android:id/GSG");

但是,当我将模拟器与 UIAUTOMATOR 一起使用时,相同元素没有资源 ID,并且我的脚本也无法根据我的真实设备 ID 与该元素进行交互...有关如何操作的任何帮助来解决这个问题,或者为什么它会这样?

However, when I use an emulator with my UIAUTOMATOR , there is no resource - id for the same elements and my script is also not able to interact with the element based on my real device id...any help as to how to fix this or why it behaves like this?

推荐答案

我使用不同版本的 android 设备找到了答案 - 解释是 android 4.3 在 uiautomatorviewer 中有 id 组件.低于 API 级别 18 的 Android 版本将无法与元素的资源 ID 进行交互.

I found the answer using different versions of android devices - the explanation is android 4.3 has the id component in uiautomatorviewer. Android versions less than API level 18 will not be able to interact with the resource-id of the element.

这篇关于真实设备与模拟器:uiautomator 不显示应用程序的资源 ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆