Java-Selenium WebDriver-如何检查文件下载对话框是否可见?(并非仅下载可见性)
是否可以使用SeleniumWebDriver或任何其他Java库检查IE中的文件下载对话框是否可见 我不想下载这个文件。我无法验证对话框的可见性 我也无法关闭对话框 有什么帮助吗Java-Selenium WebDriver-如何检查文件下载对话框是否可见?(并非仅下载可见性),java,selenium,internet-explorer-8,webdriver,ui-automation,Java,Selenium,Internet Explorer 8,Webdriver,Ui Automation,是否可以使用SeleniumWebDriver或任何其他Java库检查IE中的文件下载对话框是否可见 我不想下载这个文件。我无法验证对话框的可见性 我也无法关闭对话框 有什么帮助吗 检查您的IE意外警告行为是否设置为忽略 试一试{ 该对话框不是JavaScript警报。 //Click the link that brings up the download dilaog // Perform your next step : This is where the sc
该对话框不是JavaScript警报。
//Click the link that brings up the download dilaog
// Perform your next step : This is where the script will throw the excpetion due to the modal dialog.
}
catch(Exception e){
if(e.getMessage().contains("Modal dialog present")) {
System.out.println("A modal dialog is present. (which can be a download dialog)" );
System.out.println(e.getMessage());
// the exception message includes text contained in the dialaog. You can use it for validaton.
//Use a java robot class to cancel the dialog
Robot robot= new Robot();
robot.keyPress(KeyEvent.VK_ENTER);
//Since the current focus is on cancel.. else use robot.keyPress(KeyEvent.VK_TAB) as needed.
}