我似乎无法创建对我的滚动视图的引用。我正在尝试测试 iOS 应用程序的登录页面。
xib 有一个包含 UIScrollView 的 UIView。
我正在尝试使用此 javascript 获取滚动视图:
target = UIATarget.localTarget();
application = target.frontMostApp();
window = application.mainWindow();
scrollView = window.scrollViews()[0];
打印对象(使用 UIALogger.logPass)产生:
[object UIATarget]
[object UIAApplication]
[object UIAWindow]
[object UIAElement]
window.elements() 产生一个只包含一个元素的数组。我在viewController 的viewDidLoad 中将scrollViews 的isAccessibilityElement 设置为YES。
我在这里做错了什么?
[编辑]
application.logElementTree() 产生:
2) UIAApplication [name:App value:(null) rect:{{x:0, y:20}, {width:768, height:1004}}]
3) UIAWindow [name:(null) value:(null) rect:{{x:0, y:0}, {width:768, height:1024}}]
4) UIAElement [name:(null) value:(null) rect:{{x:0, y:20}, {width:768, height:1004}}]
3) UIAWindow [name:(null) value:(null) rect:{{x:0, y:0}, {width:768, height:1024}}]
4) UIAKeyboard [name:(null) value:(null) rect:{{x:0, y:760}, {width:768, height:264}}]
这看起来不像我的 xib 中的内容。我期待 UIAElement (根视图)持有 UIAScrollView... 运行应用程序一切正常。