For web applications you can often reverse engineer the internal / non-documented APIs using the development tools of your browser or network traffic analysis such as Wireshark. As a last resort for software without APIs you can always use robotics tools and automatically use the GUI as a user would do. You could for example check out the Selenium framework for Java.
In the beginning of COVID I ran out of tea once and since then I got used to just drink warm water from the tap in most cases. 🚰