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

stuck in Waiting for QR #908

Open juancresc opened 4 years ago

juancresc commented 4 years ago

I'm using the echo demo as it is. It opened the firefox windonws, I scan the QR and it is stuck in waiting for QR.

Code for reference:


import time
from webwhatsapi import WhatsAPIDriver
from webwhatsapi.objects.message import Message

driver = WhatsAPIDriver()
print("Waiting for QR")
driver.wait_for_login()

print("Bot started")

while True:
    time.sleep(3)
    print("Checking for more messages")
    for contact in driver.get_unread():
        for message in contact.messages:
            if isinstance(message, Message):  # Currently works for text messages only.
                contact.chat.send_message(message.content)
Bolche commented 4 years ago

Same here. It appears Whatsapp Web has changed the layout of its page. Try changing the selector of mainPage (line 78, init.py) to "#app .two" If it works I will send a merge request

mikail-o commented 4 years ago

Same here. It appears Whatsapp Web has changed the layout of its page. Try changing the selector of mainPage (line 78, init.py) to "#app .two" If it works I will send a merge request

Solution worked. But another problem appears:

Traceback (most recent call last): File "sample/remote.py", line 30, in <module> for contact in driver.get_unread(): File "/usr/local/lib/python3.8/site-packages/webwhatsapi/__init__.py", line 411, in get_unread raw_message_groups = self.wapi_functions.getUnreadMessages( File "/usr/local/lib/python3.8/site-packages/webwhatsapi/wapi_js_wrapper.py", line 44, in __getattr__ wapi_functions = dir(self) File "/usr/local/lib/python3.8/site-packages/webwhatsapi/wapi_js_wrapper.py", line 72, in __dir__ self.driver.execute_script(script.read()) File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 634, in execute_script return self.execute(command, { File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.JavascriptException: Message: TypeError: window.Store.Msg is undefined

schoerg commented 4 years ago

Apply all changes from pull request #888.

lilachn commented 4 years ago

After applying PR #888 changes I'm getting new errors: untu@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

Anyone else got this error? (In older threads the recommendation was to downgrade to firefox 61 which didn't work for me at all).