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.04k stars 795 forks source link

QR not returned as expected #757

Open roysG opened 4 years ago

roysG commented 4 years ago

I am trying to run your sample in ubuntu 18 with docker, i follow all the steps. I get the message "Waiting for qr" but i do not get any qr, i also tried to wait more than 1 minute.

I also connected to remote server with vnc and saw that the browser is loaded and see the qr, but none qr is returned.

Code:

root@docker-s-2vcpu-4gb-ams3-01:~/WebWhatsapp-Wrapper# 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"

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support Processing /app Requirement already satisfied: python-dateutil>=2.6.0 in /usr/local/lib/python2.7/site-packages (from webwhatsapi==2.0.3) (2.8.1) Requirement already satisfied: selenium>=3.4.3 in /usr/local/lib/python2.7/site-packages (from webwhatsapi==2.0.3) (3.141.0) Requirement already satisfied: six>=1.10.0 in /usr/local/lib/python2.7/site-packages (from webwhatsapi==2.0.3) (1.13.0) Requirement already satisfied: python-axolotl in /usr/local/lib/python2.7/site-packages (from webwhatsapi==2.0.3) (0.2.3) Requirement already satisfied: cryptography in /usr/local/lib/python2.7/site-packages (from webwhatsapi==2.0.3) (2.8) Requirement already satisfied: python-magic in /usr/local/lib/python2.7/site-packages (from webwhatsapi==2.0.3) (0.4.15) Requirement already satisfied: urllib3 in /usr/local/lib/python2.7/site-packages (from selenium>=3.4.3->webwhatsapi==2.0.3) (1.25.7) Requirement already satisfied: protobuf>=3.0.0.b2 in /usr/local/lib/python2.7/site-packages (from python-axolotl->webwhatsapi==2.0.3) (3.11.0rc2) Requirement already satisfied: python-axolotl-curve25519>=0.4.1 in /usr/local/lib/python2.7/site-packages (from python-axolotl->webwhatsapi==2.0.3) (0.4.1.post2) Requirement already satisfied: enum34; python_version < "3" in /usr/local/lib/python2.7/site-packages (from cryptography->webwhatsapi==2.0.3) (1.1.6) Requirement already satisfied: ipaddress; python_version < "3" in /usr/local/lib/python2.7/site-packages (from cryptography->webwhatsapi==2.0.3) (1.0.23) Requirement already satisfied: cffi!=1.11.3,>=1.8 in /usr/local/lib/python2.7/site-packages (from cryptography->webwhatsapi==2.0.3) (1.13.2) Requirement already satisfied: setuptools in /usr/local/lib/python2.7/site-packages (from protobuf>=3.0.0.b2->python-axolotl->webwhatsapi==2.0.3) (41.6.0) Requirement already satisfied: pycparser in /usr/local/lib/python2.7/site-packages (from cffi!=1.11.3,>=1.8->cryptography->webwhatsapi==2.0.3) (2.19) Building wheels for collected packages: webwhatsapi Building wheel for webwhatsapi (setup.py) ... done Created wheel for webwhatsapi: filename=webwhatsapi-2.0.3-cp27-none-any.whl size=29677 sha256=d17729f96e11b6bace6ec4ca27c1c90be70db2e00e66c6d424e31ca2e34f1305 Stored in directory: /tmp/pip-ephem-wheel-cache-kENNNZ/wheels/4b/1c/59/a69d3cb46a693578104e640ef6e42bbb128292df4586f1cb10 Successfully built webwhatsapi Installing collected packages: webwhatsapi Successfully installed webwhatsapi-2.0.3 DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support Package Version


cffi 1.13.2 cryptography 2.8 enum34 1.1.6 ipaddress 1.0.23 numpy 1.16.5 pip 19.3.1 protobuf 3.11.0rc2 pycparser 2.19 python-axolotl 0.2.3 python-axolotl-curve25519 0.4.1.post2 python-dateutil 2.8.1 python-magic 0.4.15 selenium 3.141.0 setuptools 41.6.0 six 1.13.0 typing 3.7.4.1 urllib3 1.25.7 virtualenv 16.7.8 webwhatsapi 2.0.3 wheel 0.33.6 Environment {'LANG': 'C.UTF-8', 'PYTHONIOENCODING': 'UTF-8', 'TERM': 'xterm', 'GPG_KEY': 'C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF', 'PYTHON_VERSION': '2.7.17', 'PYTHON_GET_PIP_URL': 'https://github.com/pypa/get-pip/raw/ffe826207a010164265d9cc807978e3604d18ca0/get-pip.py', 'SHLVL': '1', 'PYTHON_PIP_VERSION': '19.3.1', 'HOSTNAME': '6974cb4a854a', 'SELENIUM': 'http://firefox:4444/wd/hub', 'PYTHON_GET_PIPSHA256': 'b86f36cc4345ae87bfd4f10ef6b2dbfa7a872fbff70608a1e43944d283fd0eee', '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

And this is the message i get after long waiting,

Traceback (most recent call last): File "sample/remote.py", line 20, in driver.wait_for_login() File "/usr/local/lib/python2.7/site-packages/webwhatsapi/init.py", line 276, in wait_for_login EC.visibility_of_element_located((By.CSS_SELECTOR, self._SELECTORS['mainPage'])) File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/support/wait.py", line 80, in until raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message:

Do i miss something?

frangelh commented 4 years ago

You need to scan that QR with your phone by using the Whatsapp WEB option

roysG commented 4 years ago

But I do not get any qr

On Tue, Nov 26, 2019, 16:30 Frangel Hernandez notifications@github.com wrote:

You need to scan that QR with your phone by using the Whatsapp WEB option

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mukulhase/WebWhatsapp-Wrapper/issues/757?email_source=notifications&email_token=ABXZDOV3H7GDDYBXENAMQBTQVUXIXA5CNFSM4JRDSSJKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFGGMDA#issuecomment-558654988, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXZDOXQT6XX2OENAZ3OTTDQVUXIXANCNFSM4JRDSSJA .

Fguedes90 commented 4 years ago

same problem here

gushome7 commented 4 years ago

"I also connected to remote server with vnc and saw that the browser is loaded and see the qr, but none qr is returned."

Two options: a) scan qr from whatsapp page (you can see with vnc as you say); b) use get_qr function to save qr code to file, need to pass file as parameter. Then you can scan png file but you need to open with background in white (could be a browser pointing to a local index.html with image inserted

roysG commented 4 years ago

can you give me the full example how to do it, it will also help others, thank you.

roysG commented 4 years ago

@gushome7 Also have to mention, i tried to scan the qr from the vnc window, but i it throw error and stopped

josetorresgecko commented 4 years ago

then tag img img[alt='Scan me!'] changed to canvas canvas[aria-label='Scan me!']