我使用 Java-Selenium 进行了一些自动化测试,在 Chrome/Firefox/IE9 上运行良好。我有 Selenium 2.47 并使用适当的驱动程序。最近我升级到 IE 11,从那时起我的测试失败并出现以下异常:
*org.openqa.selenium.NoSuchWindowException: Unable to find elements on closed window (WARNING: The server did not provide any stacktrace information)*
Command duration or timeout: 31 milliseconds
Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16'
System info: os.name: 'Windows 7', os.arch: 'amd64', java.version: '1.8.0_45'
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:13059/, takesScreenshot=true, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=dismiss}]
*** Element info: {Using=name, value=username}
有人可以指导我吗?
登录页面本身失败。
最佳答案
IE11 和 selenium 存在问题。您需要在 Windows 注册表中配置 IE11 才能解决该问题。
要解决此问题,请创建一个名为“iexplore.exe”的 DWORD 值和 以下键中的值为 0(对于 32 位 Windows):
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE
对于 64 位 Windows 安装,应使用以下 key :
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE
这将解决“无法获取浏览器”错误,并且应该 解决IE11不支持的问题。
关于java - 我的 selenium 代码无法在 IE 11 上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37179667/