in this post i will say how to send whatsapp message using selenium
libaries required are""'iam also begnniner in python """
selenium
and code goes here
import selenium libary in that import webdriver
from selenium import webdriver
'''now create variable which calls ur default browser anything i have used chrome,for chrome u need download chromedriver from chrome drivermanager site and stored in any drive'''
driver=webdriver.Chrome('C:/Users/lenovo/OneDrive/Documents/PYTHON COURSE/chromedriver.exe')
driver.implicitly_wait(15)
get whatsapp web url
driver.get('https://web.whatsapp.com')
find user name or friend name
driver.find_element_by_css_selector("span[title='" + input("Enter name to spam: ") + "']").click()
message u want to send
inputs=input("enter ur message")
convert it to string and store in variable
word=str(inputs)
driver.find_element_by_xpath('//[@id
="main"]/footer/div[1]/div[2]/div/div[2]').click()
while True:
driver.find_element_by_xpath('//[@id
="main"]/footer/div[1]/div[2]/div/div[1]/div').send_keys(word)
driver.find_element_by_xpath('//*[@id
="main"]/footer/div[1]/div[2]/div/div[2]').click()
Top comments (0)