Slightly related. On wayland based linux desktops this would never work because an app is not allowed to hijack the mouse pointer to dispatch events. I believe only the compositor is allowed to do that.
I know, because I wanted to automate a GUI task using PyAutoGUI and it wouldnt work on wayland no matter what.
Actual problem on Wayland is that it often doesn't work when you are trying to click somewhere in the menu - for the mouse clicking app to read keyboard input, it must take focus away from the app where the click should go. And some toolkits just close menus on focus loss.
I personally use wl-kbptr, and the problem above is the only one that can't be solved without explicit support from the compositor.
What about wp_pointer_warp_v1? That should be supported in some compositors. But not sure how to actually "send" the click event.
I often try a session with Labwc/LxQt instead of my Openbox/LxQt, and while there is progress, still not fully usable, so still no Wayland for me. But with X11, I can at least add xvfb, xdotool, and other utils, and AI has no problem writing (and testing) a GUI for me.
I wonder if blender works on wayland, because it has a feature that makes the mouse cursor "loop" across the window if you are dragging something.
This is why I'm still on X11, the lack of deep level accessibility/automation is still a big hurdle when it comes to Wayland.