Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 907
Weiming Chen Avatar asked Jan 21 '23 01:01

Weiming Chen


1 Answers

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

like image 81
Guillaume Avatar answered Mar 31 '23 14:03

Guillaume