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

Waiting for the qrcode #947

Open josep112 opened 3 years ago

josep112 commented 3 years ago

Environment {'LANG': 'C.UTF-8', 'PYTHONIOENCODING': 'UTF-8', 'TERM': 'xterm', 'GPG_KEY': 'C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF', 'PYTHON_VERSION': '2.7.18', 'PYTHON_GET_PIP_URL': 'https://github.com/pypa/get-pip/raw/d59197a3c169cef378a22428a3fa99d33e080a5d/get-pip.py', 'SHLVL': '1', 'PYTHON_PIP_VERSION': '20.0.2', 'HOSTNAME': '6704e2f0c69c', 'SELENIUM': 'http://firefox:4444/wd/hub', 'PYTHON_GET_PIPSHA256': '421ac1d44c0cf9730a088e337867d974b91bdce4ea2636099275071878cc189e', 'PWD': '/app', 'PATH': '/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'HOME': '/root', '': '/usr/local/bin/python'} Waiting for QR

I downloaded the master files and did the installation by docker and I'm using the samples/remote.py file but after qrcode by vnc nothing happens in the terminal, there are more updated files how should I proceed? Any help is welcome , thanks

erm3nda commented 3 years ago

Download the module source and install from that. For some reason it happens to me with the module installed with pip. You can even simply download and use it without install.


sys.path.append('WebWhatsapp-Wrapper-master')
from webwhatsapi import WhatsAPIDriver
marcelocecin commented 3 years ago

use this command to install the latest version: pip install --upgrade git+https://github.com/mukulhase/WebWhatsapp-Wrapper.git

josep112 commented 3 years ago

@marcelocecin I gave the command but I get this error root@docker-lab:/usr/src# pip install --upgrade git+https://github.com/mukulhase/WebWhatsapp-Wrapper.git Collecting git+https://github.com/mukulhase/WebWhatsapp-Wrapper.git Cloning https://github.com/mukulhase/WebWhatsapp-Wrapper.git to /tmp/pip-qLAz39-build Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 1, in File "/tmp/pip-qLAz39-build/setup.py", line 22, in t = compile(file.read(), path, "exec", ast.PyCF_ONLY_AST) File "/tmp/pip-qLAz39-build/webwhatsapi/init.py", line 241 **extra_params, ^ SyntaxError: invalid syntax

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-qLAz39-build/

marcelocecin commented 3 years ago

if you are installing for the first time type: pip install git+https://github.com/mukulhase/WebWhatsapp-Wrapper.git

josep112 commented 3 years ago

root@docker-lab:/usr/src# pip install git+https://github.com/mukulhase/WebWhatsapp-Wrapper.git Collecting git+https://github.com/mukulhase/WebWhatsapp-Wrapper.git Cloning https://github.com/mukulhase/WebWhatsapp-Wrapper.git to /tmp/pip-S901Xu-build Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 1, in File "/tmp/pip-S901Xu-build/setup.py", line 22, in t = compile(file.read(), path, "exec", ast.PyCF_ONLY_AST) File "/tmp/pip-S901Xu-build/webwhatsapi/init.py", line 241 **extra_params, ^ SyntaxError: invalid syntax

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-S901Xu-build/

marcelocecin commented 3 years ago

what is the version of python and pip?

josep112 commented 3 years ago

root@docker-lab:~# pip --version pip 20.2.4 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7) root@docker-lab:~# root@docker-lab:~# python --version Python 2.7.13

marcelocecin commented 3 years ago

try to use python 3

josep112 commented 3 years ago

now the error has changed after giving the command and doing the qrcode it appears these errors

docker run --network selenium -it -e SELENIUM='http://firefox:4444/wd/hub' -v $(pwd):/app webwhatsapi /bin/bash -c "pip install ./;pip list;python sample/remote.py"

Waiting for QR Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/webwhatsapi/init.py", line 322, in wait_for_login self.driver.find_element_by_css_selector(self._SELECTORS['mainPage']) File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 598, in find_element_by_css_selector return self.find_element(by=By.CSS_SELECTOR, value=css_selector) File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 976, in find_element return self.execute(Command.FIND_ELEMENT, { 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.NoSuchElementException: Message: Unable to locate element: .two

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "sample/remote.py", line 27, in driver.wait_for_login() File "/usr/local/lib/python3.8/site-packages/webwhatsapi/init.py", line 325, in wait_for_login self.driver.find_element_by_css_selector(self._SELECTORS['qrCode']) File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 598, in find_element_by_css_selector return self.find_element(by=By.CSS_SELECTOR, value=css_selector) File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 976, in find_element return self.execute(Command.FIND_ELEMENT, { 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.NoSuchElementException: Message: Unable to locate element: canvas

marcelocecin commented 3 years ago

try looking for other issues about this docker error

Arkhamp commented 3 years ago

now the error has changed after giving the command and doing the qrcode it appears these errors

docker run --network selenium -it -e SELENIUM='http://firefox:4444/wd/hub' -v $(pwd):/app webwhatsapi /bin/bash -c "pip install ./;pip list;python sample/remote.py"

Waiting for QR Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/webwhatsapi/init.py", line 322, in wait_for_login self.driver.find_element_by_css_selector(self._SELECTORS['mainPage']) File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 598, in find_element_by_css_selector return self.find_element(by=By.CSS_SELECTOR, value=css_selector) File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 976, in find_element return self.execute(Command.FIND_ELEMENT, { 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.NoSuchElementException: Message: Unable to locate element: .two

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "sample/remote.py", line 27, in driver.wait_for_login() File "/usr/local/lib/python3.8/site-packages/webwhatsapi/init.py", line 325, in wait_for_login self.driver.find_element_by_css_selector(self._SELECTORS['qrCode']) File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 598, in find_element_by_css_selector return self.find_element(by=By.CSS_SELECTOR, value=css_selector) File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 976, in find_element return self.execute(Command.FIND_ELEMENT, { 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.NoSuchElementException: Message: Unable to locate element: canvas

I fixed the same issue changing the selector in webwhatsapi/init.py Before "mainPage": ".two" After "mainPage": "div._36Q2N.two"

RotemAkerman commented 3 years ago

div._36Q2N.two

Thanks for the tip! I was finally able to log in thanks to you.

Do you have any other selector changes? I tried to run driver.get_unread() and got TypeError: document.querySelector(...)._reactRootContainer.current is undefined

EricGPTI commented 3 years ago

I have got the same error: selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: canvas, but change "mainPage" selectors from ".two" to "div._36Q2N.two" don't solve the problem.

I search for the correct selector and see that to be right, however, the error happen yet!