Android UI 测试中 scrollableContainerResourceId 的获取方法
scrollableContainerResourceId 是指可滚动的容器的资源 ID,可以在 UI 测试中使用 UiAutomatorViewer 或类似工具来查看该视图的属性,从而获得其资源 ID。可以使用以下方式创建 scrollableContainerResourceId:
- 如果您的应用程序是使用 Android Studio 进行开发的,则可以在 XML 布局文件中查找该视图的资源 ID。
- 使用 UiAutomatorViewer 或类似工具来查看该视图的属性,并从中获取资源 ID。
- 在测试中使用其他方法找到该视图,并使用其资源 ID。
例如,如果您要测试一个应用程序中的可滚动列表,则可以使用以下代码创建 scrollableContainerResourceId:
String scrollableContainerResourceId = 'com.example.app:id/list_view';
UiScrollable scrollableContainer = new UiScrollable(new UiSelector().resourceId(scrollableContainerResourceId));
原文地址: https://www.cveoy.top/t/topic/ohyg 著作权归作者所有。请勿转载和采集!