我是Selenium
的新手。硒webdriver抛出超时异常
我的问题是,我试图点击一个元素,但Selenium
抛出一个timeout exception
,即使我增加超时值。
我需要使用xpath
而不是id
吗?
的HTML代码是:
void searchquotation() throws TimeoutException {
try {
WebDriverWait wait = new WebDriverWait(driver, 15);
WebElement element = wait.until(ExpectedConditions.presenceOfElementLocated(By.name("SearchButton")));
element.click();
}
catch(TimeoutException e) {
System.out.println("Timeout occured");
}
难道我做错了什么?
请先确保在使用这个JavaScript document.getElementsByName(浏览器控制台‘搜索按钮’您收到此按钮)或不? –