[英]WebDriverException Message: 'chromedriver' executable needs to be in PATH ( Error on mac M1)
I am trying web scrapping with selenium and therefore following the below code.我正在尝试 web 与 selenium 报废,因此遵循以下代码。 However, I encounter an error with chromedriver path, I am unable to figure out on mac M1.但是,我遇到了 chromedriver 路径错误,我无法在 mac M1 上弄清楚。 I've tried several methods to solve this.我已经尝试了几种方法来解决这个问题。
Any hints?有什么提示吗?
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
chromeOptions = Options()
chromeOptions.headless = False
s = Service("usr/local/bin/chromedriver")
driver = webdriver.Chrome(service= s, options = chromeOptions )
I am getting the below error:我收到以下错误:
---------------------------------------------------------------------------
SeleniumManagerException Traceback (most recent call last)
/usr/local/lib/python3.8/dist-packages/selenium/webdriver/common/service.py in start(self)
95 try:
---> 96 path = SeleniumManager().driver_location(browser)
97 except WebDriverException as new_err:
7 frames
SeleniumManagerException: Message: Selenium manager failed for: /usr/local/lib/python3.8/dist-packages/selenium/webdriver/common/linux/selenium-manager --browser chrome. /usr/local/lib/python3.8/dist-packages/selenium/webdriver/common/linux/selenium-manager: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.29' not found (required by /usr/local/lib/python3.8/dist-packages/selenium/webdriver/common/linux/selenium-manager)
/usr/local/lib/python3.8/dist-packages/selenium/webdriver/common/linux/selenium-manager: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by /usr/local/lib/python3.8/dist-packages/selenium/webdriver/common/linux/selenium-manager)
During handling of the above exception, another exception occurred:
WebDriverException Traceback (most recent call last)
/usr/local/lib/python3.8/dist-packages/selenium/webdriver/common/service.py in _start_process(self, path)
210 except OSError as err:
211 if err.errno == errno.ENOENT:
--> 212 raise WebDriverException(
213 f"'{os.path.basename(self.path)}' executable needs to be in PATH. {self.start_error_message}"
214 )
WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://chromedriver.chromium.org/home
You need to provide also the file name of the webdriver in the path, so in your case:您还需要在路径中提供网络驱动程序的文件名,因此在您的情况下:
usr/local/bin/chromedriver
should be like:应该是这样的:
usr/local/bin/chromedriver/chromedriver
if the name of the folder matches the webdriver file name.如果文件夹的名称与 webdriver 文件名匹配。 At least according to the error it seems like chromedriver is a folder where you have placed the real webdriver file.至少根据错误,chromedriver 似乎是您放置真实 webdriver 文件的文件夹。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.