开发者

Using UIAutomation to search elements on the Main View is really slow in IPhone app

开发者 https://www.devze.com 2023-01-25 21:31 出处:网络
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 expe开发者_开发技巧rienc

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 expe开发者_开发技巧rienced this problem yet? If so, any sug


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消