bond
bond

Reputation: 11346

Selenium WebDriver findelement stuck java?

I am writing a very simple test case using selenium webdriver. Lets say I have

@Test
public void github_search() {
    this.webDriver.get("http://www.github.com");

    WebElement findBox = this.webDriver.findElement(By.id("qa"));

......
}

in this test, there is no element on the page with id of "qa", in this case I am excepting the findElement method to throw an exception. But it doesn't. Selenium actually appears to be stuck. Only thing I could do is manually close the browser. I was wondering how to handle such situation where if the element doesn't exist then it waits for some time and, finally it should just throw an exception.

Upvotes: 1

Views: 2160

Answers (2)

csaykov
csaykov

Reputation: 116

Just download latest 2.27 release:

https://code.google.com/p/selenium/downloads/list

Upvotes: 3

Barath
Barath

Reputation: 39

Use try catch Block and use implicit wait.

Upvotes: 0

Related Questions