You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ran it many times, every time it stops after the 7th contact and this is the log:
Most likely this is because you closed the browser window.
If that's not the case please create an issue at https://github.com/ErikTschierschke/WhatsappMonitor/issues including the following message:
Traceback (most recent call last):
File "/root/WhatsappMonitor/whatsappmonitor.py", line 46, in
monitor.start(contacts.select_contacts(browser), browser)
File "/root/WhatsappMonitor/contacts.py", line 19, in select_contacts
contact.click()
File "/usr/local/lib/python3.9/dist-packages/selenium/webdriver/remote/webelement.py", line 80, in click
self._execute(Command.CLICK_ELEMENT)
File "/usr/local/lib/python3.9/dist-packages/selenium/webdriver/remote/webelement.py", line 633, in _execute
return self._parent.execute(command, params)
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.StaleElementReferenceException: Message: The element reference of
is stale; either the element is no longer attached to the DOM, it is not in the current frame context, or the document has been refreshed
The text was updated successfully, but these errors were encountered:
After a detailed look into the issue I have decided to not fix this issue and thereby discontinue the project.
I wasn't able to figure out to which rules the website unloads the contacts nor how to stop it. I found multiple workarounds but all of them break the script at a later point. A working fix would require rewriting large parts of the script and I am currently lacking spare time to do so.
Below there are some technical details of the issue in case anyone reading this intends to fix the problem:
With the new Whatsapp Web update the site layout has been changed again. Most of the scripts XPath selectors do not work anymore. Fixing them wouldn't be that hard.
Instead, the main issue is that scrolling the contact selection list on the left site sometimes unloads contact divs from the DOM, seemingly at random. The script then throws the error above since it can't find the elements anymore.
I was able to prevent this by setting the contact selector list to a height of 300% so that scrolling becomes unnecessary. But then the header bar on which the script also relies doesn't load properly.
In general the script may break with any upcoming update because of it's architecture. A much more robust approach would be to directly hook into Whatsapp Webs websocket like discribed here.
ErikTschierschke
changed the title
Doesn't map correctly, stops while mapping the whatsapp
Script breaks while indexing contacts (and why this project is discontinued)
Apr 24, 2021
Ran it many times, every time it stops after the 7th contact and this is the log:
Most likely this is because you closed the browser window.
If that's not the case please create an issue at https://github.com/ErikTschierschke/WhatsappMonitor/issues including the following message:
Traceback (most recent call last):
File "/root/WhatsappMonitor/whatsappmonitor.py", line 46, in
monitor.start(contacts.select_contacts(browser), browser)
File "/root/WhatsappMonitor/contacts.py", line 19, in select_contacts
contact.click()
File "/usr/local/lib/python3.9/dist-packages/selenium/webdriver/remote/webelement.py", line 80, in click
self._execute(Command.CLICK_ELEMENT)
File "/usr/local/lib/python3.9/dist-packages/selenium/webdriver/remote/webelement.py", line 633, in _execute
return self._parent.execute(command, params)
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.StaleElementReferenceException: Message: The element reference of
The text was updated successfully, but these errors were encountered: