我使用selenium-webdriver来自动执行浏览器任务。我曾经使用"WebDriverWait"来等待一个元素,然后再使用它。例子:
WebDriverWait wait = new WebDriverWait(driver, 5);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("frame1")));
这在webdriver的2.45版本中不再工作了。"until"方法的参数已经改变了,我不知道现在该怎么做。
有人有同样的问题吗?
文档:http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/support/ui/FluentWait.html
我使用相同的2.45版本的webdriver,还没有遇到任何问题。
文档:http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/support/ui/WebDriverWait.html
对我来说完美的例子:
WebDriverWait waitSearchGrid = new WebDriverWait(driver, 10);
waitSearchGrid.until(ExpectedConditions.elementToBeClickable(driver.findElement(By.xpath(".//*[@id='clientSearchResult']/div[1]"))));