2017-07-19 120 views
1

我已經拉在我的本地主機端口8080 jenkins jenkins容器。我如何在jenkins中安裝selenium chrome驅動程序?

我可以看到詹金斯運行良好。 我已經安裝了PIP 我已經安裝了硒具有畫中畫 ,當我運行測試,我得到一個錯誤:

+ python /var/jenkins_home/workspace/My_Job/slenium_login.py 
12:02:06 Traceback (most recent call last): 

12:02:06 File "/var/jenkins_home/workspace/My_Job/slenium_login.py", line 6, in <module> 

12:02:06  driver = webdriver.Chrome(cd) 

12:02:06 File "/var/jenkins_home/shiningpanda/jobs/5db0e2cb/virtualenvs/d41d8cd9/local/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 62, in __init__ 

12:02:06  self.service.start() 

12:02:06 File "/var/jenkins_home/shiningpanda/jobs/5db0e2cb/virtualenvs/d41d8cd9/local/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 81, in start 

12:02:06  os.path.basename(self.path), self.start_error_message) 

12:02:06 selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home 

如何安裝硒鉻司機在我的詹金斯環境?

+0

剛纔下載的可執行文件chromdriver,並把它的地方。如果是linux,請確保它可以使用jenkins用戶訪問。 –

+0

@GaurangShah我是詹金斯的新手。我運行jenkins作爲碼頭集裝箱,我從碼頭集線器中用''docker pull jenkins''取出,我的jenkins用戶不是root用戶。我如何從作業可執行腳本安裝chromedriver? – Becks

回答

1

一個簡單的方法是建立基於官方的定製Jenkins碼頭圖像。

的結構是這樣的:

# Dockerfile 
FROM jenkins 

# Set user root to allow us to install the rest of what's needed 
USER root 

# <install your stuff here> 

# Go back to non-sudo user 
USER jenkins 

我推的圖像docker pull elgalu/jenkins與安裝了Chrome,chromedriver和Python3硒3.3.1綁定。按照你的要求。

您可以使用我的形象或檢查源代碼,並建立它自己:

https://github.com/elgalu/jenkins-chrome

相關問題