-
Notifications
You must be signed in to change notification settings - Fork 10
/
single_contact_spam.py
34 lines (27 loc) · 1.24 KB
/
single_contact_spam.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
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import os
driver = webdriver.Chrome(r"add path to driver here")
driver.get('https://web.whatsapp.com/')
def send_msg(driver, name, msg, count):
user = driver.find_element_by_xpath('//span[@title = "{}"]'.format(name))
user.click()
msg_box = driver.find_element_by_xpath('//*[@id="main"]/footer/div[1]/div[2]/div/div[2]')
for i in range(count):
msg_box.send_keys(msg)
button = driver.find_element_by_xpath('//*[@id="main"]/footer/div[1]/div[3]/button')
button.click()
inp = " "
input("Press any key after QR code scan")
while inp != "":
name = input('Enter the name of user or group : ')
msg = input('Enter your message : ')
count = int(input('Enter the count : '))
send_msg(driver, name, msg, count)
inp = input('Enter 1 to continue: ')
options = driver.find_element_by_xpath('//div[@title="Menu"]')
options.click()
logout = WebDriverWait(driver, 2).until(EC.element_to_be_clickable((By.XPATH, '/html/body/div[1]/div/div/div[3]/div/header/div[2]/div/span/div[3]/span/div/ul/li[6]/div')))
logout.click()