gpt4 book ai didi

iphone - 使用 UIAutomation 在主视图上搜索元素在 iPhone 应用程序中真的很慢

转载 作者:可可西里 更新时间:2023-11-01 05:10:54 24 4
gpt4 key购买 nike

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

最佳答案

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

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

或者简单地说:

UIATarget.localTarget().setTimeout(0);

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

关于iphone - 使用 UIAutomation 在主视图上搜索元素在 iPhone 应用程序中真的很慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4211650/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com