-
Notifications
You must be signed in to change notification settings - Fork 1
/
notif.py
71 lines (55 loc) · 2.34 KB
/
notif.py
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from selenium import webdriver
import time
joy_phone = "+919740718396"
joy_message = 'Nigal'
pand_phone = "+918105632052"
pand_message = 'nibbi'
vid_path = "C:/Users/nihal/Pictures/Camera Roll/hand_track_output.mp4"
wapp = "https://web.whatsapp.com"
def send_vid(url, phone):
wapp = "https://web.whatsapp.com"
url1 = 'https://web.whatsapp.com/send?phone='+phone+'&text='+'Alert'
driver.get(wapp)
# load web whatsapp main page
driver.get(wapp)
time.sleep(15)
def send_vid(phone, message, file=''):
url = 'https://web.whatsapp.com/send?phone='+phone+'&text='+message
# load the person's chat
driver.get(url)
time.sleep(5)
# send test message Nigal
driver.find_element_by_xpath("/html/body/div[1]/div/div/div[4]/div/footer/div[1]/div[3]/button").click()
time.sleep(0.1)
# attachment button click
driver.find_element_by_css_selector("span[data-icon='clip']").click()
time.sleep(0.1)
# add file to send by file path
driver.find_element_by_css_selector("input[type='file']").send_keys("C:/Users/nihal/Pictures/Camera Roll/hand_track_output.mp4")
time.sleep(0.1)
# click to send
driver.find_element_by_xpath("/html/body/div[1]/div/div/div[2]/div[2]/span/div/span/div/div/div[2]/span/div/div").click()
if __name__ == '__main__':
phone = "+919740718396"
message = 'Nigal'
wapp = "https://web.whatsapp.com"
url1 = 'https://web.whatsapp.com/send?phone='+phone+'&text='+message
url2 = 'https://web.whatsapp.com/send?phone=+918105632052&text=nibbi'
driver = webdriver.Chrome(executable_path='C:/Users/nihal/Downloads/chromedriver.exe')
# load web whatsapp main page
driver.get(wapp)
time.sleep(15)
send_vid(url1) # joy
send_vid(url2) # pandey
if file != '':
# attachment button click
driver.find_element_by_css_selector("span[data-icon='clip']").click()
time.sleep(2)
# add file to send by file path
driver.find_element_by_css_selector("input[type='file']").send_keys("C:/Users/nihal/Pictures/Camera Roll/hand_track_output.mp4")
time.sleep(2)
# click to send
driver.find_element_by_xpath("/html/body/div[1]/div/div/div[2]/div[2]/span/div/span/div/div/div[2]/span/div/div").click()
time.sleep(10)
send_vid(joy_phone, joy_message, vid_path) # joy
send_vid(pand_phone, pand_message, vid_path) # pandey