Skip to content

Instantly share code, notes, and snippets.

Created May 19, 2022 11:44
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
from selenium import webdriver
from import WebDriverWait
from import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
from import By
import time
target = str(input('Enter name of person/group you want to send message to:'))
string = str(input('Enter your message: '))
n = int(input('Enter number of times you want your message to be sent: '))
driver = webdriver.Chrome('/home/raj/Desktop/blahblahblah/Whatsapp-autosend-script/chromedriver')
wait = WebDriverWait(driver, 600)
x_arg = '//span[contains(@title, '+ '"' +target + '"'+ ')]'
person_title = wait.until(EC.presence_of_element_located((
By.XPATH, x_arg)))
inp_xpath = '//div[@class="_2S1VP copyable-text selectable-text"]'
input_box = wait.until(EC.presence_of_element_located((
By.XPATH, inp_xpath)))
for i in range(n):
input_box.send_keys(string + Keys.ENTER)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment