Earlier quoted context omitted.
+1 for sikuli. Very nice little tool that makes it very easy to do something that would otherwise require a lot of specific knowledge
AutoHotKey and Pulover's Macro Creator[1] (which spits out AHK scrips from mouse and keyboard input) can do a similar job in a windows environment, and can trivially click on UI elements on the screen via PixelSearch. It runs lightning fast too, and is simple to learn. I've used it to automate simple web games for shits and giggles. [1] https://www.macrocreator.com/screenshots/
PyAutoGui is another nice option - https://pyautogui.readthedocs.io/en/latest/ - cross platform Python module for keyboard and mouse automation with some support for taking and analysing screenshots.