Answer the question
In order to leave comments, you need to log in
Electron.js | Is it possible to simulate clicks on Windows?
Hello! Started learning Electron.js from GitHub today. I want to write a mini bot, but for this I need to know if it is possible to simulate clicks using Electron.js . For example, in a browser, you can simply write document.querySelector(...).click(); and all. Clicks should be simulated for me on another (exe) program.
Thank you very much in advance! :)
Answer the question
In order to leave comments, you need to log in
Built-in tools - no, you can't. Electron is chromium with integrated node.js, there is still NWJS (updated regularly, developers are open to dialogue with users).
On Windows, the mouse is emulated via WinAPI in several different ways (SendInput, Send/PostMessage, DirectInput). Node.js / browser has no built-in tools for calling the OS API, and to solve this problem, you either need to write your own module for NodeJS or a plugin for Chromium, or write some separate program in something like C / C ++ and somehow then connect it to NodeJS in some way (for example, via TCP sockets or web sockets). This is one of the easiest options. And more complex ones do not make much sense because of their complexity.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question