WebDriver随机崩溃Chrome

时间:2014-05-02 20:44:59

标签: java google-chrome selenium

使用Selenium ChromeDriver在谷歌浏览器中运行我的测试套装时,它经常会使用“#34;哇!”消息使浏览器崩溃! Chrome崩溃了。现在重新启动?"。基本上导致代码中的非确定性行为。

import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

// Set chromeDriver path
System.setProperty("webdriver.chrome.driver", "chromedriver.exe");

ChromeOptions options = new ChromeOptions();

// Force english
options.addArguments("--lang=en");

// Launch chrome
WebDriver driver = new ChromeDriver(options);
... // Click elements, fill text fields, etc.

以下是抛出的示例异常:

[137.372][SEVERE]: Unable to receive message from renderer
org.openqa.selenium.WebDriverException: chrome not reachable
  (Session info: chrome=31.0.1650.63)
  (Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2.22 seconds
Build info: version: '2.35.0', revision: '8df0c6b', time: '2013-08-12 15:43:19'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_05'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, chrome={userDataDir=C:\Users\PRENAME~1\AppData\Local\Temp\scoped_dir2076_16030}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, version=31.0.1650.63, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 596eb8b1a989584e999a48b9d94f910d

scoped_dir2076_16030文件夹中的chrome_debug.log文件显示为:

[9740:9584:0504/013034:ERROR:policy_loader_win.cc(370)] PReg file doesn't exist: C:\Windows\System32\GroupPolicy\Machine\Registry.pol
[7304:8360:0504/013035:ERROR:base_feature_provider.cc(122)] manifestTypes: Allowing web_page contexts requires supplying a value for matches.
[9740:9376:0504/013035:ERROR:policy_loader_win.cc(370)] PReg file doesn't exist: C:\Windows\System32\GroupPolicy\Machine\Registry.pol
[9740:9376:0504/013035:ERROR:policy_loader_win.cc(370)] PReg file doesn't exist: C:\Windows\System32\GroupPolicy\Machine\Registry.pol
[9740:9584:0504/013044:INFO:CONSOLE(0)] "event.returnValue is deprecated. Please use the standard event.preventDefault() instead.", source:  (0)
[9740:9584:0504/013045:INFO:CONSOLE(0)] "event.returnValue is deprecated. Please use the standard event.preventDefault() instead.", source:  (0)
[9740:9584:0504/013048:INFO:CONSOLE(0)] "event.returnValue is deprecated. Please use the standard event.preventDefault() instead.", source:  (0)
[9740:9584:0504/013050:INFO:CONSOLE(0)] "event.returnValue is deprecated. Please use the standard event.preventDefault() instead.", source:  (0)
[9740:9584:0504/013052:INFO:CONSOLE(0)] "event.returnValue is deprecated. Please use the standard event.preventDefault() instead.", source:  (0)
[9740:9584:0504/013054:INFO:CONSOLE(0)] "event.returnValue is deprecated. Please use the standard event.preventDefault() instead.", source:  (0)
[9740:9584:0504/013056:INFO:CONSOLE(0)] "event.returnValue is deprecated. Please use the standard event.preventDefault() instead.", source:  (0)
[9740:9584:0504/013101:INFO:CONSOLE(0)] "event.returnValue is deprecated. Please use the standard event.preventDefault() instead.", source:  (0)
[9740:9584:0504/013102:INFO:CONSOLE(0)] "event.returnValue is deprecated. Please use the standard event.preventDefault() instead.", source:  (0)
[9740:9584:0504/013104:INFO:CONSOLE(0)] "event.returnValue is deprecated. Please use the standard event.preventDefault() instead.", source:  (0)
[9740:9584:0504/013105:INFO:CONSOLE(0)] "event.returnValue is deprecated. Please use the standard event.preventDefault() instead.", source:  (0)
[9740:9584:0504/013107:INFO:CONSOLE(0)] "event.returnValue is deprecated. Please use the standard event.preventDefault() instead.", source:  (0)
[9740:9584:0504/013108:INFO:CONSOLE(0)] "event.returnValue is deprecated. Please use the standard event.preventDefault() instead.", source:  (0)
[9740:9584:0504/013111:INFO:CONSOLE(0)] "event.returnValue is deprecated. Please use the standard event.preventDefault() instead.", source:  (0)
[9740:9584:0504/013112:INFO:CONSOLE(0)] "event.returnValue is deprecated. Please use the standard event.preventDefault() instead.", source:  (0)
[9740:9584:0504/013117:INFO:CONSOLE(0)] "event.returnValue is deprecated. Please use the standard event.preventDefault() instead.", source:  (0)
[9740:9584:0504/013119:INFO:CONSOLE(0)] "event.returnValue is deprecated. Please use the standard event.preventDefault() instead.", source:  (0)
[9740:9584:0504/013120:INFO:CONSOLE(0)] "event.returnValue is deprecated. Please use the standard event.preventDefault() instead.", source:  (0)
[9740:9584:0504/013132:INFO:CONSOLE(0)] "event.returnValue is deprecated. Please use the standard event.preventDefault() instead.", source:  (0)
[8712:7424:0504/013139:ERROR:ipc_channel_win.cc(404)] pipe error: 232
[9740:9584:0504/013143:INFO:CONSOLE(0)] "event.returnValue is deprecated. Please use the standard event.preventDefault() instead.", source:  (0)
[5276:9684:0504/013152:ERROR:ipc_channel_win.cc(132)] pipe error: 109
[9740:9584:0504/013153:INFO:CONSOLE(0)] "event.returnValue is deprecated. Please use the standard event.preventDefault() instead.", source:  (0)
[8268:10092:0504/013158:ERROR:ipc_channel_win.cc(132)] pipe error: 109
[2528:616:0504/013203:ERROR:ipc_channel_win.cc(132)] pipe error: 109
[9740:9584:0504/013205:INFO:CONSOLE(0)] "event.returnValue is deprecated. Please use the standard event.preventDefault() instead.", source:  (0)
[7112:5484:0504/013215:ERROR:ipc_channel_win.cc(132)] pipe error: 109
[9740:9584:0504/013215:INFO:CONSOLE(0)] "event.returnValue is deprecated. Please use the standard event.preventDefault() instead.", source:  (0)
[5400:8440:0504/013220:ERROR:ipc_channel_win.cc(132)] pipe error: 109
[9740:9584:0504/013227:INFO:CONSOLE(0)] "event.returnValue is deprecated. Please use the standard event.preventDefault() instead.", source:  (0)
[8656:9276:0504/013231:ERROR:ipc_channel_win.cc(132)] pipe error: 109

1 个答案:

答案 0 :(得分:0)

我发现的一件事是,如果你在完成关闭chromeDriver之前停止测试,假设你在调试器模式下运行并终止运行,那么chromeDriver进程仍然存在于任务管理器中。这可能会累积并耗尽您的所有资源。当我摆脱所有这些仍然存在的进程时,这个问题就停止了。