l3satwik / whazzap

A Python script to send automated replies to unread messages using Whatsapp Web.
9 stars 9 forks source link

WebDriverException #2

Open basu021 opened 2 years ago

basu021 commented 2 years ago

Traceback (most recent call last): File "C:\Users\Basu\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\selenium\webdriver\common\service.py", line 72, in start self.process = subprocess.Popen(cmd, env=self.env, File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2032.0_x64qbz5n2kfra8p0\lib\subprocess.py", line 951, in init self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2032.0_x64qbz5n2kfra8p0\lib\subprocess.py", line 1420, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, 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 "C:\Users\Basu\Documents\GitHub\whazzap\app.py", line 4, in browser = webdriver.Firefox() File "C:\Users\Basu\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\selenium\webdriver\firefox\webdriver.py", line 142, in init self.service.start() File "C:\Users\Basu\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\selenium\webdriver\common\service.py", line 79, in start raise WebDriverException( selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

nahkhsinad commented 10 months ago

Traceback (most recent call last): File "C:\Users\Basu\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\selenium\webdriver\common\service.py", line 72, in start self.process = subprocess.Popen(cmd, env=self.env, File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2032.0_x64qbz5n2kfra8p0\lib\subprocess.py", line 951, in init self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2032.0_x64qbz5n2kfra8p0\lib\subprocess.py", line 1420, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, 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 "C:\Users\Basu\Documents\GitHub\whazzap\app.py", line 4, in browser = webdriver.Firefox() File "C:\Users\Basu\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\selenium\webdriver\firefox\webdriver.py", line 142, in init self.service.start() File "C:\Users\Basu\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\selenium\webdriver\common\service.py", line 79, in start raise WebDriverException( selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.


The error message you are getting indicates that the Selenium driver for Firefox, called geckodriver, is not in your PATH environment variable. This means that when Selenium tries to start Firefox, it cannot find the geckodriver executable.

There are two ways to fix this error:

Add geckodriver to your PATH environment variable. This is the recommended solution, as it will allow Selenium to find geckodriver automatically. To do this, follow these steps:

Open the Control Panel. Click on System and Security. Click on System. Click on Advanced system settings. In the Environment Variables dialog box, scroll down to the Path variable and click on Edit. Add the directory where geckodriver is installed to the end of the Path variable, separated by a semicolon. Click OK to close all dialog boxes. Specify the path to geckodriver when you start Selenium. You can do this by passing the executable_path argument to the webdriver.Firefox() constructor. For example: ''' from selenium import webdriver browser = webdriver.Firefox(executable_path='C:/path/to/geckodriver.exe')

''' you can download the geckodriver executable from the following link: geckodriver download page: https://github.com/mozilla/geckodriver/releases

Once you have downloaded geckodriver, extract it to a directory on your computer. Then, follow the instructions above to add it to your PATH environment variable or to specify the path to it when you start Selenium.

''' from selenium import webdriver

Add geckodriver to the PATH environment variable.

import os os.environ['PATH'] += ';C:/path/to/geckodriver'

Start Firefox using the geckodriver executable.

browser = webdriver.Firefox(executable_path='C:/path/to/geckodriver.exe') '''