2017-04-18 106 views
0

我试图接受/关闭在子窗口上的确认,我的代码在Chrome上正常运行,但在IE网页驱动程序上失败。Selenium:无法处理在IE浏览器中的子窗口上的确认

我有一个HTML页面order它将启动一个子窗口popup它显示一个按钮,点击确认

下面是它运行硒我的Java代码 - 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忽略只是为了验证是否默认解雇是造成任何问题,但仍然没有成功。

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

我使用IE浏览器的Web驱动程序版本2.53.1.0(32位)

任何帮助/提示什么可以去错会有所帮助。谢谢!

回答

0

我用更新版本的IE Web Driver尝试过,并且此问题不可重现。

相关问题