WebDriverException: Message: "Unable to connect to ChromeDriver." Error in utils.is_connectable (self.port):

I am trying to use chromedriver 2.10 to run my tests in Chrome browser version 35.0.1916.114 on a CentOS computer

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

I actually fixed the path problem because the error message was different if the problem was path related

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 get another error, but now the error is when creating the connection

+6
source share
4 answers


For linux

1. Make sure you have installed the latest version of chrome browser- > "chromium-browser -version"
2. If not, install the latest version of chrome "sudo apt-get install chromium-browser"
3. Get the appropriate version of the chrome driver from the following link http://chromedriver.storage.googleapis.com/index.html
4. Unzip chromedriver.zip
5. Move the file to / usr / bin / directory sudo mv chromedriver / usr / bin /
6. Go to the / usr / bin / directory and you 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() 
+15
source

Check line 127.0.0.1. localhost is added to the / etc / hosts file and uncommented. This was a problem for some of my colleagues, and I was able to play it after I deleted this line. Adding it back solved the problem.

+6
source

open the file / etc / hosts and check 127.0.0.1 localhost matches

+2
source

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

0
source

Source: https://habr.com/ru/post/972679/


All Articles