我正在開發項目,其中一切都保存在事件中,因此服務器需要一些時間來響應新數據。我使用Fluent等待使用ajax的頁面,但是這個不使用任何ajax。所以我想刷新頁面檢查是否有新的項目,如果不再刷新。 Selenium 2如何實現這一目標?硒刷新
我這樣做:
def accountsAfterCreating = 0
while (accountsAfterCreating <= existingAccounts) {
driver.navigate().refresh()
WebElement table = wait.until(new Function<WebDriver, WebElement>() {
public WebElement apply(WebDriver driver) {
return driver.findElement(By.className("table"))
}
})
accountsAfterCreating = table.findElements(By.className("amount")).size()
}
是不是正確的方式?