4

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

nschum
  • 15,322
  • 5
  • 58
  • 56
Weiming Chen
  • 41
  • 1
  • 3

2 Answers2

8

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

Guillaume
  • 485
  • 1
  • 5
  • 10
1

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.

Leo
  • 37,640
  • 8
  • 75
  • 100
ana
  • 11
  • 4