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
Asked
Active
Viewed 2,658 times
4
-
Found the same thing too...share any knowlegde you found! – jkp Feb 12 '11 at 11:04
2 Answers
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);

Guillaume
- 485
- 1
- 5
- 10
-
Quick note: That should read `UIATarget` (note swapped I and A). – Joseph Humfrey Dec 23 '11 at 23:22
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.