selenium - UnreachableBrowserException:与远程浏览器通信时出错。它可能已经死了,并且 Command 未能干净地关闭。强行破坏
问题描述
当我执行一个测试套件时,tearDown() 方法会随机失败,并且它下面的所有测试都会被跳过。以下是详细信息。附上屏幕截图。
测试跟踪:
org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died. Build info: version: '2.46.0', revision: '61506a4624b13675f24581e453592342b7485d71', time: '2015-06-04 10:22:50' System info: host: 'W7-VDI-WDW704', ip: '10.207.15.35', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_152' Driver info: driver.version: RemoteWebDriver
日志:
INFO: Command failed to close cleanly. Destroying forcefully (v2). org.openqa.selenium.os.UnixProcess$SeleniumWatchDog@12c7a01b
Oct 09, 2018 4:03:01 PM org.openqa.selenium.os.ProcessUtils killWinProcess WARNING: Process refused to die after 10 seconds, and couldn't taskkill it
org.openqa.selenium.os.ProcessUtils$ProcessStillAliveException: Timeout waiting for process to die at org.openqa.selenium.os.ProcessUtils.waitForProcessDeath(ProcessUtils.java:67) at (...)
Suite Total tests run: 196, Failures: 4, Skips: 175 Configuration Failures: 176, Skips: 175
- Chrome 版本:版本 69.0.3497.100
- Chromedriver:ChromeDriver 2.42**
解决方案
此错误消息...
org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died
.
INFO: Command failed to close cleanly. Destroying forcefully (v2). org.openqa.selenium.os.UnixProcess$SeleniumWatchDog@12c7a01b Oct 09, 2018 4:03:01 PM org.openqa.selenium.os.ProcessUtils killWinProcess WARNING: Process refused to die after 10 seconds, and couldn't taskkill it
...意味着ChromeDriver无法杀死WebBrowser即RemoteWebDriver。
您的主要问题是您使用的二进制文件版本之间的不兼容,如下所示:
根据在 Windows 上的讨论,RemoteWebDriver.quit() 总是强行破坏?这个问题在Selenium v2.45.0 之前的版本中很明显,@timja2 在他的评论中提到:
它预计在 Windows 上总是会破坏得更厉害
此修复程序通过提交 7a5e890合并,预计将从Selenium v2.53.1开始提供。
解决方案
- 将Selenium升级到最低版本 2.53.1或当前级别的版本 3.14.0。
推荐阅读
- python-3.x - 如何让 knitr 输出 python 3 代码并使其在 R 块中可用?
- github-actions - 如果我输入注释,运行命令并添加提交的 GitHub 操作
- node.js - 无法通过 fs.open() 命令创建文件,即使该文件之前不存在
- python - scikit-build 纯 Python 包
- bash - 时髦的。获取部分值被参数化的参数值
- javascript - 工具提示上按月计算的折线图总计
- android - 创建可执行的 android / apk game maker 2 出错,(我使用 android studio)
- r - 使用二进制列对新数据框进行子集
- ios - 构建时出现颤振错误:命令 PhaseScriptExecution 失败,退出代码为非零
- c# - 确保 HTTPS 绑定存在于 Wix 中 IIS 的默认网站中