【发布时间】:2019-12-10 17:04:08
【问题描述】:
我正在尝试自动化我遇到问题的 Web 应用程序。问题是我想单击一个按钮,即导出按钮,它将要求导出为 pdf 或 Excel。在检查时我可以找到该元素,但在运行脚本时它没有单击按钮。该按钮具有标签input 并键入image。
我尝试过使用不同的 xpath,如下所示,我也尝试过没有点击按钮的绝对 xpath。
driver.findElement(By.xpath("//input[@name='exportReport']")).click();
和
WebDriverWait wait = new WebDriverWait (driver, 20);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//input[@name='exportReport']")));
driver.findElement(By.xpath("//input[@name='exportReport']")).click();
<td width="15px">
<input type = "image" name="exportReport" src="birt/images/ExportReport.gif title="Export report" alt="Export report" class="birtviewer_clickable">
</td>
这个标签不是img标签,但类型是image。
我明白了:
“元素点击被拦截”、“NosuchelementException”。
【问题讨论】:
-
你的浏览器是什么版本?
-
您收到的是
Element click Intercepted还是NosuchelementException? -
我用的是Chrome,版本是75.0.3770.142
-
现在我得到 NosuchelementException。
标签: java selenium xpath css-selectors webdriverwait