简体   繁体   English

WebDriverException 消息:'chromedriver' 可执行文件需要在 PATH 中(在 mac M1 上出错)

[英]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.

相关问题 WebDriverException:WebDriverException:消息:“chromedriver”可执行文件需要在 PATH 中 - WebDriverException: WebDriverException: Message: 'chromedriver' executable needs to be in PATH WebDriverException:消息:“ ChromeDriver可执行文件需要在路径中可用 - WebDriverException: Message: 'ChromeDriver executable needs to be available in the path selenium.common.exceptions.WebDriverException:消息:“chromedriver”可执行文件需要在 PATH 中 - selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH Selenium WebDriverException:消息:“ chromedriver.exe”可执行文件必须位于PATH中 - Selenium WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH selenium.common.exceptions.WebDriverException:消息:“chromedriver”可执行文件需要在无头 Chrome 的 PATH 错误中 - selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH error with Headless Chrome 错误消息:“'chromedriver' 可执行文件需要在路径中可用” - Error message: "'chromedriver' executable needs to be available in the path" 错误消息:'chromedriver' 可执行文件需要是 PATH - Error Message: 'chromedriver' executable needs to be PATH WebDriverException:消息:“chromedriver”可执行文件需要在 PATH 中,同时通过 Selenium Chromedriver python 设置 UserAgent - WebDriverException: Message: 'chromedriver' executable needs to be in PATH while setting UserAgent through Selenium Chromedriver python 为 Windows - selenium.common.exceptions.WebDriverException 安装 Chromedriver:消息:“chromedriver.exe”可执行文件需要在 PATH 中 - Installing Chromedriver for Windows - selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH Gitlab CI 出现错误 selenium.common.exceptions.WebDriverException:消息:当我运行我的简单 pro 时,'chromedriver' 可执行文件需要在 PATH 中 - Gitlab CI got error selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH when I running my simple pro
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM