alfred82santa / whalesong

Whalesong is an asyncio python library to manage WebApps remotely. Currently WhatsappWeb is implemented
https://whalesong.readthedocs.io
MIT License
50 stars 19 forks source link

problems using the library: webpackJsonp is not a function #129

Open dafner opened 4 years ago

dafner commented 4 years ago

I encountered an error when restarting an application that was normally running I try to run the example 'minibot.py' and the error obtained is the same Ctually, it is impossible to use the library due to the error that occurs: TypeError: webpackJsonp is not a function

Has anyone else had this type of error? have they been able to solve it?

thank you very much for any kind of help you can give me

python3 minibot.py Traceback (most recent call last): File "minibot.py", line 238, in bot.loop.run_until_complete(bot.start()) File "/usr/lib/python3.6/asyncio/base_events.py", line 484, in run_until_complete return future.result() File "minibot.py", line 225, in start await self._driver.start() File "/home/administrador/workspace/whatsappx/whalesong/whalesong/init.py", line 96, in start await self._driver.connect() File "/home/administrador/workspace/whatsappx/whalesong/whalesong/driver_firefox.py", line 108, in connect await self.run_scriptlet() File "/home/administrador/workspace/whatsappx/whalesong/whalesong/driver.py", line 69, in run_scriptlet await self._internal_run_scriptlet(script.read()) File "/home/administrador/workspace/whatsappx/whalesong/whalesong/driver_firefox.py", line 119, in _internal_run_scriptlet await self._run_async(self.driver.execute_script, script) File "/home/administrador/workspace/whatsappx/whalesong/whalesong/driver_firefox.py", line 73, in _run_async return await self.loop.run_in_executor(self._pool_executor, partial(method, *args, *kwargs)) File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(self.args, self.kwargs) File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 636, in execute_script 'args': converted_args})['value'] File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.JavascriptException: Message: TypeError: webpackJsonp is not a function**

marcelocecin commented 4 years ago

change wapi.js

//webpackJsonp([], {'parasite': (x, y, z) => getStore(z)}, ['parasite']); 

if (typeof webpackJsonp === 'function') {
    webpackJsonp([], {'parasite': (x, y, z) => getStore(z)}, ['parasite']);
} else {
    webpackJsonp.push([
        ['parasite'],
        {
            parasite: function (o, e, t) {
                getStore(t);
            }
        },
        [['parasite']]
    ]);
}
vasani-arpit commented 4 years ago

As this project doesn't have wapi.js you may need to edit it here. https://github.com/alfred82santa/whalesong/blob/master/js/src/whalesong/index.js#L319

and build the source again.

dafner commented 4 years ago

thanks!

I put the following code in the file js/src/whalesong/index.js and then ran the command make build-js

/ webpackJsonp([], { 'whalesong': (x, y, z) => discoveryModules(z) }, ['whalesong']); /

if (typeof webpackJsonp === 'function') { webpackJsonp([], {'whalesong': (x, y, z) => discoveryModules(z)}, ['whalesong']); } else { webpackJsonp.push([ ['whalesong'], { whalesong: function (o, e, t) { discoveryModules(t); } }, [['whalesong']] ]); }

After the whalesong.js file was generated correctly and applying the recommendation indicated by vasani-arpit from Sep 30, 2019 in comment # 121 (https://github.com/alfred82santa/whalesong/issues/121#issuecomment-536587381 ), since there is no correction so far in the library; I ran the minibot.js example again, to verify the correct operation of the library and I got the following error:

$ python3 minibot.py Monitor stream Stream value: Stream.CONNECTED Monitor new messages 5491155111884@c.us Task exception was never retrieved future: <Task finished coro=<Minibot.make_echo() done, defined at minibot.py:89> exception=ManagerNotFound('Manager chats not found',)> Traceback (most recent call last): File "minibot.py", line 94, in make_echo message.id))) whalesong.errors.ManagerNotFound: Manager chats not found

Has anyone had this same error when using the library and has fixed it?

By the way, is there any other more correct method to solve the problem indicated in # 121 (ManagerNotFound: Manager messages not found) without having to try different values to adjust the delay?

I will appreciate any help you can give me to have the application operational again using this library.

Thanks in advance

marcelocecin commented 4 years ago

try to use this https://github.com/mukulhase/WebWhatsapp-Wrapper

dafner commented 4 years ago

thanks for your answer marcelocecin, but it is the only option that I have?

By your suggest, I considerer that this proyect is dead

It is very dificult to migrate an async application to a sync, but if it is not more updates here I will need to considerer migrate my application

thanks

marcelocecin commented 4 years ago

this one is async https://github.com/smashah/sulla

hbustos commented 4 years ago

change wapi.js

//webpackJsonp([], {'parasite': (x, y, z) => getStore(z)}, ['parasite']); 

if (typeof webpackJsonp === 'function') {
    webpackJsonp([], {'parasite': (x, y, z) => getStore(z)}, ['parasite']);
} else {
    webpackJsonp.push([
        ['parasite'],
        {
            parasite: function (o, e, t) {
                getStore(t);
            }
        },
        [['parasite']]
    ]);
}

Hi Marcelo, after change wapi.js, get this error

selenium.common.exceptions.JavascriptException: Message: Cyclic object value

can you help me ?

marcelocecin commented 4 years ago

https://github.com/mukulhase/WebWhatsapp-Wrapper/issues/404

hbustos commented 4 years ago

thanks, whit firefox 61.02 can't scan QR, web whatsapp page is not displayed properly!

whit Chrome, get this error. selenium.common.exceptions.JavascriptException: Message: javascript error: circular reference

Windows 10. Firefox 61.0.2 Geckodriver 0.26.0 webwhassapi 2.0.3 install from git. selenium 3.141.0

marcelocecin commented 4 years ago

try to edit wapi.js again

hbustos commented 4 years ago

Same problem, wich is the best configuration?

OS? firefox version? geckodriver?

any one have this working ?

thanks!

marcelocecin commented 4 years ago

are you using whalesong or WebWhatsapp-Wrapper ?

hbustos commented 4 years ago

WebWhatsapp-Wrapper

marcelocecin commented 4 years ago

please open an issue in the WebWhatsapp-Wrapper repository, if possible include error print