See also the Caius framework.
Exploring Expect by Don Libes, the principal author of Expect, is a classic among tech books:
`brew install expect`
`apt-get install expect`
Readily available on many other platforms as well, including Windows.
Fresh book recommendations delivered straight to your inbox every Thursday.