-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
executable file
·40 lines (34 loc) · 1.37 KB
/
main.py
File metadata and controls
executable file
·40 lines (34 loc) · 1.37 KB
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
#! /usr/bin/python3
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import time
import string
import random
import pyjokes
driver = webdriver.Chrome('./chromedriverLinux')
driver.get("https://web.whatsapp.com/")
wait = WebDriverWait(driver, 600)
# Replace 'Friend's Name' with the name of your friend
# or the name of a group
target = '"Gudiya Singh"'
x_arg = '//span[contains(@title,' + target + ')]'
group_title = wait.until(EC.presence_of_element_located((
By.XPATH, x_arg)))
group_title.click()
inp_xpath = '//div[@class="_13NKt copyable-text selectable-text"][@data-tab="10"]'
print("Searching InputBox")
input_box = wait.until(EC.presence_of_element_located((
By.XPATH, inp_xpath)))
print("InputBox Found")
for i in range(1000):
# Replace the below string with your own message
message = str("Message ") + str(i) + str(": I wrote code for spamming Whatsapp. Gudiya Challenged me. Suffer my Wrath now :D")
#Generate Random String
#message = str(''.join(random.choices(string.ascii_uppercase + string.digits, k = 11)))
print("Message number: " + str(i))
message = pyjokes.get_joke(category='all')
input_box.send_keys( message + Keys.ENTER)
time.sleep(60)