Skip to content

Instantly share code, notes, and snippets.

@aaayushsingh
Created October 25, 2017 00:54
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 aaayushsingh/c7d2d962c5b162468af434952d467803 to your computer and use it in GitHub Desktop.
Save aaayushsingh/c7d2d962c5b162468af434952d467803 to your computer and use it in GitHub Desktop.
function whatsAppText(t) {
window.InputEvent = window.Event || window.InputEvent;
var d = new Date();
var event = new InputEvent('input', {bubbles: true});
var textbox = document.querySelector('#main > footer > div.block-compose > div.input-container > div.pluggable-input.pluggable-input-compose > div.pluggable-input-body.copyable-text.selectable-text');
textbox.textContent = t;
textbox.dispatchEvent(event);
document.querySelector("button.compose-btn-send").click();}
for(i=1;i<3;i++){
whatsAppText("Hola");}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment