selenium: [🐛 Bug]: Selenium 4.21 Python — cannot load selenium-manager

What happened?

After upgrading Selenium from 4.20 to 4.21, the existing geckodriver is no longer found. In the console, I can see that the binary is in /opt/local/bin/geckodriver

However, my script that has worked until yesterday with Selenium 4.20, now outputs

NoSuchDriverException: Message: Unable to obtain driver for firefox; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location

Adding the line service = webdriver.ChromeService(executable_path='/opt/local/bin/geckodriver') to my code has no effect.

How can we reproduce the issue?

from selenium import webdriver
from selenium.webdriver.firefox.options import Options

Browseroptionen = Options()
Browseroptionen.set_preference("browser.download.folderList", 2)
Browseroptionen.set_preference("browser.download.manager.showWhenStarting", False)
Browseroptionen.set_preference("browser.download.dir", "/Users/stefan/Eingang")
Browseroptionen.set_preference("browser.helperApps.neverAsk.saveToDisk", "application/pdf")
Browseroptionen.set_preference("browser.download.useDownloadDir", True)
Browseroptionen.set_preference("browser.download.viewableInternally.enabledTypes", "")
Browseroptionen.set_preference("pdfjs.disabled", True)
Browseroptionen.set_preference("browser.download.alwaysOpenPanel", False)

with webdriver.Firefox(options=Browseroptionen) as browser:
    browser.set_window_rect(x=0, y=22, width=1280, height=1372)

Relevant log output

ERROR:root:File "/Users/guy/Library/Python/3.11/lib/python/site-packages/selenium/webdriver/common/driver_finder.py", line 67, in _binary_paths
    52   def _binary_paths(self) -> dict:
 (...)
    63               if not Path(path).is_file():
    64                   raise ValueError(f"The path is not a valid file: {path}")
    65               self._paths["driver_path"] = path
    66           else:
--> 67               output = SeleniumManager().binary_paths(self._to_args())
    68               if Path(output["driver_path"]).is_file():
    ..................................................
     self = <selenium.webdriver.common.driver_finder.DriverFinder object
              at 0x118825010>
     path = None
     self._paths = {'driver_path': '',
                    'browser_path': ''}
     self._to_args = <method 'DriverFinder._to_args' of <selenium.webdriver.commo
                      n.driver_finder.DriverFinder object at 0x118825010> driver_f
                      inder.py:81>
    ..................................................

File "/Users/guy/Library/Python/3.11/lib/python/site-packages/selenium/webdriver/common/selenium_manager.py", line 53, in binary_paths
    37   def binary_paths(self, args: List) -> dict:
 (...)
    49       args.append("python")
    50       args.append("--output")
    51       args.append("json")
    52
--> 53       return self._run(args)
    ..................................................
     self = <selenium.webdriver.common.selenium_manager.SeleniumManager
             object at 0x118824fd0>
     args = ['/Users/guy/Library/Python/3.11/lib/python/site-packages
             /selenium/webdriver/common/macos/selenium-manager', '--brows
             er', 'firefox', '--language-binding', 'python', '--output',
             'json', ]
     self._run = <function 'SeleniumManager._run' selenium_manager.py:94>
    ..................................................

File "/Users/guy/Library/Python/3.11/lib/python/site-packages/selenium/webdriver/common/selenium_manager.py", line 118, in _run
    95   def _run(args: List[str]) -> dict:
 (...)
    114
    115      SeleniumManager._process_logs(output["logs"])
    116      result = output["result"]
    117      if completed_proc.returncode:
--> 118          raise WebDriverException(
    119              f"Unsuccessful command executed: {command}; code: {completed_proc.returncode}\n{result}\n{stderr}"
    ..................................................
     args = ['/Users/guy/Library/Python/3.11/lib/python/site-packages
             /selenium/webdriver/common/macos/selenium-manager', '--brows
             er', 'firefox', '--language-binding', 'python', '--output',
             'json', ]
     output = {'logs': [],
               'result': {}}
     result = {}
     completed_proc.returncode = -6
    ..................................................

---- (full traceback above) ----
File "/Users/guy/Library/Python/3.11/lib/python/site-packages/selenium/webdriver/common/driver_finder.py", line 67, in _binary_paths
    output = SeleniumManager().binary_paths(self._to_args())
File "/Users/guy/Library/Python/3.11/lib/python/site-packages/selenium/webdriver/common/selenium_manager.py", line 53, in binary_paths
    return self._run(args)
File "/Users/guy/Library/Python/3.11/lib/python/site-packages/selenium/webdriver/common/selenium_manager.py", line 118, in _run
    raise WebDriverException(

WebDriverException: Message: Unsuccessful command executed: /Users/guy/Library/Python/3.11/lib/python/site-packages/selenium/webdriver/common/macos/selenium-manager --browser firefox --language-binding python --output json; code: -6
{}
dyld: cannot load 'selenium-manager' (load command 0x80000034 is unknown)


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

File "/Users/guy/bin/Bankinteraktionen.py", line 2518, in <module>
    2514          Durchführungsstatus_Bankinteraktionen = json.load(Statusdatei)
    2515  except Exception as Dateifehler:
    2516      print(
    2517          'Inhalt der JSON-Datei konnte nicht eingelesen werden. Existiert die Datei? Ist sie leer? Ist die Datenstruktur fehlerhaft?')
--> 2518  main()
    2519
    ..................................................
     Durchführungsstatus_Bankinteraktionen = {'Raiffeisen': '2024-05-17',
                                              'Schöllerbank': '2024-05-17',
                                              'Bank Austria': '2024-05-17',
                                              'Erste Bank': '2024-05-11'}
     json.load = <function 'load' __init__.py:274>
     Statusdatei = <_io.TextIOWrapper name='/Users/guy/.config/Bankinterakti
                    onen/Durchführungsstatus.json' mode='r' encoding='UTF-8'>
    ..................................................

File "/Users/guy/bin/Bankinteraktionen.py", line 2406, in main
    2370  def main():
 (...)
    2402      Bankname: str = ''
    2403
    2404  # 2024-05-01: wegen Fehler mit seleniumwire dzt. auskommentiert
    2405      # with webdriver.Firefox(options=Browseroptionen, seleniumwire_options=SeleniumWireOptionen) as browser:
--> 2406      with webdriver.Firefox(options=Browseroptionen) as browser:
    2407          # ImplicitWaitimeout = browser.manage().timeouts().getImplicitWaitTimeout().getSeconds()
    ..................................................
     Bankname = ''
     Browseroptionen = <selenium.webdriver.firefox.options.Options object at 0x1188
                        251d0>
    ..................................................

File "/Users/guy/Library/Python/3.11/lib/python/site-packages/selenium/webdriver/firefox/webdriver.py", line 57, in __init__
    38   def __init__(
    39       self,
    40       options: Options = None,
    41       service: Service = None,
    42       keep_alive: bool = True,
    43   ) -> None:
 (...)
    53       self.service = service if service else Service()
    54       options = options if options else Options()
    55
    56       finder = DriverFinder(self.service, options)
--> 57       if finder.get_browser_path():
    58           options.binary_location = finder.get_browser_path()
    ..................................................
     self = # error calling repr and str
     options = <selenium.webdriver.firefox.options.Options object at 0x1188
                251d0>
     service = None
     keep_alive = True
     self.service = <selenium.webdriver.firefox.service.Service object at 0x1128
                     60390>
     finder = <selenium.webdriver.common.driver_finder.DriverFinder object
                at 0x118825010>
     finder.get_browser_path = <method 'DriverFinder.get_browser_path' of <selenium.webdriv
                                er.common.driver_finder.DriverFinder object at 0x118825010>
                                driver_finder.py:46>
     options.binary_location = ''
    ..................................................

File "/Users/guy/Library/Python/3.11/lib/python/site-packages/selenium/webdriver/common/driver_finder.py", line 47, in get_browser_path
    46   def get_browser_path(self) -> str:
--> 47       return self._binary_paths()["browser_path"]
    ..................................................
     self = <selenium.webdriver.common.driver_finder.DriverFinder object
              at 0x118825010>
     self._binary_paths = <method 'DriverFinder._binary_paths' of <selenium.webdriver.
                           common.driver_finder.DriverFinder object at 0x118825010> dri
                           ver_finder.py:52>
    ..................................................

File "/Users/guy/Library/Python/3.11/lib/python/site-packages/selenium/webdriver/common/driver_finder.py", line 78, in _binary_paths
    52   def _binary_paths(self) -> dict:
 (...)
    74               else:
    75                   raise ValueError(f'The browser path is not a valid file: {output["browser_path"]}')
    76       except Exception as err:
    77           msg = f"Unable to obtain driver for {browser}"
--> 78           raise NoSuchDriverException(msg) from err
    79       return self._paths
    ..................................................
     self = <selenium.webdriver.common.driver_finder.DriverFinder object
              at 0x118825010>
     msg = 'Unable to obtain driver for firefox'
     self._paths = {'driver_path': '',
                    'browser_path': ''}
    ..................................................

---- (full traceback above) ----
File "/Users/guy/bin/Bankinteraktionen.py", line 2518, in <module>
    main()
File "/Users/guy/bin/Bankinteraktionen.py", line 2406, in main
    with webdriver.Firefox(options=Browseroptionen) as browser:
File "/Users/guy/Library/Python/3.11/lib/python/site-packages/selenium/webdriver/firefox/webdriver.py", line 57, in __init__
    if finder.get_browser_path():
File "/Users/guy/Library/Python/3.11/lib/python/site-packages/selenium/webdriver/common/driver_finder.py", line 47, in get_browser_path
    return self._binary_paths()["browser_path"]
File "/Users/guy/Library/Python/3.11/lib/python/site-packages/selenium/webdriver/common/driver_finder.py", line 78, in _binary_paths
    raise NoSuchDriverException(msg) from err

NoSuchDriverException: Message: Unable to obtain driver for firefox; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location

Operating System

macOS 10.13.6

Selenium version

Python 4.21

What are the browser(s) and version(s) where you see this issue?

Firefox 115.11.0(esr)

What are the browser driver(s) and version(s) where you see this issue?

geckodriver 0.30.0

Are you using Selenium Grid?

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 29 (18 by maintainers)

Most upvoted comments