简体   繁体   English

org.openqa.selenium.WebDriverException:未知错误:Chrome无法启动:崩溃(无头Chrome)

[英]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: 但是,您的主要问题是所使用的二进制文件版本之间的不兼容 ,如下所示:

  • You are using chromedriver=2.38 您正在使用chromedriver = 2.38
  • You are using chrome=67.0 您正在使用chrome = 67.0
  • Your Selenium Client version is 3.6.0 of 2017-09-27T15:28:36.4Z which is almost a year older. 您的Selenium Client版本是2017年9月27日T15:28:36.4Z的 3.6.0现在快一年了
  • Your JDK version is 1.8.0_101 which is pretty ancient . 您的JDK版本1.8.0_101 ,这非常古老

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 v8u101Selenium Client v3.6.0ChromeDriver v2.38Chrome浏览器v67.0之间显然存在不匹配

Solution

  • Upgrade JDK to recent levels JDK 8u171 . JDK升级到最新级别的JDK 8u171
  • Upgrade Selenium to current levels Version 3.12.0 . Selenium升级到当前版本3.12.0
  • Upgrade ChromeDriver to current ChromeDriver v2.40 level. 升级ChromeDriver当前ChromeDriver V2.40水平。
  • Keep Chrome version between Chrome v66-68 levels. Chrome版本保持在Chrome v66-68之间。 ( as per ChromeDriver v2.40 release notes ) 根据ChromeDriver v2.40发行说明
  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only. 通过IDE 清理 项目工作区 ,并仅使用必需的依赖项重建项目。
  • Use CCleaner tool to wipe off all the OS chores before and after the execution of your Test Suite . 在执行测试套件之前和之后,使用CCleaner工具清除所有操作系统杂项。
  • If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client . 如果您的基本Web客户端版本太旧,请通过Revo Uninstaller卸载它,并安装最新的GA和Web Client的发行版本。
  • Take a System Reboot . 进行系统重启
  • Execute your @Test . 执行您的@Test
  • Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully. 始终在tearDown(){}方法内调用driver.quit() ,以优雅地关闭和破坏WebDriverWeb Client实例。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: crashed using ChromeDriver Selenium in Jenkins on Ubuntu 18.04 - org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: crashed using ChromeDriver Selenium in Jenkins on Ubuntu 18.04 org.openqa.selenium.WebDriverException:未知错误:chrome 无法通过 Java 开始使用 Selenium ChromeDriver 和 Chrome - org.openqa.selenium.WebDriverException: unknown error: chrome failed to start using Selenium ChromeDriver and Chrome through Java 线程“ main” org.openqa.selenium.WebDriverException中的异常:未知错误:Chrome无法启动:正常退出 - Exception in thread “main” org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited normally org.openqa.selenium.WebDriverException: chrome 无法访问 - org.openqa.selenium.WebDriverException: chrome not reachable org.openqa.selenium.WebDriverException:未知错误:无法通过Java用ChromeDriver Chrome和Selenium集中元素 - org.openqa.selenium.WebDriverException: unknown error: cannot focus element with ChromeDriver Chrome and Selenium through Java org.openqa.selenium.WebDriverException:无法使用Selenium和ChromeDriver访问Chrome - org.openqa.selenium.WebDriverException: chrome not reachable using Selenium and ChromeDriver 未知错误:Chrome无法启动:崩溃(硒,无头模式) - unknown error: Chrome failed to start: crashed(selenium ,headless mode) 间歇性地为Chrome 57和chromedriver 2.29 org.openqa.selenium.WebDriverException:未知错误:由于页面崩溃而删除了会话” - Intermittently org.openqa.selenium.WebDriverException: unknown error: session deleted because of page crash" for Chrome 57 and chromedriver 2.29 线程“主” org.openqa.selenium.WebDriverException中的异常:无法访问Chrome - Exception in thread “main” org.openqa.selenium.WebDriverException: chrome not reachable org.openqa.selenium.WebDriverException:浏览器无法启动,在fluentlium中测试 - org.openqa.selenium.WebDriverException: Browser failed to start, test in fluentlium
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM