Created
June 24, 2011 04:35
-
-
Save eligrey/1044231 to your computer and use it in GitHub Desktop.
document.click(x, y) to click the element at specific coords
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
document.click = function(x, y) { | |
"use strict"; | |
var | |
doc = this | |
, node = doc.elementFromPoint(x, y) | |
, click = doc.createEvent("UIEvent") | |
; | |
click.initUIEvent("click", true, true, self, 1); | |
return node.dispatchEvent(click); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment