Simulate input to another program
TeCh
TeCh at spelletjesgarnaal.be
Thu Jul 27 14:51:24 EDT 2006
31337one at gmail.com wrote:
> I am using a python script as a way to test another program that I have
> written in C++. The program cannot be altered. It needs to stay the way
> it is.
>
> I need to simulate a few keystrokes to the application while it is
> running. The application uses number keys and y and n to navigate a
> basic menu.
>
> Is there a way within python to simulate the keystrokes to this other
> program.
I think this is possible with an expect module, such as
http://pexpect.sourceforge.net/.
<quote>
Description: Python module for automating interactive applications
Pexpect is a pure Python module for spawning child applications;
controlling them; and responding to expected patterns in their
output. Pexpect works like Don Libes' Expect. Pexpect allows your
script to spawn a child application and control it as if a human were
typing commands.
</quote>
--
TeCh
More information about the Python-list
mailing list