-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 22d8e8a
Showing
5 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#Spam WhatsApp Contact | ||
|
||
#### Run the command to Send Message | ||
|
||
``` python whatsapp_sendmessage.py | ||
|
||
|
||
#### Run the command to get Recent Chat Contacts | ||
|
||
``` python whatsapp_contacts.py ``` | ||
|
||
#Vinay Somawat |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
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 sys | ||
|
||
# Replace below path with the absolute path | ||
# to chromedriver in your computer | ||
driver = webdriver.Chrome('./chromedriver') | ||
|
||
driver.get("https://web.whatsapp.com/") | ||
wait = WebDriverWait(driver, 600) | ||
|
||
|
||
group_title = wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "div.RLfQR"))) | ||
|
||
time.sleep(5) | ||
for person in driver.find_elements_by_class_name('_2wP_Y'): | ||
title = person.find_element_by_xpath('div/div/div[2]/div[1]/div[1]/span').text | ||
#company = person.find_element_by_xpath('.//div[@class="company"]/a').text | ||
print(title) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
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 sys | ||
|
||
# Replace below path with the absolute path | ||
# to chromedriver in your computer | ||
|
||
friends_lists = ['Manikandan PM','Akshay wd'] | ||
|
||
driver = webdriver.Chrome('../chromedriver') | ||
|
||
driver.get("https://web.whatsapp.com/") | ||
wait = WebDriverWait(driver, 600) | ||
|
||
group_title = wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "div.RLfQR"))) | ||
search = driver.find_elements_by_xpath('//*[@id="side"]/div[2]/div/label/input')[0] | ||
|
||
for friend in friends_lists: | ||
search.clear() | ||
search.send_keys(friend) | ||
wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "button._3Burg"))) | ||
time.sleep(3) | ||
persons = driver.find_elements_by_class_name('_2wP_Y') | ||
print(len(persons)) | ||
for person in persons: | ||
try: | ||
if person.text not in ['CHATS','MESSAGES']: | ||
person_title = person.find_element_by_class_name('_1wjpf') | ||
print(person_title.get_attribute("title")) | ||
person_contact = person.find_element_by_class_name('_2EXPL') | ||
person_contact.click() | ||
message = driver.find_elements_by_xpath('//*[@id="main"]/footer/div[1]/div[2]/div/div[2]')[0] | ||
message.send_keys("This is Testing Message from Selenium") | ||
|
||
sendbutton = driver.find_elements_by_xpath('//*[@id="main"]/footer/div[1]/div[3]/button')[0] | ||
sendbutton.click() | ||
except: | ||
print("*") | ||
continue | ||
|
||
driver.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
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 sys | ||
|
||
# Replace below path with the absolute path | ||
# to chromedriver in your computer | ||
driver = webdriver.Chrome('./chromedriver') | ||
|
||
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 = '"Tharkie"' | ||
|
||
# Replace the below string with your own message | ||
string = "I am sad!" | ||
|
||
x_arg = '//span[contains(@title,' + target + ')]' | ||
group_title = wait.until(EC.presence_of_element_located(( | ||
By.XPATH, x_arg))) | ||
group_title.click() | ||
|
||
|
||
message = driver.find_elements_by_xpath('//*[@id="main"]/footer/div[1]/div[2]/div/div[2]')[0] | ||
|
||
for i in range(1000): | ||
message.send_keys(string + Keys.ENTER) | ||
|
||
sendbutton = driver.find_elements_by_xpath('//*[@id="main"]/footer/div[1]/div[3]/button')[0] | ||
sendbutton.click() | ||
|
||
driver.close() | ||
|