DEV Community

vaibhav688
vaibhav688

Posted on

whatsapp message sending bot using selenium

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()

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

Top comments (0)

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay