我是iOS UIAutomation的新手,这是我面临的问题
我有一个视图层次结构如下所示,并希望访问自动化sctipt中的CustomView2元素
UIWindow> UIScrollView> CustomView1(多个)> CustomView2(多个)
scrollview具有CustomView1类型的子视图,而CustomView1又具有CustomView2类型的子视图.
我已将可访问性信息分配给层次结构中的所有视图,但我无法访问自动化脚本中的CustomView2元素.
当我在UIScrollView上执行logElementTree()时,我得到的只是CustomView2的实例,而CustomView2甚至不在UIWindow的树结构中.
请建议是否有任何遗漏或出现任何问题.
这是我正在使用的代码
var mainWindow = application.mainWindow();
var scrollView = mainWindow.scrollViews()[0];
var custom1 = scrollView.elements().withName("CustomView1");
for(var index=0; index<custom1.length; index++){
currentIndustry.tap();
custom1[index].logElementTree();
var custom2 = custom1[index].elements().withName("CustomView2");
UIALogger.logPass("Custom2 Length : " + custom2.length);
}
Run Code Online (Sandbox Code Playgroud)
由custom1 [index] .logElementTree()打印的树; 不包含CustomView2的实例
PS我需要访问CustomView1和CustomView2元素