0

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?

Jerry Chang
  • 67
  • 1
  • 7

1 Answers1

0

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 transfer button. 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.

sportzpikachu
  • 831
  • 5
  • 18
  • Thanks, I understand that, but I have another question based on this one. I am trying to transfer this some task in iframe to another user to do it. For example you want to transfer the Google reCAPTCHA challenge to another user, he/she just helps solving it. Is it possible? Because the reCAPTCHA is made of iframe. I also see a product [anti-captcha](https://anti-captcha.com/mainpage) here which could solve it by transferring reCAPTCHA to others, how can they possibly do that since it's totally in the iframe which is inaccessible? – Jerry Chang Apr 07 '20 at 07:30