Selenium python: unable to connect to service% s "% self.path

I try to run the selenium test using a python script, but when I run the test I get the following error:

Traceback (most recent call last):
File "/var/www/html/selenium-scripts/example.py", line 13, in <module>
driver = webdriver.Chrome()
File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 61, in __init__self.service.start()
File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/common/service.py", line 88, in start
raise WebDriverException("Can not connect to the Service %s" % self.path)
selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service chromedriver

Please advice on how to solve this problem.

+4
source share
2 answers

After a long search and attempts at various solutions. I found one that worked for me here: https://github.com/SeleniumHQ/selenium/issues/2903#issuecomment-272112510

As mentioned in this comment, try adding 127.0.0.1 localhostto / etc / hosts

+1
source

MAC-: , : 1. + Shift + G /private/etc/hosts 2. 3. > " , txt" 4.Go Terminal cat/etc/hosts ,

##
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1   localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
0

All Articles