I've got an activity indicator on my root table view while things get loaded. I'm trying to test for the presence of the indicator, but can't seem to get ahold of the UIAActivityIndicator, nor can I find it anywhere in the app element tree hierarchy. The indicator is a subview of the root table view, so I'd expect it to be seen as a part of that element tree, but I don't see it anywhere (other than physically on the screen).
Any other magic required to grab an activity indicator from javascript?
Ed
This is the function I've built for waiting for page loads in iOS. You can pass an optional preDelay before the function's code executes, other than that it waits for the activityIndicator object to become null for 30 seconds (trying every half second, 60 times). I've extended the UIAutomation tool to encompass this command when I tap on objects.
this.wait_for_page_load = function(preDelay) {
if (!preDelay) {
target.delay(0);
}
else {
target.delay(preDelay);
}
var done = false;
var counter = 0;
while ((!done) && (counter < 60)) {
var progressIndicator = UIATarget.localTarget().frontMostApp().windows()[0].activityIndicators()[0];
if (progressIndicator != "[object UIAElementNil]") {
target.delay(0.5);
counter++;
}
else {
done = true;
}
}
target.delay(0.5);
}
target.delay(1);
target.pushTimeout(10);
target.frontMostApp().mainWindow().activityIndicators()["In progress"].waitForInvalid() == true;
target.popTimeout();
This will wait 1 second for activity indicator to appear. Then, it will wait for it to become invalid with a timeout value of 10 seconds. Substitute "In progress" for your indicator name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With