Selenium:无法在 IE 浏览器中处理 child window 上的确认

Selenium : Unable to handle Confirmation on a child window in IE Browser

我正在尝试 accept/dismiss 在 child window 上进行确认,我的代码在 Chrome 上运行正常,但在 IE 网络驱动程序上运行失败。

我有一个 html 页面 order which launches a child window popup,它在单击按钮时显示确认信息

这是我的 Java 运行 selenium 的代码 - TestConfirmationOnNewWindow.java

我收到如下 org.openqa.selenium.NoSuchWindowException: Unable to get browser 异常:

org.openqa.selenium.NoSuchWindowException: Unable to get browser (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 19 milliseconds
    Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
    System info: host: 'BMISHRA2D1', ip: '10.192.38.101', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_101'
    Driver info: org.openqa.selenium.ie.InternetExplorerDriver
    Capabilities [{browserAttachTimeout=0, enablePersistentHover=true, ie.forceCreateProcessApi=false, pageLoadStrategy=normal, ie.usePerProcessProxy=false, ignoreZoomSetting=false, handlesAlerts=true, version=11, platform=WINDOWS, nativeEvents=true, ie.ensureCleanSession=false, elementScrollBehavior=0, ie.browserCommandLineSwitches=, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=http://localhost:36298/, takesScreenshot=true, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=dismiss}]
    Session ID: cb1e7828-1760-4fc6-bcee-7e92156d8ef8
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
        at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:701)
        at org.openqa.selenium.remote.RemoteWebDriver$RemoteTargetLocator.alert(RemoteWebDriver.java:1049)
        at TestConfirmationOnNewWindow.acceptAlert(TestConfirmationOnNewWindow.java:52)
        at TestConfirmationOnNewWindow.testConfirmAlertOnNewWindow(TestConfirmationOnNewWindow.java:38)
        at TestConfirmationOnNewWindow.main(TestConfirmationOnNewWindow.java:28)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

我已经尝试将 DesiredCapabilities 更改为忽略,只是为了验证默认关闭是否会导致任何问题,但仍然没有成功。

Link 到代码的要点页面 - https://gist.github.com/bhabanism/40c6a207c95c66ab6ccd4b765d337ba2

我正在使用 IE Web 驱动程序版本 2.53.1.0(32 位)

关于可能出错的任何 help/hint 都会有所帮助。谢谢!

我尝试使用较新版本的 IE Web 驱动程序,但此问题无法重现。