【发布时间】:2013-07-08 07:12:13
【问题描述】:
我正在处理所有内容都保存在事件中的项目,因此服务器需要一些时间来响应新数据。我正在使用 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()
}
方法对吗?
【问题讨论】: