Der Versuch, Selen in Linux zu führen, kann Treiber nicht finden
Posted: 05 Sep 2025, 02:34
Code: Select all
-rwxr-xr-x 1 kyle kyle 6132584 Feb 24 09:27 /usr/local/bin/geckodriver
echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/kyle/.dotnet/tools
< /code>
Es ist mein Verständnis Selen sollte in der Lage sein, den Treiber automatisch zu finden. Das scheint für mich nicht zu funktionieren. < /P>
pip show selenium
Name: selenium
Version: 4.18.1
< /code>
Wenn ich versuche, mein Python -Skript mit < /p>
auszuführendriver = webdriver.Firefox()
< /code>
Ich bekomme < /p>
Message: Unable to obtain driver for firefox using Selenium Manager.
< /code>
Wenn ich < /p>
verwendedriver = webdriver.Firefox("/usr/local/bin/geckodriver")
< /code>
Traceback (most recent call last):
File "/usr/lib/python3/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/lib/python3/dist-packages/selenium/webdriver/common/selenium_manager.py", line 87, in driver_location
browser = options.capabilities["browserName"]
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'capabilities'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/kyle/Documents/ElecticityUsage.py", line 181, in
driver = webdriver.Firefox("/usr/local/bin/geckodriver")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/selenium/webdriver/firefox/webdriver.py", line 59, in __init__
self.service.path = DriverFinder.get_path(self.service, options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/selenium/webdriver/common/driver_finder.py", line 40, in get_path
msg = f"Unable to obtain driver for {options.capabilities['browserName']} using Selenium Manager."
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'capabilities'