gpt4 book ai didi

appium - UIAutomatorViewer 显示相同的资源 ID

转载 作者:行者123 更新时间:2023-12-04 13:02:07 28 4
gpt4 key购买 nike

我一直在为使用 Appium 的应用程序做 Android 自动化。每天都有一个新版本的应用程序出现,我必须使用自动化检查新修复的代码。我面临的问题是,在应用程序的当前新版本中,我需要在自动化中访问的所有按钮和字段的资源 ID 已变为 .我可以使用 Xpaths 来访问某些元素,但使用 Xpath 会使自动化变慢。

我使用 UIAutomatorViewer 来获取 Xpath 和资源 ID。

有人可以帮我确定 相同的资源 ID 我面临的问题是在 Android 端还是我的 UIAutomator 无法正常工作并显示相同的 ID?

出于安全考虑,我无法分享屏幕截图。

最佳答案

Using Xpath is not recommended. The reason is that the infrastructure used to generate the XPath, doesn't guarantee that the XPath will remain the same between two different executions.



我看到您的问题的唯一解决方案是要求开发人员为每个元素添加唯一的自动化 ID。你可以让他们把唯一的 续描述 在他们的代码中。然后您将能够使用 访问元素findByAccessibilityId .
MobileElement element = driver.findElementByAccessibilityId("SomeAccessibilityID");

关于appium - UIAutomatorViewer 显示相同的资源 ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53851278/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com