2

I have tried various SO solutions on going about this. System Config:

  • MacOS Catalina
  • Python 3.7.6 (Anaconda)
  • Selenium 3.141
  • Chrome v81, ChromeDriver v81.

    Error: Can not connect to the service chromedriver.

I have tried the same with various driver and browers: Gecko/Firefox(Fresh install), Safaridriver/Safar - all with the same error.

The chromedriver, geckodriver are in PATH as well as usr/local/bin.

Code to reproduce:

from selenium import webdriver
chromedriver = '/usr/local/bin/chromedriver'
driver = webdriver.Chrome(chromedriver)

I have also tried various solutions, executable_path=chromedriver and hosts file with localhost 127.0.0.1 entry.

chromedriver by itself runs perfectly, without any issues, it just can't seem to connect to Selenium.

Any help, if possible will be appreciated.

Expected results: Selenium connects to driver

Actual Results: raise WebDriverException("Can not connect to the Service %s" % self.path) selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service /usr/local/bin/chromedriver

Solutions already tried:

And other solutions on SO.

  • Have you tried to do this? https://github.com/SeleniumHQ/selenium/issues/2903#issuecomment-272112510 – Naveen May 13 '20 at 15:05
  • I have tried that, it focused on localhost address in the hosts file. It didn't do anything, everything was already the way it was supposed to be. @Naveen – Shivam Ralli May 13 '20 at 15:10
  • Can you try to initiate Chrome as per this answer https://stackoverflow.com/a/39428368/7964299? – Naveen May 13 '20 at 16:00
  • I tried that, it didn't work. The error remained the same. @Naveen – Shivam Ralli May 15 '20 at 20:55

1 Answers1

1

While experimenting to make this work, I somehow messed up while creating venv and docker images. Python as a whole got corrupted, along with chrome drivers. Had to reset the system.

That somehow has solved my problem with selenium. If anyone else finds the answer to this bug, be sure to drop your solution.

Until then, this was my update about how I got it working.