Java window.showModalDialog在使用selenium运行时不显示

Java window.showModalDialog在使用selenium运行时不显示,java,selenium,testing,selenium-webdriver,automated-tests,Java,Selenium,Testing,Selenium Webdriver,Automated Tests,在java web应用程序中,有一行代码,每当单击链接时都会打开一个弹出窗口,该窗口具有ok/cancle按钮: return window.showModalDialog("popupWindow", obj, sFeatures); 我在selenium中使用下面的代码来单击链接 geckoDriver.findElement(By.xpath(".//a[contains(@onclick, 'return openlink(8251')]")).click(); 我确信链接已成功单击

在java web应用程序中,有一行代码,每当单击链接时都会打开一个弹出窗口,该窗口具有ok/cancle按钮:

return window.showModalDialog("popupWindow", obj, sFeatures);
我在selenium中使用下面的代码来单击链接

geckoDriver.findElement(By.xpath(".//a[contains(@onclick, 'return openlink(8251')]")).click();
我确信链接已成功单击,但window.showModalDialog未打开,因此我无法继续

有什么问题

请注意,我使用gecko驱动程序,并使用chromeDriver和ieDriver测试我的应用程序,但没有成功

Html标记:

<td width="80" aria-describedby="grdOpeningTrustCartable_" title="openning" style="text-align:center;" role="gridcell">
<a class="gridHighlight" onclick="return openLink(8251,'04/12/17 15:50:00')" href="javascript:void(0);">openning</a>
</td>
您可以使用JavaScript Exceutor来解决这个问题;考虑到您的单击是一种工作,但不会导致任何操作:

JavascriptExecutor js = (JavascriptExecutor) driver;

js.executeScript("return openLink(8251,'04/12/17 15:50:00');");

请张贴标签的html;“那我就可以帮你了。”我编辑了这个问题