How I texted whole movie script word by word using Selenium in Python 😅

sunilaleti profile image Sunil Aleti ・2 min read

GitHub logo aletisunil / Whatsapp_Spam

A python script to text the entire movie script one word at a time through whatsapp using selenium

Hey all,
Hope everyone are doing good, In this post I will share how I texted a whole movie script word by word (just to irritate her) in Python.

Let's start by watching small demo, how its going to look at end 😅

run the script

Now lets talk,

  • Python
  • Selenium
  • webdriver (I used Chrome webdriver)

Step 1 :
need to import webdriver, keys and sleep

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep

Step 2 :
Enter the location of Chrome Webdriver and assign it to driver variable


Step 3 :
I used whatsapp to send messages and I pinned the person to whom we need to send messages, so that there will not be any hustles.


There should be some time where we can scan the qrcode to login, so I gave sleep(15) and that xpath is to open the chat window of that respective person

Step 4 :
Now locate the movie script file, assign it to fileLocation variable and open it in read mode
fileLocation= "" #Enter location of movie script file

Step 5 :
Now use "for loop" to send msg word by word


from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep

driver=webdriver.Chrome("") #Enter Location of Chrome driver
fileLocation= ""  #Enter location of movie script file
with open(fileLocation,"r") as file:
    for line in file:
        for word in line.split(" "):

A ♥️ would be Awesome 😊

Posted on by:

sunilaleti profile

Sunil Aleti


Passionate Data Scientist | Blogger | Python Developer


Editor guide

Or, how to get banned from using Whatsapp the quickest way possible 😂
But nice one, at first I got surprised you could send messages in whatsapp through python, and then when I saw your use of selenium on the web platform, I thought "ah, of course".


I'm not doing this on daily basis to get banned 😅 and btw I using sleep commands and u can also checkout my "Automating Instagram" post which is used to like all posts of a respective user


It's fantastic to see how it's easy at the principle, but so smart for the realisation! GG and very nice work!


Thanks a lot