Selenium 无法在 cygwin 中找到 chromedriver

Selenium unable to find chromedriver in cygwin

提问人:Ben J 提问时间:10/2/2023 更新时间:10/2/2023 访问量:29

问:

我在Cygwin中使用Selenium进行了简单的设置

[main] $ pip show selenium
Name: selenium
Version: 4.13.0
Summary:
Home-page: https://www.selenium.dev
Author:
Author-email:
License: Apache 2.0
Location: /usr/local/lib/python3.9/site-packages
Requires: certifi, trio, trio-websocket, urllib3
Required-by:
webdriver.Chrome(options=options)

但是,Selenium 在尝试查找 chromedriver 时会引发 FileNotFoundError

    return webdriver.Chrome(options=options)
  File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
    super().__init__(
  File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/chromium/webdriver.py", line 53, in __init__
    self.service.start()
  File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/common/service.py", line 98, in start
    self._start_process(self._path)
  File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/common/service.py", line 204, in _start_process
    self.process = subprocess.Popen(
  File "/usr/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.9/subprocess.py", line 1821, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\ben\\.cache\\selenium\\chromedriver\\win64\\117.0.5938.92\\chromedriver.exe'

看起来该文件已经存在,这似乎表明 Selenium 正在正确下载驱动程序,并且在 PATH 中找到驱动程序

[main] $ ls 'C:\\Users\\ben\\.cache\\selenium\\chromedriver\\win64\\117.0.5938.92'
chromedriver.exe

我之前有一个webdriver_manager设置,运行良好,但我试图切换到使用 Selenium Manager。

这是 python、Cygwin 还是 Selenium 问题?

python-3.x selenium-webdriver selenium-chromedriver cygwin

评论


答: 暂无答案