Skip to content

Instantly share code, notes, and snippets.

@B45i
Created May 3, 2016 12:45
Show Gist options
  • Save B45i/58afc0ef8747d1cd4bd1b7c546cb4f84 to your computer and use it in GitHub Desktop.
Save B45i/58afc0ef8747d1cd4bd1b7c546cb4f84 to your computer and use it in GitHub Desktop.
var campo = document.getElementsByClassName("input")[1];
contador = 0;
function dispatch(target, eventType, char) {
var evt = document.createEvent("TextEvent");
evt.initTextEvent (eventType, true, true, window, char, 0, "en-US");
target.focus();
target.dispatchEvent(evt);
}
function spam(){
if (contador<100){ //
dispatch(campo, "textInput", "Hello world");
var input = document.getElementsByClassName("icon btn-icon icon-send");
input[0].click();
contador++;
setTimeout(spam,1);
}
}
spam();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment