我的代码是:
from selenium import webdriver
driver = webdriver.Firefox()
driver.get('https://python.org')
driver.close()
错误是:
Traceback (most recent call last):
File "C:\Users\Aleksandra\PycharmProjects\YoutubeRG\venv\lib\site-packages\selenium\webdriver\common\service.py", line 76, in start
stdin=PIPE)
File "C:\Users\Aleksandra\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 769, in __init__
restore_signals, start_new_session)
File "C:\Users\Aleksandra\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 1172, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] Das System kann die angegebene Datei nicht finden
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/Aleksandra/PycharmProjects/YoutubeRG/youtubemain.py", line 3, in <module>
driver = webdriver.Firefox()
File "C:\Users\Aleksandra\PycharmProjects\YoutubeRG\venv\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 164, in __init__
self.service.start()
File "C:\Users\Aleksandra\PycharmProjects\YoutubeRG\venv\lib\site-packages\selenium\webdriver\common\service.py", line 83, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
我将geckodriver的路径放在systemvariable的路径中:
https://i.stack.imgur.com/DiuGv.png
我还能做什么?我迷路了。