I'd like to set-up X11 Forwarding to run remote X applications on the server and the X11 client can handle the UX interaction.

However, I would like to configure the X11 client or fake it to actual do the user interaction programmatically (from the script).

For example, I want to run an app which requires some mouse clicks or keyboard interaction (such as installers), so I could programmatically send these clicks or keyboard key press signals to the app from the script until it finishes.

Is it something possible? How this can be achieved or where to start? Or how I can re-use/hijack X11 protocol to inject my own non-user interaction?