I've recently become a fan of expect-lite[1], which has a much simpler syntax.
Here are some examples:
Check the IP address of the localhost
>ifconfig
<192\.168\.1\.1
>ip -6 addr show
<2001:db8::f00d
ssh to a remote host
>ssh root@host-021
<assword:
>>secret_password
# issue a command once logged in
>ls
>exit
[1] - http://expect-lite.sourceforge.net/