-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWhatsappMsgSending.py
More file actions
33 lines (25 loc) · 913 Bytes
/
WhatsappMsgSending.py
File metadata and controls
33 lines (25 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
'''
Requirements:
selenium package
pip install selenium
ChromeDriver
https://chromedriver.storage.googleapis.com/index.html?path=2.25/
Chromium Web Browser( Open source version of chrome browser )
sudo apt-get install chromium-browser
'''
import os
from selenium import webdriver
driver = webdriver.Chrome('/###ENTER_LOCAL_PATH##chromedriver_linux644/chromedriver')
driver.get('https://web.whatsapp.com/')
name = input('Enter the name of the user: ')
msg = input('Enter the Message: ')
count = int(input('Enter the no. of times to send the Message: '))
input('Enter any key after scanning QR code: ')
user = driver.find_element_by_xpath('//span[@title="{}"]'.format(name))
user.click()
msg_box = driver.find_element_by_class_name('_13mgZ')
for i in range(count):
msg_box.send_keys(msg)
button = driver.find_element_by_class_name('_3M-N-')
button.click()
print("Messages Sent Successfully.")