Whatsapp Spam Bot Using Python Selenium

Whatsapp Spam Bot Using Python Selenium

In this article, we will guide you to create an Automated bot or Whatsapp Spam Bot Using Python Selenium. We will use tkinter and selenium for creating our whatsapp spam bot.

SELENIUM:

Selenium automates browsers. That’s it! What you do with that power is entirely up to you. Primarily it is for automating web applications for testing purposes but is certainly not limited to just that” — from selenium website.

We can use selenium in many languages like Java and Python. Here, we will use selenium to Automate and repeat WhatsApp messages Using Python.

To know more about Selenium installation and setup check both the links below:

link 1

link 2

TKINTER:

What is Tkinter? it is used library provides Python users with a simple way to create GUI elements using the widgets found in the Tk toolkit. Tk widgets can be used to construct buttons, menus, data fields, etc. in a Python application.

“Simply Tkinter pops windows which make the code user friendly”.



SETTING ENVIRONMENT:

Whatsapp Spam Bot Whatsapp Spam Bot Using Python Selenium In this article, we will guide you to create an Automated bot or Whatsapp Spam Bot Using Python Selenium. We will use tkinter and selenium for creating our whatsapp spam bot.
Whatsapp Spam Bot Whatsapp Spam Bot Using Python Selenium In this article, we will guide you to create an Automated bot or Whatsapp Spam Bot Using Python Selenium. We will use tkinter and selenium for creating our whatsapp spam bot.

While installing python make sure the check boxes shown above are ticked. If not while reinstalling go to advanced installation settings and tick the check box. It will be useful if you are dealing with python IDLE. Its advisable to use PyCharm.

Whatsapp Spam Bot Whatsapp Spam Bot Using Python Selenium In this article, we will guide you to create an Automated bot or Whatsapp Spam Bot Using Python Selenium. We will use tkinter and selenium for creating our whatsapp spam bot.

If you are dealing with pycharm IDE. You may frequently encounter a error while dealing with tkinter projects on PyCharm . To rectify the error it follow the steps below. If you are perfect with your environment you can skip this step and check the program.

As shown above first open PyCharm IDE > Settings > Project settings > Project interpreter > Add packages > Install Future Package.

PROGRAM:

First import all the necessary packages

Coming to Tkinter code:

Creating tkinter window and adding title and header description to it.

INPUT:

OUTPUT:

Now lets add fields to the tkinter window. we can also use input variable and selenium code instead of tkinter window.But using tkinter makes it userfriendly.

INPUT:

OUTPUT:

Coming to selenium code:

Just locating the Xpath of contact name / contact number makes the code much easy.

selenium code makes to pop up the webwhatsapp on your browser scan the qr code and enter whats app.

INPUT:

OUTPUT:

Wait for a while and see the magic. check the complete code below hope you like this stay tuned for more 🙂 .


import time
import tkinter as tk
from tkinter import *
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

def startBombing():
    victim=str(name.get())
    msg=str(message.get())
    num=msgCount.get()
    driver=webdriver.Chrome('enter you path here example of a path : [C:/Users/91728/Desktop/pythonProject/chromedriver.exe] ')
    driver.get("https://web.whatsapp.com/")

    time.sleep(15)
    user=driver.find_element_by_xpath('//span[@title = "'+victim+'"]')
    user.click()

    msg_box=driver.find_element_by_xpath('//*[@id="main"]/footer/div[1]/div[2]/div/div[2]')
    for i in range(num):
        msg_box.send_keys(msg)
        msg_box.send_keys(Keys.ENTER)


#GUI
root=tk.Tk()
root.title("Whatsapp Bombing")
root.geometry("500x500")
root.resizable(height=False,width=False)

headingLabel=Label(root,text="Wait for 15 - 30 sec to start BOOM!",font=('Helvetics',12,'bold'))
headingLabel.place(relx=.5,y=15,anchor='center')

# victim name label
Label(root,text="Enter Name/No.").place(x=120,y=80)
name=StringVar()
nameBox=Entry(root,textvariable=name).place(x=220,y=80)
#  Msg label
Label(root,text="Enter Message").place(x=120,y=150)
message=StringVar()
msgBox=Entry(root,textvariable=message).place(x=220,y=150)

Label(root,text="No Of Message").place(x=120,y=220)
msgCount=IntVar()
countBox=Entry(root,textvariable=msgCount).place(x=220,y=220)
tk.Button(root,text="Start Bombing",command=startBombing).place(relx=.5,y=300,anchor="center")
root.mainloop()

Feel free to comment below. Thank you for spending your valuable time on this.

Keep learning


Also Read:


YouTube Video Downloader Application Using Python

Python Web scraping using Python Selenium

Automate Facebook Login Using Python Selenium

Shutdown Computer with Voice in Python

Jarvis and Google Assistant || Voice Assistant Using Python

Crack Any Password Using Python

Get WiFi Passwords With Python


Share:
Avatar of Harsha Vardhan .V

Author: Harsha Vardhan .V

15 thoughts on “Whatsapp Spam Bot Using Python Selenium

  1. This is just amazing……It was really helpful to spam my friends Watsapp…..from basic standards….. explained clearly…… Amazing article by Mr.Harsha Vardhan….👌👌👌

    1. yeah ttrx the path is the file location in PC. A absolute path contains the complete location of the file in your PC. You should mention the path of selenium webdriver on your PC in the code so that it can access the webdriver and automate the browser.

  2. I get the following errors on PyCharm:

    Exception in Tkinter callback
    Traceback (most recent call last):
    File “C:\Users\nkumar\AppData\Local\Programs\Python\Python38-32\lib\tkinter\__init__.py”, line 1883, in __call__
    return self.func(*args)
    File “C:/Users/nkumar/PycharmProjects/modules/venv/shopping/whatsappBot.py”, line 19, in startBombing
    user=driver.find_element_by_xpath(‘//span[@title = “‘+victim+'”]’)
    File “C:\Users\nkumar\PycharmProjects\modules\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py”, line 394, in find_element_by_xpath
    return self.find_element(by=By.XPATH, value=xpath)
    File “C:\Users\nkumar\PycharmProjects\modules\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py”, line 976, in find_element
    return self.execute(Command.FIND_ELEMENT, {
    File “C:\Users\nkumar\PycharmProjects\modules\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py”, line 321, in execute
    self.error_handler.check_response(response)
    File “C:\Users\nkumar\PycharmProjects\modules\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py”, line 242, in check_response
    raise exception_class(message, screen, stacktrace)
    selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {“method”:”xpath”,”selector”:”//span[@title = “00971562540199”]”}
    (Session info: chrome=87.0.4280.141)

    Process finished with exit code -1

  3. hey please anyone help me when i am running the program i am getting an error
    selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {“method”:”xpath”,”selector”:”//span[@title = “<Victims name"]"}

    plss help me

    1. tq for your response Swastidip Pal ,I will correct it could you send me the whole error properly?

    2. In 15th line try replacing Xpath ‘//span[@title = “‘+victim+'”]’ with ‘//*[@id=”side”]/div[1]/div/label/div/div[2]’

      1. Thank You sir very much for the help. its working and also thank you for this superb program

  4. Hey – great blog, just looking about some blogs, seems a pretty nice platform you might be utilizing. Im currently utilizing WordPress for a few of my web sites but looking to alter 1 of them through to a platform similar to yours as being a trial run. Something in particular youd recommend about it?

Comments are closed.