1

私たちのチームが開発しているいくつかのカスタム Alfresco モジュール用に、TestNG と Selenium WebDriver を使用してテストを開発しています。

ページの読み込み後、すべての AJAX リクエストが必要な WebElement を取得するのを待つ必要があります。このアプローチを見つけました。Alfresco が Dojo を使用していることがわかりました。

だから私は次の方法を書きました(タイムアウトはまだ追加されていません):

void waitForAJAX() {

if(javascriptExecutor == null) {
    throw new UnsupportedOperationException(webDriverType.toString() + " does not support javascript execution.");
}
boolean presentActiveConnections = true;
Integer numOfCon;
// Minor optimization. Getting rid of the repeaedly invocation of valueOf() in while.
Integer zeroInteger = Integer.valueOf(0);
while(presentActiveConnections) {
    numOfCon = (Integer)javascriptExecutor.executeScript("return selenium.browserbot.getCurrentWindow().dojo.io.XMLHTTPTransport.inFlight.length");
    if( numOfCon.equals(zeroInteger) ) {
        presentActiveConnections = false;
    }
}

}

しかし、テストを実行すると、テストからこのメソッドを呼び出すと次のエラーが発生します。

失敗: ReferenceError: dojo が定義されていません。

dojo 変数は、任意の JavaScript から使用できるようにする必要がありますか? ページのソースを手動で確認したときも、見つけることができませんでした。

前もって感謝します。

4

0 に答える 0