Egor
Egor

Reputation: 1660

Selenium WebDriver setting ImplicitlyWait does nothing

Here is the entirety of my test class in Java, minus imports.

public class GoogleTest {

private WebDriver driver;

@Before
public void setUp() {
    driver = new FirefoxDriver();
    driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
}

@Test
public void testGoogleTest() throws Exception {
    driver.get("http://www.google.com");
    driver.findElement(By.id("I don't exist"));
}

@After
public void tearDown() throws Exception {
    driver.quit();
    }
}

From my understanding, the implicitlyWait command should make the test error out with "ElementNotFound" after 5 seconds. This doesn't happen. It does open an FF window, goes to google and then sits there forever. If I close the browser window, it will throw an UnreachableBrowser exception (as I would expect). I've tried playing around with different time units, but it made no difference. I'm using Selenium 2.25.

Upvotes: 2

Views: 7804

Answers (1)

Amey
Amey

Reputation: 8548

It seems to be a bug with Selenium 2.25 and Selenium 2.26, so try updating to 2.27

Upvotes: 2

Related Questions