Explore Courses Blog Tutorials Interview Questions
+2 votes
in DevOps and Agile by (19.4k points)

I ran into a problem while working with Selenium. For my project, I have to use Chrome. However, I can't connect to that browser after launching it with Selenium.

For some reason, Selenium can't find Chrome by itself. This is what happens when I try to launch Chrome without including a path:

Traceback (most recent call last):

  File "./", line 73, in <module>

    browser = webdriver.Chrome() # Get local session of chrome

  File "/usr/lib64/python2.7/site-packages/selenium/webdriver/chrome/", line 46, in __init__


  File "/usr/lib64/python2.7/site-packages/selenium/webdriver/chrome/", line 58, in start

    and read up at")

selenium.common.exceptions.WebDriverException: Message: 'ChromeDriver executable needs to be available in the path.                 Please download from                and read up at'

To solve this problem, I then included the Chromium path in the code that launches Chrome. However, the interpreter fails to find a socket to connect to:

Traceback (most recent call last):

  File "./", line 73, in <module>

    browser = webdriver.Chrome('/usr/bin/chromium') # Get local session of chrome

  File "/usr/lib64/python2.7/site-packages/selenium/webdriver/chrome/", line 46, in __init__


  File "/usr/lib64/python2.7/site-packages/selenium/webdriver/chrome/", line 64, in start

    raise WebDriverException("Can not connect to the ChromeDriver")

selenium.common.exceptions.WebDriverException: Message: 'Can not connect to the ChromeDriver'

I also tried solving the problem by launching chrome with:

chromium --remote-shell-port=9222

However, this did not work either.

PS. Here's some information about my system:

www-client: chromium 15.0.874.121  

dev-lang:   python 2.7.2-r3 Selenium 2.11.1  

OS:         GNU/Linux Gentoo Kernel 3.1.0-gentoo-r1

1 Answer

+1 vote
by (27.5k points)
edited by

Step 1: Check if you have installed the latest version of chrome brwoser-> chromium-browser -version. If not, install the latest version of chrome by using sudo apt-get install chromium-browser

Step 2: get the appropriate version of chrome driver from here

Step 3: Unzip the

Step 4: Now, move the file to /usr/bin directory sudo mv chromedriver /usr/bin

Step 5: Goto /usr/bin directory cd /usr/bin

Step 6: Now, you would need to run something like sudo chmod a+x chromedriver to mark it executable.

Step 7: Finally you can execute the code.

from selenium import webdriver

driver = webdriver.Chrome()


print driver.page_source.encode('utf-8')



For more information please go through the following tutorial to get more info about selenium:


Welcome to Intellipaat Community. Get your technical queries answered by top developers!

30.5k questions

32.6k answers


108k users

Browse Categories