added whatsapp automation script

This commit is contained in:
mubeenahmad571 2022-10-12 02:14:09 +05:00
parent e7afb43995
commit 995d98d3af

View File

@ -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()