如何更改Selenium 2的默认请求超时?

时间:2010-04-06 05:56:32

标签: java selenium webdriver

我目前正在使用Java中的Selenium 2.0a2来使用HtmlUnitDriver实例访问Internet。我面临的问题是,当我尝试访问慢速网站时,请求超时。如何在抛出超时异常之前增加WebDriver等待的时间?

1 个答案:

答案 0 :(得分:2)

wait = new WebDriverWait(driver,10);     wait.until(new VisibilityOfElementLocated(By.id(“whatever”)));

10是超时是秒。

相关问题