在 iPhone 应用程序中使用 UIAutomation 在主视图上搜索元素非常慢

发布于 2024-10-03 06:03:14 字数 131 浏览 0 评论 0原文

当我使用 for 循环时,它调用 UIATarget.localTarget().frontMostApp().mainWindow().elements();要在主视图上搜索特定元素,它的运行速度非常慢。有人遇到过这个问题吗?如果是这样,任何建议

When I use for loop, which calls UIATarget.localTarget().frontMostApp().mainWindow().elements(); to search a specific element on the Main View, it runs really slow. Has anyone experienced this problem yet? If so, any sug

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

佼人 2024-10-10 06:03:14

我遇到了同样的问题,经过一些研究,我发现如果元素尚不可访问,则如果调用 myElement.elements()[i],UI 自动化会等待。因此,如果你想减少这种延迟,你应该将一个新的超时值压入堆栈,然后像这样弹出它:

UIATarget.localTarget().pushTimeout(0);
...
UIATarget.localTarget().popTimeout();

或者简单地:

UIATarget.localTarget().setTimeout(0);

来源:
http://developer.apple.com/库/ios/#documentation/ToolsLanguages/Reference/UIATargetClassReference/UIATargetClass/UIATargetClass.html

I ran into the same problem and after some research, I found out that UI Automation waits if a call to myElement.elements()[i] in case the element is not yet accessible. So if you want to decrease this delay you should push a new timeout value on the stack and then pop it like that:

UIATarget.localTarget().pushTimeout(0);
...
UIATarget.localTarget().popTimeout();

or simply:

UIATarget.localTarget().setTimeout(0);

Source:
http://developer.apple.com/library/ios/#documentation/ToolsLanguages/Reference/UIATargetClassReference/UIATargetClass/UIATargetClass.html

旧人九事 2024-10-10 06:03:14

我不久前开始研究这个工具,我想你可以尝试使用这个:

button = UAITarget.localTarget().frontMostApplication().mainWindow().tableView()[0].scrollToElementWithPredicate("name beginswith "Your Specific Element Name");

其中 tableView 是主窗口视图列表的层次结构,其中包含带有你为其指定的特定名称的按钮。

如果您找到了方法,也请发布您的答案。

I've started not too long ago to study this instrument and i think you can try to use this:

button = UAITarget.localTarget().frontMostApplication().mainWindow().tableView()[0].scrollToElementWithPredicate("name beginswith "Your Specific Element Name");

where tableView is the hierarchy of your main window list of views that will contain your button with the specific name you have given to it.

if you found your way, please post your answer too.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文