ldtalent / vivekdw-whatsappcontacts

How to print your Whatsapp recent contacts using Python Selenium and Web Driver
5 stars 14 forks source link

Error right after logging into WPP and entering the message in terminal (MAC Mojave) #1

Open Toccheton opened 4 years ago

Toccheton commented 4 years ago

Hey Gobid! Thanks for the amazing code!!

I keep getting this error, right after logging into WPP and entering the message in the terminal:

Traceback (most recent call last):
File “whatsapp_sendmessage.py”, line 46, in
message = driver.find_element_by_class_name(‘_13mgZ’)
File “/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py”, line 564, in find_element_by_class_name
return self.find_element(by=By.CLASS_NAME, value=name)
File “/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py”, line 978, in find_element
‘value’: value})[‘value’]
File “/usr/local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py”, line 321, 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.NoSuchElementException: Message: no such element: Unable to locate element: {“method”:”css selector”,”selector”:”._13mgZ”}
(Session info: chrome=81.0.4044.138)

Do you know what it could be? Thanks!

Tropicalrambler commented 3 years ago

The classes for the divs are randomized and keep on changing. Probably to discourage this kind of use.

A workaround I have discovered is to implement the code with variables in place of the class names for the divs or buttons, and then each variable is added as a key from a previously defined dictionary (at the top of the python script) where you can quickly re-connect everything every change cycle.