Created
August 24, 2020 21:31
-
-
Save 6ixfalls/37d6938b02ffa2abe44c1ba8b2c62e66 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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