Reputation: 1569
I have pulled jenkins container which exposes jenkins at port 8080 in my localhost.
I can see jenkins running fine. I have installed pip I have installed selenium with pip and when I run the test I get an Error:
+ 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
How can I install selenium chrome driver in my jenkins environment?
Upvotes: 3
Views: 2654
Reputation: 16722
A simple approach would be to build your custom Jenkins docker image based on the official one.
The structure would be like this:
# 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
I've pushed an image docker pull elgalu/jenkins
with installed Chrome, chromedriver and Python3 with Selenium bindings. As you requested.
You can either use my image or check the source code and build it yourself:
https://github.com/elgalu/jenkins-chrome
Upvotes: 3