我注意到我正在測試的應用程序,當我點擊一個提交按鈕一個網格刷新。我有一個行數我有一個跨度訪問,並希望做一些事情,如:看着ExpectedConditions類,試圖找到onChange
(new WebDriverWait(driver, upperTimeoutLimit))
.until(ExpectedConditions.elementChanged(By.cssSelector(mySelector)));
我的目標是看一個節點,並做了WebDriverWait,直到它改變某種方式,理想的的getText
編輯我是說@FlorentB,他正沿着以下提的東西:
WebDriverWait wait = new WebDriverWait(driver, upperTimeoutLimit);
WebElement grid = ui.getExternalCommandGrid();
submit.click();
//staleness
System.out.println("about to check for staleness");
wait.until(ExpectedConditions.stalenessOf(grid));
System.out.println("About to check presence of");
wait.until(ExpectedConditions.presenceOfElementLocated(
By.cssSelector(ui.getExternalCommandGridSizeSelector())));
它似乎沒有獲得通過的stalenessOf(網格)的一部分。我的想法可能是,我在點擊之前選擇網格,運行點擊,然後希望在獲得下一個拼圖之前,它會等到它識別出一個變化(也許我需要檢查行)。
API本身有很多條件可以使用 - https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/support/ui/ ExpectedConditions.html ... 。textMatches,textToBe,\t textToBePresentInElement,textToBePresentInElementLocated,\t textToBePresentInElementValue等 – Grasshopper
我可以用文本匹配來檢查「textNotMatches」,不過是的,我一直在尋找的是API,並試圖想我可以利用我的情況 – Fallenreaper
結合起來與not()ExpectedCondition將會給你邏輯相反。 ExpectedConditions.not(ExpectedCondition.textMatches())應該訣竅 – Grasshopper