

I used expect a lifetime ago to reliably talk to a bunch of very strange ISDN modems.
https://www.tcl.tk/man/expect5.31/expect.1.html
I think something like expect also exists for more modern languages, but tcl is still easy enough to learn (just a little unusual, everything is a string)
Yeah, a minority of people voted for Hitler, too.