1

My code is:

from selenium import webdriver

driver = webdriver.Firefox()
driver.get('https://python.org')

driver.close()

The error is:

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.

I put the path to geckodriver in the systemvariable's path:

https://i.stack.imgur.com/DiuGv.png

What else can I do? I am lost.

Bleb Pleb
  • 11
  • 1
  • 3
  • You probably have to restart PyCharm to renew environment vars, or explicitly put it in PATH before running your test. – WebComer Jan 08 '19 at 18:55

0 Answers0