0
votes

I was trying to use selenium but I got this error:

from selenium import webdriver browser=webdriver.Firefox() Traceback (most recent call last): File "C:\Users\academy\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\common\service.py", line 74, in start stdout=self.log_file, stderr=self.log_file) File "C:\Users\academy\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 950, in init restore_signals, start_new_session) File "C:\Users\academy\AppData\Local\Programs\Python\Python35\lib\subprocess.py", line 1220, in _execute_child startupinfo) FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in browser=webdriver.Firefox() File "C:\Users\academy\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 144, in init self.service.start() File "C:\Users\academy\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start os.path.basename(self.path), self.start_error_message) selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

What do I need to do in order to correct this? Please help.

1

1 Answers

0
votes

You need to have a file "geckodriver.exe" (that's the driver for Firefox) in your windows path (and not Python' libraries path).

To check if you have geckodriver run at a shell prompt : which geckodriver or where geckodriver.