8

I am trying to use the chromedriver 2.10 to run my tests on Chrome Browser Version 35.0.1916.114 On CentOS machine

/home/varunm/EC_WTF_0.4.10/EC_WTF0.4.10_Project/wtframework/wtf/drivers/chromedriver

Actually I fixed the path issue, because the error message was different if the issue was with path

    def start(self):
    """
    Starts the ChromeDriver Service.

    :Exceptions:
     - WebDriverException : Raised either when it can't start the service
       or when it can't connect to the service
    """
    env = self.env or os.environ
    try:
        self.process = subprocess.Popen([
          self.path,
          "--port=%d" % self.port] +
          self.service_args, env=env, stdout=PIPE, stderr=PIPE)
    except:
        raise WebDriverException(
            "ChromeDriver executable needs to be available in the path. \
            Please download from http://chromedriver.storage.googleapis.com/index.html\
            and read up at http://code.google.com/p/selenium/wiki/ChromeDriver")
    count = 0
    while not utils.is_connectable(self.port):
        count += 1
        time.sleep(1)
        if count == 30:
             raise WebDriverException("Can not connect to the ChromeDriver")

If the path was wrong I will receive some other error, but now the error is while making the connection

kvm006
  • 4,554
  • 2
  • 18
  • 22
  • Can you reformat your question, it is very hard to read as is. Sounds like you did not put chromedriver in the right path. Where did you put it? How are you specifying the location? – SiKing Jul 23 '14 at 16:50
  • /home/varunm/EC_WTF_0.4.10/EC_WTF0.4.10_Project/wtframework/wtf/drivers/chromedriver – kvm006 Jul 23 '14 at 18:29
  • @SiKing did you understand my issue now? Thanks for looking into this. I have already handled the issue with the path. But now the error is with making connections to the chromedriver. My tests work fine on firefox – kvm006 Jul 23 '14 at 18:43
  • There are two chromedriver libraries for linux, for 32 and 64 bit systems. Are you using the right one? You can download them here http://chromedriver.storage.googleapis.com/index.html?path=2.10/ – sap1ens Jul 25 '14 at 04:49
  • Yes, I have done the 64 bit Chrome driver ... my centos virtual machine is 64 bit too .. – kvm006 Jul 26 '14 at 07:00
  • Does the Chrome browser version matter? ? I have the latest version of Chrome browser – kvm006 Jul 26 '14 at 07:01

5 Answers5

21


For Linux

1. Check you have installed latest version of chrome brwoser-> "chromium-browser -version"
2. If not, install latest version of chrome "sudo apt-get install chromium-browser"
3. get appropriate version of chrome driver from following link http://chromedriver.storage.googleapis.com/index.html
4. Unzip the chromedriver.zip
5. Move the file to /usr/bin/ directory sudo mv chromedriver /usr/bin/
6. Goto /usr/bin/ directory and you would need to run something like "chmod a+x chromedriver" to mark it executable.
7. finally you can execute the code.

import os
from selenium import webdriver
from pyvirtualdisplay import Display
display = Display(visible=0, size=(800, 600))
display.start()
driver = webdriver.Chrome()
driver.get("http://www.google.com")
print driver.page_source.encode('utf-8')
driver.quit()
display.stop()
Vicky
  • 5,098
  • 2
  • 33
  • 31
  • What is the pyvirtualdisplay? I run code without it and chome doesn't run still – alexche8 Dec 22 '15 at 13:12
  • @alexche8 I guess that is for the people who run their tests on a virtual server(with no display) – kvm006 Jan 04 '16 at 19:54
  • @alex, pyvirtuadisplay performs all graphical operations in memory without showing any screen output. Let me know your issue. – Vicky Jan 05 '16 at 09:24
  • Had to use some options https://stackoverflow.com/a/60168019/1454173 – M at Jun 05 '22 at 04:21
19

Verify the line 127.0.0.1 localhost is added to your /etc/hosts file and uncommented. This was the issue for some of my colleagues, and I was able to reproduce it after I've removed this line. Adding it back solved the problem.

Ramona Suciu
  • 191
  • 1
  • 2
4

open /etc/hosts file and check 127.0.0.1 localhost have matched

1
Confirm that your chrome version matches.
If you are using Chrome version 73, please download ChromeDriver 73.0.3683.20
If you are using Chrome version 72, please download ChromeDriver 2.46 or ChromeDriver 72.0.3626.69
If you are using Chrome version 71, please download ChromeDriver 2.46 or ChromeDriver 71.0.3578.137

Download: http://chromedriver.chromium.org/downloads

messay
  • 43
  • 6
0

This usually means that you are not using the latest ChromeDriver. For that, navigate to https://sites.google.com/a/chromium.org/chromedriver/.

Happy Bird
  • 1,012
  • 2
  • 11
  • 29