2

so I'm trying simulate real mouse click, but nothing goes well... i tried lot of ways but still can't simulate it. please tell me is possible simulate real mouse click with javascript? if yes give me some hints.

    function click(x,y){
        var ev = document.createEvent("MouseEvent");
        var el = document.elementFromPoint(x,y);
        ev.initMouseEvent(
            "click",
            true /* bubble */, true /* cancelable */,
            window, null,
            x, y, 0, 0, /* coordinates */
            false, false, false, false, /* modifier keys */
            0 /*left*/, null
        );
        el.dispatchEvent(ev);
    }

click(100,100);

this is my last try but it is not same as real click. i saw this topic on stackoverflow which have same idea but it is old and if is some new way to do this kind of stuff please help me.

Community
  • 1
  • 1
Dest
  • 678
  • 2
  • 9
  • 27
  • 4
    http://stackoverflow.com/questions/6157929/how-to-simulate-a-mouse-click-using-javascript – Tony Vincent Dec 13 '16 at 11:50
  • i tested it and it does not works for me, does it depends browser type? and version? i'm testing on chrome Version 49.0.2623.112 m – Dest Dec 13 '16 at 12:03

0 Answers0