You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Selenium 4.11.2+ChromeDriver运行报错求助:无法获取Chrome驱动

树莓派环境下Selenium运行错误求助

我在树莓派上运行一段简单的Selenium代码时遇到无法解决的错误,请求帮助。

已确认的ChromeDriver版本

pi@Rpi:~ $ chromedriver --version
ChromeDriver 92.0.4515.98 (564abd8de2c05f45308eec14f9110a10aff40ad9-refs/branch-heads/4515@{#1501})

运行的代码

from selenium import webdriver

driver=webdriver.Chrome()
driver.get("https://www.google.com/")

报错信息

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/common/selenium_manager.py", line 123, in run
    completed_proc = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "/usr/lib/python3.7/subprocess.py", line 472, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.7/subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/usr/local/lib/python3.7/dist-packages/selenium/webdriver/common/linux/selenium-manager'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/common/driver_finder.py", line 38, in get_path
    path = SeleniumManager().driver_location(options) if path is None else path
  File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/common/selenium_manager.py", line 90, in driver_location
    output = self.run(args)
  File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/common/selenium_manager.py", line 129, in run
    raise WebDriverException(f"Unsuccessful command executed: {command}") from err
selenium.common.exceptions.WebDriverException: Message: Unsuccessful command executed: /usr/local/lib/python3.7/dist-packages/selenium/webdriver/common/linux/selenium-manager --browser chrome --output json


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/pi/src/test.py", line 3, in <module>
    driver=webdriver.Chrome()
  File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/chrome/webdriver.py", line 50, in __init__
    keep_alive,
  File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/chromium/webdriver.py", line 51, in __init__
    self.service.path = DriverFinder.get_path(self.service, options)
  File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/common/driver_finder.py", line 41, in get_path
    raise NoSuchDriverException(msg) from err
selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain driver for chrome using Selenium Manager.; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location

已尝试的解决方法

  • 多次重装Selenium和ChromeDriver
  • 手动指定驱动路径
  • 将ChromeDriver放置在项目目录中

项目及驱动位置截图

项目及ChromeDriver位置

内容的提问来源于stack exchange,提问作者Paulvanderheijden

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.14 07:17:02