3

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?

エド

4

3 に答える 3

2
target.delay(1);

target.pushTimeout(10);

target.frontMostApp().mainWindow().activityIndicators()["In progress"].waitForInvalid() == true;

target.popTimeout();

これにより、アクティビティ インジケータが表示されるまで 1 秒間待機します。その後、タイムアウト値 10 秒で無効になるのを待ちます。インジケーター名を「進行中」に置き換えます。

于 2013-09-20T18:11:46.657 に答える
2

これは、iOS でページの読み込みを待機するために作成した関数です。関数のコードが実行される前に、オプションの preDelay を渡すことができます。ただし、 activityIndi​​cator オブジェクトが null になるまで 30 秒間待機します (0.5 秒ごとに 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);
}
于 2011-08-01T19:19:02.890 に答える
0

以下のコード行は私の問題を解決しました

while(target.frontMostApp().mainWindow().activityIndicators()["In progress"].isEnabled());

アクティビティ インジケーターが無効になるまで待機します (ただし、インジケーターがビューから削除された後、無効になるまでにさらに 1 ~ 2 秒かかります)

于 2016-07-26T12:24:07.747 に答える