I am trying to simulate clicks in chrome extension developing. The normal method I could find online is document.elementFromPoint().click(), but that does not work for my case. I am trying to simulate clicks in the range of a cross-domain iframe. So when I use document.elementFromPoint() I will get a result of iframe and I can't do anything with a cross-domain iframe. So I wonder if there is a way to simulate the click by the exact coordinates on the screen in web developing? I know it's possible to do so in a system-level script like some python packages. But can JavaScript do this?
So the short question would be: Is it possible to simulate a mouse click in JS without getting the corresponding element?
This is not possible, for security reasons. Say for example a evil attacker makes a website, iframes a bank website, and simulates a click on the
transferbutton. That would be a huge vulnerability if the user is logged in. I suggest that you just tell the user to click on the button or whatever.