在加载内容时,我的根表视图上有一个活动指示器。我正在尝试测试指示器是否存在,但似乎无法获得UIAActivityIndicator,在应用程序元素树层次结构中也找不到它。指示器是根表视图的子视图,所以我希望它被视为元素树的一部分,但我在任何地方都看不到它(除了在屏幕上的物理位置)。
从javascript抓取一个活动指示器还需要其他的魔法吗?
边缘
发布于 2011-08-02 03:19:03
这是我为等待iOS中的页面加载而构建的函数。您可以在函数的代码执行之前传递一个可选的preDelay,而不是等待activityIndicator对象变为null 30秒(每半秒尝试一次,共60次)。当我点击对象时,我已经扩展了UIAutomation工具来包含这个命令。
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);
}发布于 2013-09-21 02:11:47
target.delay(1);
target.pushTimeout(10);
target.frontMostApp().mainWindow().activityIndicators()["In progress"].waitForInvalid() == true;
target.popTimeout();这将等待1秒以等待活动指示器出现。然后,它将等待它变得无效,超时值为10秒。将您的指标名称替换为“正在进行中”。
发布于 2016-07-26 20:24:08
下面这行代码解决了我的问题
while(target.frontMostApp().mainWindow().activityIndicators()["In progress"].isEnabled());它等待直到活动指示器变为禁用状态(但在指示器从我们的视图中移除之后,它需要1-2秒才能变为禁用状态)
https://stackoverflow.com/questions/6755477
复制相似问题