WebDriverException "Can Not Connect to the Service Chromedriver" Occurs When Scraping with selenium

Asked 2 years ago, Updated 2 years ago, 125 views

An error occurs when executing the following code in python3.
The selenium installation was done via pip.

Error CCan not connect to the Service Chromedriver br
How can I solve this problem?

Please teach me.

[Code]

#coding:utf-8

from selenium import webdriver

driver=webdriver.Chrome()
driver.get('https://www.google.co.jp/')
driver.close()

Error

Traceback (most recent call last):
  File "sample.py", line 5, in <module>
    driver=webdriver.Chrome()
  File"/usr/local/lib/python 3.5/site-packages/selenium/webdriver/chrome/webdriver.py", line 62, in __init__
    self.service.start()
  File"/usr/local/lib/python 3.5/site-packages/selenium/webdriver/common/service.py", line 92, in start
    raise WebDriverException("Can not connect to the Service%s"%self.path)
selenium.common.exception.WebDriverException:Message:Can not connect to the Service Chromedriver

python macos web-scraping

2022-09-30 20:11

1 Answers

Can't connect to the Service Chromedriver error message.

When I installed selenium on my Mac and ran it on Python 3.5, I also saw the following message:

 selenium.common.exception.WebDriverException: Message: 'chromedriver' executable needs to be in PATH.Please see https://sites.google.com/a/chromium.org/chromedriver/home

Download the file from the URL provided, answer it and place it where PATH passes, such as ~/bin, and it worked.

In my environment, I have already installed a Chrome browser, but I think I also need it.

By the way, Google search with the error message Can not connect to the service chromedriver will give you many solutions.


2022-09-30 20:11

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.