pexpect

Pexpect allows easy control of interactive console applications.

Here are some FAQ’s about pexpect

What is pexpect Pexpect allows easy control of interactive console applications.