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.