JXA JavaScript for automation How to make JXA click something
Application("System Events")
  .applicationProcesses.whose({frontmost: true}).at(0)
  .click({ at: [x, y] })


click is performed on a UIElement, so we get one, then call click with that.