From 995d98d3afcb170cbcc39cd77254d698b46850a7 Mon Sep 17 00:00:00 2001 From: mubeenahmad571 Date: Wed, 12 Oct 2022 02:14:09 +0500 Subject: [PATCH] added whatsapp automation script --- .../whatsapp-automation.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 scripts/whatsapp_automation/whatsapp-automation.py diff --git a/scripts/whatsapp_automation/whatsapp-automation.py b/scripts/whatsapp_automation/whatsapp-automation.py new file mode 100644 index 0000000..62889b9 --- /dev/null +++ b/scripts/whatsapp_automation/whatsapp-automation.py @@ -0,0 +1,21 @@ +from selenium import webdriver +import time + +driver = webdriver.Chrome() +driver.get('https://web.whatsapp.com/') + +input('Scan the QR code and then press "enter"') +name_of_recipient = input('To whom do you want to send the message:') +msg = input('Enter your message:') + +user = driver.find_element_by_xpath(f'//span[@title = "{name_of_recipient}"]') +user.click() +textbox = driver.find_element_by_class_name('_3uMse') + +for i in range(200): + textbox.send_keys(msg) + send = driver.find_element_by_class_name('_1U1xa') + send.click() + time.sleep(5) + +driver.quit()