"Simulating user actions on a website"

56 views
Skip to first unread message

Fer Goru

unread,
Feb 27, 2024, 11:48:45 PM2/27/24
to Selenium Users
Hello everyone, I ask for your help.

Issue:
I'm using Selenium for web scraping, simulating user actions, and other operations. However, I've encountered an issue: the website tracks cursor movements and mouse clicks through JavaScript, then sends this data to the server using a POST request.

Question:
Is there a way to simulate these actions so that JavaScript successfully recognizes them, but without using the PyAutoGUI library or similar ones that control the real cursor? Any other alternatives are welcome, as long as they don't interfere with computer usage; virtual machines are not suitable.

323e2f4a572d7298.PNG

David

unread,
Feb 28, 2024, 2:11:00 PM2/28/24
to Selenium Users
You could look into hardware devices that replicate/simulate mouse movement (by introducing jitter, to a faked/twinned mouse?), where you just attach it to computer and let it do its job and not have to move the mouse around manually. These devices are typically meant to keep the screen awake to stop system from going to sleep/hibernate/screen save. But I could imagine that it could potentially be repurposed for UI automation. So depending on what you're trying to achieve with mouse movements and having that sent to server from the web app, this may or may not work.

Outside of actual (desktop) GUI libaries, I don't see how you could do what you wish. The alternative is to actually use/call javascript to directly inject/fake the mouse events without actually performing/simulating any mouse actions from the UI side. But this alternative approach requires you to know the javascript code to inject/fake those events. You can then execute those javascript code with Selenium.

Reply all
Reply to author
Forward
0 new messages