Automate Web WhatsApp with selenium.
Full explained Videos on that project are coming soon. Stay tune with our youtube channel Noobie Techs
Table of contents
Selenium automation creativity points
- Debugging Example
We can create breakpoints to pause execution at any time then we can try to run some python code in the console to find a way to do something. That helps to develop efficiently. - CTRL + Left mouse click Example
We can see the definitions or references or usages of any function or variable in our IDE like PyCharm. That helps to understand the existing code base efficiently. - Inspect elements and console Example
In chrome, we can inspect HTML elements and run javascript code inside console. That helps up to find better selectors and automations steps efficiently.
NOTE: By pressing UP key we can see the history about what codes we had run during Python debugging and inside Chrome's console.
NOTE: If you are running javascript code inside selenium chromedriver's console then it will NOT keep history.
Good luck :)
Create bot
from tithiwa import Tithiwa
tithiwabot = Tithiwa()
- Done: Generate sessions and open sessions ✔
tithiwabot.generate_session("filename")
tithiwabot.open_session("filename")
- Done: Open chatroom and send message ✔
tithiwabot.open_chat_by_name_or_number("919592140593")
tithiwabot.open_chat_by_number_using_url("919592140593") # wa.me/919592140593
tithiwabot.send_message_to_name_or_number("919592140593", "Hello, from Tithiwa")
- Done: Create new WhatsApp group ✔
tithiwabot.create_group("GroupName", ["contact1", "contact2", "contact2"])
- Done: Scrape members list from group ✔
membersList = tithiwabot.scrape_members_from_group("GroupName")
print(membersList) # ["contact1", "contact2", "contact2"]
- Done: Make given contacts as group admins of given group ✔
tithiwabot.make_group_admins("GroupName", ["contact1", "contact2"])
- Done: Remove given contacts from given group ✔
tithiwabot.remove_members_from_group("GroupName", ["contact1", "contact2"])
- Done: Send a message to a group with mentioning all group members ✔
tithiwabot.send_message_with_mention_all_to_group("GroupName", "Hello All")
- Todo: Clear chats of all groups
- Todo: Clear chats of all contacts
- Todo: Clear all chats both groups and contacts
- Todo: Auto-reply given messages to some given messages
- Todo: Scrap chat as text
- Todo: Track online status of given number
- Todo: Send given message to given contacts at some given time i.e schedule messages
- Done: Exit from group ✔
tithiwabot.exit_from_group("GroupName1")
- Done: Exit from all groups ✔
tithiwabot.exit_from_all_groups()
- Done: Exit from given groups ✔
tithiwabot.exit_from_groups(["GroupName1", "GroupName2"])
- Todo: Join group by invite link
- Todo: Change Web WhatsApp's settings
- Todo: Scape all contacts and send message containing URL to their own chatroom
- Todo: Get currently opened Web WhatsApp's mobile number
- Todo: Open chat to the same number as currently opened Web WhatsApp's number
- Todo: join multiple groups by invite links
- Todo: Send a message to multiple chats
NOTE - pip contains older version i.e clone repo to use
pip install tithiwa