0

Is there any way to click an element by coordinates in a website using the console? I know i can use element.click() but i need to use it with coordinates. Something like:

Window.click(234,456)
richard nelson
  • 247
  • 4
  • 12
  • Possible duplicate of [How to simulate a click by using x,y coordinates in JavaScript?](https://stackoverflow.com/questions/3277369/how-to-simulate-a-click-by-using-x-y-coordinates-in-javascript) – Murtaza Hussain May 11 '19 at 21:33

1 Answers1

1

You can simulate a click event like this:

document.elementFromPoint(x, y).click();

But this isn't the same as clicking normally.

Documentation here.

Kobe
  • 6,226
  • 1
  • 14
  • 35
  • 1
    No, you cannot trick an iframe into thinking youve pressed a button, that would pose a security issue. – Kobe May 11 '19 at 20:52