mukulhase / WebWhatsapp-Wrapper

An API for sending and receiving messages over web.whatsapp [Working as of 18th May 2018]
https://webwhatsapi.readthedocs.io/en/latest/
MIT License
2.03k stars 795 forks source link

Error when running sample/async_echo.py: 'geckodriver' executable needs to be in PATH #987

Closed dekkardnexus5 closed 3 years ago

dekkardnexus5 commented 3 years ago

I've downloaded the 19 Oct 2020 package. When I try to run sample/remote.py I get this error:

Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 72, in start self.process = subprocess.Popen(cmd, env=self.env, File "/usr/local/lib/python3.8/subprocess.py", line 854, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/local/lib/python3.8/subprocess.py", line 1702, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'geckodriver'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "sample/async_echo.py", line 9, in driver = WhatsAPIDriverAsync(loadstyles=True, loop=loop) File "/usr/local/lib/python3.8/site-packages/webwhatsapi/async_driver.py", line 36, in init self._driver = WhatsAPIDriver( File "/usr/local/lib/python3.8/site-packages/webwhatsapi/init.py", line 245, in init self.driver = webdriver.Firefox( File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/firefox/webdriver.py", line 164, in init self.service.start() File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 81, in start raise WebDriverException( selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

dekkardnexus5 commented 3 years ago

If you are using REMOTE (Docker Image), change driver initialization to:

profiledir = os.path.join(".", "firefox_cache") if not os.path.exists(profiledir): os.makedirs(profiledir) driver = WhatsAPIDriverAsync(loadstyles=True, loop=loop, command_executor=os.environ["SELENIUM"], profile=profiledir, client="remote", headless=True)