UI自动化:里面的UIScrollView访问UIViews [英] UI Automation: Access UIViews inside UIScrollView
问题描述
有没有一种方法来访问,使用JavaScript与UI自动化测试, UIViews
内的的UIScrollView
?因为的UIScrollView
不给我走,设置是否有无障碍与否,我想知道是否有可能做到这一点。
Is there a way to access, using JavaScript with UI Automation tests, the UIViews
inside an UIScrollView
? Since the UIScrollView
doesn't give me away to set if it has accessibility or not, I would like to know if it is possible to do that.
在厦门国际银行的结构:
The structure in the XIB:
我可以看到仪表的记录一切,除了它里面的的UIScrollView
和 UIViews
。
I can see everything on the instrument's log, except the UIScrollView
and the UIViews
inside of it.
感谢。
推荐答案
我能够访问我的滚动型的内部。我在做什么错了:
I was able to access the interior of my Scroll View. What I was doing wrong:
- 设置辅助工具到我的根视图。
- 设置辅助工具来调整我的看法。
去除后,我能我这样做:
After removing that, I was able my doing this:
var window = UIATarget.localTarget().frontMostApp().mainWindow();
window.logElementTree();
要看到我的UIScrollView里面的所有UIViews。要访问其中一个按钮:
To see all the UIViews inside my UIScrollView. To access one of the buttons:
var scrollView = window.scrollViews()[0];
var button=scrollView.buttons()["showMeStuff"];
button.tap();
PS:也可以通过执行以下操作来定义的UIScrollView的辅助功能:
PS: Is also possible to define the accessibility of an UIScrollView by doing the following:
scrollView.isAccessibilityElement = YES;
scrollView.accessibilityLabel = @"someScrollView";
这篇关于UI自动化:里面的UIScrollView访问UIViews的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!