我正在开发项目,其中一切都保存在事件中,因此服务器需要一些时间来响应新数据。我使用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()
}
是不是正确的方式?