Selenium WebDriver findelement卡住了Java? [英] Selenium WebDriver findelement stuck java?
问题描述
我正在使用Selenium Webdriver编写一个非常简单的测试用例。可以说我有
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"));
......
}
测试中,页面上没有ID为 qa的元素,在这种情况下,我只不过使用findElement方法抛出异常。但事实并非如此。硒实际上似乎被卡住了。我唯一能做的就是手动关闭浏览器。我想知道如何处理这种情况,如果该元素不存在,那么它会等待一段时间,最后应该抛出一个异常。
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.
推荐答案
只需下载最新的2.27版本:
Just download latest 2.27 release:
https://code.google.com/p/selenium/downloads/list
这篇关于Selenium WebDriver findelement卡住了Java?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!