java - 我的 selenium 代码无法在 IE 11 上运行

标签 java selenium-webdriver

我使用 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/

相关文章:

java - ResultSet 可以用于直接填充表吗?

java - 使用处理程序访问共享数据

java - Maven : Multi Module order

java - 不可见元素被 Selenium WebDriver、Java 检测为 isDisplayed

java - 如何在 Java 中将 cookie 从 HttpURLConnection 传递到 WebDriver?

java - JPA:我应该使用 orm.xml 清理我的实体类吗?

java - 如何获取树项的所有父级?

ruby-on-rails - 为什么 Selenium 在 CircleCI 2.0 版本中使用了不正确的根目录?

java - 页面对象模型未从类扩展驱动程序

python-3.x - 如何从h2标签获取HREF? Python/ Selenium