实施jenkins docker image + chrome + ruby​​未知错误时出现问题:Chrome无法启动:崩溃(Selenium :: WebDriver :: Error :: UnknownError) [英] Issues while implementing jenkins docker image+chrome+ruby unknown error: Chrome failed to start: crashed (Selenium::WebDriver::Error::UnknownError)

查看:189
本文介绍了实施jenkins docker image + chrome + ruby​​未知错误时出现问题:Chrome无法启动:崩溃(Selenium :: WebDriver :: Error :: UnknownError)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用官方的jenkins码头工人镜像来设置jenkins.

I am trying to setup jenkins using the official jenkins docker image.

Dockerfile

Dockerfile

FROM jenkins/jenkins:lts

USER root
RUN apt-get update && apt install -y ruby-full
RUN apt-get install -y curl
RUN apt -y autoremove
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -
RUN apt-get install -y nodejs
RUN apt-get install -y build-essential
RUN apt install -y wget
RUN gem install --no-ri --no-rdoc --format-executable rake
RUN gem install selenium-webdriver
RUN gem install bundler
RUN npm install -g node-mongo-seeds

#Permissions granted to jenkins user to do a gem install
RUN chown -R jenkins:jenkins /var/lib/gems
RUN apt-get install -y patch ruby-dev zlib1g-dev liblzma-dev
RUN chown -R jenkins:jenkins /usr/local/bin

# We need wget to set up the PPA and xvfb to have a virtual screen and unzip to install the Chromedriver
RUN apt-get install -y wget xvfb unzip

# Set up the Chrome PPA
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list

# Update the package list and install chrome
RUN apt-get update -y
RUN apt-get install -y google-chrome-stable

# Set up Chromedriver Environment variables
ENV CHROMEDRIVER_VERSION 2.35
ENV CHROMEDRIVER_DIR /chromedriver
RUN mkdir $CHROMEDRIVER_DIR

# Download and install Chromedriver
RUN wget -q --continue -P $CHROMEDRIVER_DIR "http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip"
RUN unzip $CHROMEDRIVER_DIR/chromedriver* -d $CHROMEDRIVER_DIR

# Put Chromedriver into the PATH
ENV PATH $CHROMEDRIVER_DIR:$PATH

USER jenkins

在运行作业时,浏览器将无法打开并进入本地主机. 我也尝试打'google.com'

While running the job the browser won't open and hit the localhost. I tried hitting 'google.com' as well

google-chrome --headless --no-sandbox 'https://www.google.com'

仍然没有成功

    Fontconfig warning: "/etc/fonts/fonts.conf", line 100: unknown element "blank"
[0531/130727.949511:ERROR:browser_process_sub_thread.cc(217)] Waited 17 ms for network service

我不明白为什么詹金斯用户无法打开浏览器.

I am not able understand why jenkins user not able to open the browser.

  • Google Chrome 74.0.3729.169
  • ChromeDriver 2.35.528139(47ead77cb35ad2a9a83248b292151462a66cd881)
  • 红宝石2.3.3p222(2016-11-21)[x86_64-linux-gnu]
  • 詹金斯2.164.3

推荐答案

此错误消息...

unknown error: Chrome failed to start: crashed (Selenium::WebDriver::Error::UnknownError)

...表示 ChromeDriver 无法启动/产生新的 WebBrowser ,即 Chrome浏览器会话.

...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser i.e. Chrome Browser session.

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

Your main issue is the incompatibility between the version of the binaries you are using as follows:

支持 Chrome v62-64

  • 您正在使用 chrome = 74.0
  • ChromeDriver v74.0 明确提到以下内容:
    • You are using chrome=74.0
    • Release Notes of ChromeDriver v74.0 clearly mentions the following :
    • 支持 Chrome v74

      因此 ChromeDriver v2.35 Chrome浏览器v74.0

      • ChromeDriver 升级到当前的> strong> ChromeDriver v74.0 级别.
      • 保持 Chrome 版本为 Chrome v74 级别. (根据ChromeDriver v2.46发行说明)
      • 通过 IDE
      • 清理您的项目工作区重建您的项目,并且仅具有必需的依赖项.
      • 如果您的基本 Web客户端版本太旧,则将其卸载并安装最新版本的 Web客户端 GA.
      • 执行您的@Test.
      • Upgrade ChromeDriver to current ChromeDriver v74.0 level.
      • Keep Chrome version at Chrome v74 level. (as per ChromeDriver v2.46 release notes)
      • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
      • If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
      • Execute your @Test.

      这篇关于实施jenkins docker image + chrome + ruby​​未知错误时出现问题:Chrome无法启动:崩溃(Selenium :: WebDriver :: Error :: UnknownError)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆