I don't know what kind of API does totem has, meaning if it allows you to send commands through IPC or not.
If is a classic GUI interface and you want to control it I'd recommend you to try
X11::GUITest with it you can send events to the GUI such as keys or clicks. I know documentation can be overwhelming but looking at the test cases might give you a hint