4

Traceback (most recent call last):

  File "testing.py", line 20, in <module>
    driver = webdriver.Chrome(executable_path="/home/cavema11/public_html/testing.py")
  File "/opt/python-3.6.4/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 68, in __init__
    self.service.start()
  File "/opt/python-3.6.4/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 104, in start
    raise WebDriverException("Can not connect to the Service %s" % self.path)
selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service /home/cavema11/public_html/testing.py

I have 127.0.0.1 localhost in my /etc/hosts but still getting this errors.

Please help me.

Thank you

1
  • Did you check the service is online? Commented Jun 8, 2018 at 3:58

1 Answer 1

3

Through the argument executable_path you need to pass the absolute path of the ChromeDriver instead of any other file. So you need to change:

driver = webdriver.Chrome(executable_path="/home/cavema11/public_html/testing.py")

To:

driver = webdriver.Chrome(executable_path='/path/to/chromedriver')

Update

  • Ensure that you have downloaded the exact format of the ChromeDriver binary from the download location pertaining to your underlying OS among:

    • chromedriver_linux64.zip: For Linux OS
    • chromedriver_mac64.zip: For Mac OSX
    • chromedriver_win32.zip: For Windows OS
  • Ensure that /etc/hosts file contains the following entry:

    127.0.0.1 localhost 
    
  • Ensure that ChromeDriver binary have executable permission for the non-root user.

  • Ensure that you have passed the proper absolute path of ChromeDriver binary through the argument executable_path. (chmod 777)
  • Execute your Test as a non-root user.
Sign up to request clarification or add additional context in comments.

12 Comments

Thanks for reply. Getting another error after i change. Here is the error : OSError: [Errno 8] Exec format error: '/home/cavema11/public_html/chromedriver.exe'
You are on Linux OS and need to remove the extension part as in .exe
@user9912010 Checkout my updated answer and let me know the status.
I'm getting this error now "Message: unknown error: cannot find Chrome binary"
Thanks for your help @DebanjanB
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.