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

async no work. #155

Open gerswin opened 6 years ago

gerswin commented 6 years ago

I can scan the code then firefox closes

tested in osx and linux.

yannn12 commented 6 years ago

i can confirm async example is broken on windows and on linux

alfred82santa commented 6 years ago

Could you give me more detailed error data? I currently using async driver with Linux and MacOS.

yannn12 commented 6 years ago

there is no stack trace no nothing. just when firefox is connecting to phone is show the whatsapp interface with all groups for 1 second and than crashing. the heartbeat is keep beating. @alfred82santa what your version of firefox and geckodriver? i am using the last version maybe this is the problem. edit: here is the log from geckodrive:

1523567924984 Marionette INFO Listening on port 40265 1523567925066 Marionette WARN TLS certificate errors will be ignored for this session JavaScript error: , line 0: uncaught exception: No ServiceWorker controlling this client. JavaScript error: , line 0: uncaught exception: No ServiceWorker controlling this client. JavaScript error: , line 0: uncaught exception: No ServiceWorker controlling this client. JavaScript error: , line 0: uncaught exception: No ServiceWorker controlling this client. 1523567950948 addons.xpi DEBUG Calling bootstrap method shutdown on webcompat@mozilla.org version 1.1 1523567950948 addons.xpi DEBUG Calling bootstrap method shutdown on shield-recipe-client@mozilla.org version 80 1523567950950 addons.xpi DEBUG Calling bootstrap method shutdown on screenshots@mozilla.org version 25.0.0 1523567950962 addons.xpi DEBUG Calling bootstrap method shutdown on onboarding@mozilla.org version 1.0 1523567950964 addons.xpi DEBUG Calling bootstrap method shutdown on langpack-en-ZA@firefox.mozilla.org version 59.0.2 1523567951006 addons.xpi DEBUG Calling bootstrap method shutdown on langpack-en-GB@firefox.mozilla.org version 59.0.2 1523567951022 addons.xpi DEBUG Calling bootstrap method shutdown on formautofill@mozilla.org version 1.0 1523567951022 addons.xpi DEBUG Calling bootstrap method shutdown on followonsearch@mozilla.com version 0.9.6 1523567951022 addons.xpi DEBUG Calling bootstrap method shutdown on firefox@getpocket.com version 1.0.5 1523567951024 addons.xpi DEBUG Calling bootstrap method shutdown on aushelper@mozilla.org version 2.0 1523567951024 addons.xpi DEBUG Calling bootstrap method shutdown on activity-stream@mozilla.org version 2018.02.17.0026-173e2795 1523567951272 addons.manager DEBUG shutdown 1523567951272 addons.manager DEBUG Calling shutdown blocker for XPIProvider 1523567951272 addons.xpi DEBUG shutdown 1523567951272 addons.xpi-utils DEBUG shutdown 1523567951272 addons.manager DEBUG Calling shutdown blocker for LightweightThemeManager 1523567951274 addons.manager DEBUG Calling shutdown blocker for GMPProvider 1523567951274 addons.manager DEBUG Calling shutdown blocker for PluginProvider 1523567951274 addons.manager DEBUG Calling shutdown blocker for PreviousExperimentProvider 1523567951282 addons.manager DEBUG Async provider shutdown done *** UTM:SVC TimerManager:registerTimer called after profile-before-change notification. Ignoring timer registration for id: telemetry_modules_ping 1523567952086 geckodriver::marionette ERROR Failed to stop browser process

alfred82santa commented 6 years ago

It looks like the problem is with firefox, not geckdriver. Which version do you use? Geckodriver only map webdriver standard methods to marionette methods. Marionette is the firefox api to control it.

yannn12 commented 6 years ago

@alfred82santa on Linux firefox 59.0.2 (x64) on windows i tried both 59.0.2 and 61.0a1(nightly) (x64) i still want to mention that the normal example working great only the async example making the problems

tapankumar commented 6 years ago

I am at mac os 10 and can confirm that async example is not working. Just opening firefox, opening web.whatsapp... and exit.

kevinkit commented 6 years ago

Is this issue now resolved?

alfred82santa commented 6 years ago

I'm not going to keep developing async version of driver. It was useful during a few time, but it doesn't work well. I created a new project https://github.com/alfred82santa/whalesong It works better for async enviorments.

Maybe you should remove old async driver in order to avoid new bugs.

antonioribeiro commented 6 years ago

Async is really broken.

First I had to upgrade to Python 3.5+, so I just went to 3.7. Then I had a problem with Gecko driver, so I installed it like this via dockerfile:

#============
# GeckoDriver
#============
ARG GECKODRIVER_VERSION=latest
RUN GK_VERSION=$(if [ ${GECKODRIVER_VERSION:-latest} = "latest" ]; then echo $(wget -qO- "https://api.github.com/repos/mozilla/geckodriver/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([0-9.]+)".*/\1/'); else echo $GECKODRIVER_VERSION; fi) \
  && echo "Using GeckoDriver version: "$GK_VERSION \
  && wget --no-verbose -O /tmp/geckodriver.tar.gz https://github.com/mozilla/geckodriver/releases/download/v$GK_VERSION/geckodriver-v$GK_VERSION-linux64.tar.gz \
  && rm -rf /opt/geckodriver \
  && tar -C /opt -zxf /tmp/geckodriver.tar.gz \
  && rm /tmp/geckodriver.tar.gz \
  && mv /opt/geckodriver /opt/geckodriver-$GK_VERSION \
  && chmod 755 /opt/geckodriver-$GK_VERSION \
  && ln -fs /opt/geckodriver-$GK_VERSION /usr/bin/geckodriver

But I'm still getting those errors:

Traceback (most recent call last):
  File "sample/async_echo.py", line 9, in <module>
    driver = WhatsAPIDriverAsync(loadstyles=True, loop=loop)
  File "/usr/local/lib/python3.7/site-packages/webwhatsapi/async_driver.py", line 28, in __init__
    autoconnect=False, extra_params=extra_params)
  File "/usr/local/lib/python3.7/site-packages/webwhatsapi/__init__.py", line 196, in __init__
    self.driver = webdriver.Firefox(capabilities=capabilities, options=options, **extra_params)
  File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 170, in __init__
    keep_alive=True)
  File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 156, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 251, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 320, in execute
    self.error_handler.check_response(response)
  File "/usr/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.SessionNotCreatedException: Message: Unable to find a matching set of capabilities

While the sync version keeps working, I just had to upgrade the print calls.