forked from AdityaDas-IITM/SecurAI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotif.py
42 lines (35 loc) · 1.41 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
from selenium import webdriver
import time
import os
from selenium.webdriver.common.keys import Keys
def send_vid(driver, path):
# type and send the msg
inp_xpath = '//*[@id="main"]/footer/div[1]/div[2]/div/div[2]'
input_box = driver.find_element_by_xpath(inp_xpath)
input_box.send_keys('Alert' + Keys.ENTER)
# attachment button click
driver.find_element_by_css_selector("span[data-icon='clip']").click()
time.sleep(1)
# add file to send by file path
driver.find_element_by_css_selector("input[type='file']").send_keys(path)
time.sleep(3)
# 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(1)
if __name__ == '__main__':
driver = webdriver.Chrome(executable_path='../scripts/chromedriver.exe')
wapp = "https://web.whatsapp.com"
driver.get(wapp)
time.sleep(15)
path = os.getcwd().replace(os.sep, '/') + "/app_uploaded_files/output.mp4"
send_vid(driver, path)
'''
url = 'https://web.whatsapp.com/send?phone='+'+919591260537'
driver = webdriver.Chrome(executable_path='../scripts/chromedriver.exe')
driver.get(url)
time.sleep(15)
inp_xpath = '//*[@id="main"]/footer/div[1]/div[2]/div/div[2]'
for i in range(5):
input_box = driver.find_element_by_xpath(inp_xpath)
input_box.send_keys('Alert' + Keys.ENTER)
'''