[英]org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: crashed (headless chrome)
I am running headless chrome on centos, with headless chrome version 2.38, and google-chrome-stable version 67.0 我在centos上运行无头Chrome,无头chrome版本2.38和google-chrome-stable版本67.0
System.setProperty("webdriver.chrome.driver", driverPath);
log.warn("chrome driver path is : {}", driverPath);
List<String> options = proxyConfig.getChromeOptions();
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments(options);
Map<String, String> capabilites = proxyConfig.getCapabilities();
if(MapUtils.isNotEmpty(capabilites)) {
for (Map.Entry<String, String> entry : capabilites.entrySet()) {
chromeOptions.setCapability(entry.getKey(), entry.getValue());
}
}
// proxy configuration
/*Proxy proxy = new Proxy();
proxy.setProxyType(Proxy.ProxyType.MANUAL);
proxy.setHttpProxy(proxyConfig.getProxyHost());
proxy.setSocksUsername(proxyConfig.getProxyUsername());
proxy.setSocksPassword(proxyConfig.getProxyPassword());
chromeOptions.setCapability(CapabilityType.PROXY, proxy);*/
log.warn("chorme driver created ");
return new ChromeDriver(chromeOptions);
chrome options: 镀铬选项:
"--headless",
"----disable-gpu",
"--ignore-certificate-errors",
"window-size=1920,1080"
It is giving below given error message at last line : 它在最后一行给出以下给定的错误消息:
org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: crashed
(Driver info: chromedriver=2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb),platform=Linux 4.9.77blibli.com x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.11 seconds
Build info: version: ‘3.6.0’, revision: ‘6fbf3ec767’, time: ‘2017-09-27T15:28:36.4Z’
System info: host: ‘csrapp-02’, ip: ‘127.0.1.1’, os.name: ‘Linux’, os.arch: ‘amd64’, os.version: ‘4.9.77dwdwde.com’, java.version: ‘1.8.0_101’
Driver info: driver.version: ChromeDriver
i have verified chrome, and chromedriver version, it is compatible. 我已经验证了chrome和chromedriver版本,它是兼容的。 Couldn't understand why it is not running on centos?
不明白为什么它不能在centos上运行? Same code works fine on mac
相同的代码在Mac上工作正常
pom POM
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.12.0</version>
</dependency>
This error message... 此错误消息...
org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: crashed
...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser ie Chrome Browser session. ...暗示ChromeDriver无法启动/产生新的WebBrowser,即Chrome浏览器会话。
As you are using Headless Chrome on CentOS it is worth to mention that as per the discussion Getting Started with Headless Chrome --disable-gpu
is Temporarily needed if running on Windows.
当您在CentOS上使用无头Chrome时 ,值得一提的是,根据讨论,“无头Chrome入门
--disable-gpu
Temporarily needed if running on Windows.
则Temporarily needed if running on Windows.
--disable-gpu
Temporarily needed if running on Windows.
--disable-gpu \ # Temporarily needed if running on Windows.
However, your main issue is the incompatibility between the version of the binaries you are using as follows: 但是,您的主要问题是所使用的二进制文件版本之间的不兼容 ,如下所示:
So there is a clear mismatch between the JDK v8u101 , Selenium Client v3.6.0 , ChromeDriver v2.38 and the Chrome Browser v67.0 因此, JDK v8u101 , Selenium Client v3.6.0 , ChromeDriver v2.38和Chrome浏览器v67.0之间显然存在不匹配
@Test
. @Test
。 driver.quit()
within tearDown(){}
method to close & destroy the WebDriver and Web Client instances gracefully. tearDown(){}
方法内调用driver.quit()
,以优雅地关闭和破坏WebDriver和Web Client实例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.