Daniel
Daniel

Reputation: 10235

How do I change the default request timeout for Selenium 2?

I am currently using Selenium 2.0a2 in Java to access the Internet using an HtmlUnitDriver instance. The problem I am facing is that, when I attempt to access slow websites, the request times out. How can I increase the time that WebDriver waits before throwing a timeout exception?

Upvotes: 4

Views: 3482

Answers (1)

Andreas Janson
Andreas Janson

Reputation: 36

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

10 is the timeout is seconds.

Upvotes: 2

Related Questions