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 797 forks source link

Fix error on load modules #888

Closed felippeefreire closed 4 years ago

felippeefreire commented 4 years ago

WhatsApp has changed the way of encapsulating the modules. In this way, it works in both versions.

mhndm commented 4 years ago
if driver.is_connected() == False:

File "webwhatsapi/init.py", line 315, in is_connected return self.wapi_functions.isConnected() File "webwhatsapi/wapi_js_wrapper.py", line 44, in getattr wapi_functions = dir(self) File "webwhatsapi/wapi_js_wrapper.py", line 72, in dir self.driver.execute_script(script.read()) File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 636, in execute_script 'args': converted_args})['value'] File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.JavascriptException: Message: SyntaxError: unexpected token: identifier

lilachn commented 4 years ago

I've used this PR, it fixed the issue I had with the window.Store.Msg, but now whenever I try to call get_unread() I'm getting cyclic object error. Downgrading to firefox 61 (I'm with 72) didn't work at all.

u``` ntu@ip-xxxxx-xxx:~/whatsapp/WebWhatsapp-Wrapper$ python3.7 Python 3.7.8 (default, Jun 29 2020, 05:46:05) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information.

from webwhatsapi import WhatsAPIDriver driver = WhatsAPIDriver(username="mkhase") driver.get_status() 'LoggedIn' driver.get_unread() Traceback (most recent call last): File "", line 1, in File "/home/ubuntu/whatsapp/WebWhatsapp-Wrapper/webwhatsapi/init.py", line 411, in get_unread raw_message_groups = self.wapi_functions.getUnreadMessages( File "/home/ubuntu/whatsapp/WebWhatsapp-Wrapper/webwhatsapi/wapi_js_wrapper.py", line 44, in getattr wapi_functions = dir(self) File "/home/ubuntu/whatsapp/WebWhatsapp-Wrapper/webwhatsapi/wapi_js_wrapper.py", line 74, in dir result = self.driver.execute_script("return window.WAPI") File "/home/ubuntu/.local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 636, in execute_script 'args': converted_args})['value'] File "/home/ubuntu/.local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/home/ubuntu/.local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.JavascriptException: Message: Cyclic object value