Created
July 18, 2017 11:30
-
-
Save zinking/d9fe7c566cdb1abde94d58bc742302d5 to your computer and use it in GitHub Desktop.
AutoClick
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
var dispatchMouseEvent = function(target, var_args) { | |
var e = document.createEvent("MouseEvents"); | |
// If you need clientX, clientY, etc., you can call | |
// initMouseEvent instead of initEvent | |
e.initEvent.apply(e, Array.prototype.slice.call(arguments, 1)); | |
target.dispatchEvent(e); | |
}; | |
function clickContinue() { | |
dispatchMouseEvent(element, 'mouseover', true, true); | |
dispatchMouseEvent(element, 'mousedown', true, true); | |
dispatchMouseEvent(element, 'click', true, true); | |
dispatchMouseEvent(element, 'mouseup', true, true); | |
} | |
function timeout() { | |
t = setTimeout( | |
function() { | |
console.log('trigger click') | |
clickContinue() | |
timeout() | |
}, 200); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment