Tithibots / tithiwa

Automate Web WhatsApp with selenium in python.
MIT License
24 stars 22 forks source link

delete_chats_of_all_exited_groups method was created in groups.py #82

Closed ghostrider22 closed 2 years ago

ghostrider22 commented 2 years ago

There was no way to differentiate groups and normal chat, therefore, I was forced to scroll through entire list of contacts, where it checks for the message "You can't send messages to this group because you're no longer a participant", if message is found then it deletes the group. Now, if we allow the program to run freely without any time.sleep() it scrolls through entire list of contact without finding any match, _wait_for_presence_of_an_element was also not working so to reduce its speed I had used sleep(0.5). There was another problem, when delete chat is successful, program losts track of which contact or group should be clicked next. So, we have to scroll from top again, But since we have already checked top few contacts, I added count variable which contains number of chats checked so far, so that it quickly scrolls through those number of chats quickly without waiting for 0.5seconds, and then continues it search again.

Constants file didn't contain any delete group button selector, so I have added GROUPS__DELETE_GROUP selector.

NavpreetDevpuri commented 2 years ago

It is working fine without sleep()