org.openqa.selenium.NoSuchWindowException:尝试通过selenium和IEDriverServer打开Internet Explorer 11时无法获取浏览器

org.openqa.selenium.NoSuchWindowException:尝试通过selenium和IEDriverServer打开Internet Explorer 11时无法获取浏览器,selenium,selenium-webdriver,webdriver,internet-explorer-11,selenium-iedriver,Selenium,Selenium Webdriver,Webdriver,Internet Explorer 11,Selenium Iedriver,我无法使用selenium webdriver启动Internet Explorer浏览器。面对下面的错误,有人能帮忙吗 发生错误: Started InternetExplorerDriver server (32-bit) 3.14.0.0 Listening on port 45640 Only local connections are allowed Aug 06, 2019 3:32:27 PM org.openqa.selenium.remote.ProtocolHandshake

我无法使用selenium webdriver启动Internet Explorer浏览器。面对下面的错误,有人能帮忙吗

发生错误:

Started InternetExplorerDriver server (32-bit)
3.14.0.0
Listening on port 45640
Only local connections are allowed
Aug 06, 2019 3:32:27 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Exception in thread "main" org.openqa.selenium.NoSuchWindowException: Unable to get browser
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'A13540', ip: '10.40.75.65', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_60'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities {acceptInsecureCerts: false, browserName: internet explorer, browserVersion: 11, javascriptEnabled: true, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), se:ieOptions: {browserAttachTimeout: 0, elementScrollBehavior: 0, enablePersistentHover: true, ie.browserCommandLineSwitches: , ie.ensureCleanSession: false, ie.fileUploadDialogTimeout: 3000, ie.forceCreateProcessApi: false, ignoreProtectedModeSettings: false, ignoreZoomSetting: false, initialBrowserUrl: http://localhost:45640/, nativeEvents: true, requireWindowFocus: false}, setWindowRect: true, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}}
Session ID: ddba15a7-0a39-45cb-89d5-e6023ff636da
此错误消息

Exception in thread "main" org.openqa.selenium.NoSuchWindowException: Unable to get browser
…表示IEDriversServer无法启动/生成新的网络浏览会话,即InternetExplorer浏览器会话

您的主要问题是所使用的二进制文件版本之间的不兼容,如下所示:

  • 您的Selenium客户端版本是3.141.59
  • 您的InternetExplorerDriver版本3.14.0.0
  • 您的JDK版本是1.8.0_60,非常古老
因此,Selenium客户端v3.141.59、InternetExplorerDriver v3.14.0.0和JDK v8u60之间存在明显的不匹配。根据最佳实践,Selenium客户端和InternetExplorerDriver是同步发布的,您必须使用同一版本中的两个二进制文件


解决方案
  • 将JDK升级到当前级别
  • 将IEDriverServer升级到当前级别
  • 通过IDE清理项目工作区,并仅使用所需的依赖项重建项目
  • 执行
    @测试
需要检查的几点: 1.检查安全设置。为所有选项启用保护模式“Internet、本地Internet、受信任的站点、受限制的站点”不得选择。 2.检查iedriverserver.exe(适用于IE 11 3.14)版本兼容性

感谢和问候, 山德普·贾朱