Skip to content

Instantly share code, notes, and snippets.

@6ixfalls
Created August 24, 2020 21:31
Show Gist options
  • Save 6ixfalls/37d6938b02ffa2abe44c1ba8b2c62e66 to your computer and use it in GitHub Desktop.
Save 6ixfalls/37d6938b02ffa2abe44c1ba8b2c62e66 to your computer and use it in GitHub Desktop.
function triggerKeyboardEvent(el, keyCode, type)
{
var eventObj = document.createEventObject ?
document.createEventObject() : document.createEvent("Events");
if(eventObj.initEvent){
eventObj.initEvent(type, true, true);
}
eventObj.keyCode = keyCode;
eventObj.which = keyCode;
el.dispatchEvent ? el.dispatchEvent(eventObj) : el.fireEvent("onkeydown", eventObj);
}
$=$$
content = $('table > tbody > tr:nth-child(2) > td > table > tbody > tr:nth-child(1) > td > table > tbody > tr:nth-child(1) > td > div > div')[3].textContent.split('');
i = 0;
function a () {
if (i == content.length - 1) return;
input = $('table > tbody > tr:nth-child(2) > td > table > tbody > tr:nth-child(2) > td > input')[0]
input.focus()
input.value += content[i++];
triggerKeyboardEvent(input, input.value.charCodeAt(0), "keydown")
input.click()
triggerKeyboardEvent(input, input.value.charCodeAt(0), "keypress")
triggerKeyboardEvent(input, input.value.charCodeAt(0), "keyup")
setTimeout(a, 50 * Math.random())
}
a();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment