Skip to content

Instantly share code, notes, and snippets.

@piyush97
Created April 16, 2018 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save piyush97/a84a003efb450f47c196e539960717f3 to your computer and use it in GitHub Desktop.
Save piyush97/a84a003efb450f47c196e539960717f3 to your computer and use it in GitHub Desktop.
Loop Message for WhatsApp
// Impress your gf with this simple js
// Open https://web.whatsapp.com/
// select the person you want to send this msg on loop & type the following script on developer console of your browser
var intervalID = setInterval(function () {
var message = document.createEvent("TextEvent");
message.initTextEvent ("textInput", true, true, window, "I think of you every second", 0, "en-US");
document.getElementsByClassName("input")[1].focus(); // Focus on message box
document.getElementsByClassName("input")[1].dispatchEvent(message); // Type message
document.getElementsByClassName("icon btn-icon icon-send")[0].click(); // Click send
}, 1000); // Repeat every sec
// :D
@z0h3b
Copy link

z0h3b commented Sep 4, 2020

Cannot read property 'focus' of undefined at :4:44 ----> is the error which is received on console.

@YogeshSharma01
Copy link

It shows Cannot read property 'focus' of undefined at :4:44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment