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.