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.02k stars 796 forks source link

Error in function getBatteryLevel TypeError: window.Store.Conn is undefined #1117

Open dafner opened 2 years ago

dafner commented 2 years ago

Hello ,

I found that the getBatteryLevel function has stopped working again because "Store.Conn" does not exist or this definition does not exist.

The same happens with other functions that make use of "Store.Conn"

Any ideas on how to get the battery status or a replacement from Store.Conn?

Any help will be appreciate

Thanks!!!

imagen

MoudiZd commented 2 years ago

@dafner

Try this :

https://github.com/mukulhase/WebWhatsapp-Wrapper/issues/1116#issuecomment-977895845

dafner commented 2 years ago

thanks MoudiZd ,

I mofidied the wapi.js file according to your suggestion But the problem persiste getting the battery level. Now I get the following message: "selenium.common.exceptions.JavascriptException: Message: SyntaxError: missing ] after element list"

By the way, I am testing the original wapi.js file and the modied sample "log_all.py" in order to descart any problems in my library

Any Idea about how to this problem? How I can monitoring the battery level of my cell phone?

Thank in advance!

In line 82 of the log_all.py file I add the following line and modified the print function:

    level = driver.get_battery_level()

    print(
        "Checking for more messages, status. Pinger={pingcount} {level}".format(
            pingcount=pinger,
        ),
        driver.get_status(), level
    )

python3 log_all.py Waiting for QR Bot started EXCEPTION: Message: SyntaxError: missing ] after element list

Traceback (most recent call last): File "/home/administrador/workspace/test/WebWhatsapp-Wrapper/log_all.py", line 76, in send_message_to_master( File "/home/administrador/workspace/test/WebWhatsapp-Wrapper/log_all.py", line 37, in send_message_to_master driver.send_message_to_id(phone_whatsapp, message) File "/home/administrador/workspace/test/WebWhatsapp-Wrapper/webwhatsapi/init.py", line 664, in send_message_to_id return self.wapi_functions.sendMessageToID(recipient, message) File "/home/administrador/workspace/test/WebWhatsapp-Wrapper/webwhatsapi/wapi_js_wrapper.py", line 44, in getattr wapi_functions = dir(self) File "/home/administrador/workspace/test/WebWhatsapp-Wrapper/webwhatsapi/wapi_js_wrapper.py", line 72, in dir self.driver.execute_script(script.read()) File "/usr/local/lib/python3.9/dist-packages/selenium/webdriver/remote/webdriver.py", line 634, in execute_script return self.execute(command, { File "/usr/local/lib/python3.9/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/usr/local/lib/python3.9/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.JavascriptException: Message: SyntaxError: missing ] after element list

MoudiZd commented 2 years ago

You must share you wapi.js file here, so we can help you... As the error now says missing ] that means that some syntax errors occured and we cannot help you solving syntax errors without taking a look to your whole wapi.js file contents

MoudiZd commented 2 years ago

The real problem is with the structure of window.Store and the way is injected within modules, and if the entioned fix is not applied you will not be able to access this object...

dafner commented 2 years ago

Sorry, I found the problem. I have been make a mistake when I copied & pasted the code in wapi.js file Now I can get again the battery level

Thanks you very much for your help!