Xnee

GNU Xnee is a suite of programs that can record, replay and distribute user actions under the X11 environment. It can be used for testing and demonstrating X11 applications.
Within X11 each user input (mouse click or key press) is an X Window System event. Xnee records these events into a file. Later Xnee is used to play the events back from the file and into an X Window System just as though the user were operating the system.
Xnee can also be used to play or "distribute" user input events to two or more machines in parallel.
As the target X Window application sees what appears to be physical user input it has resulted in Xnee being dubbed “"Xnee is Not an Event Emulator".”
As Xnee is free software, it can be modified to handle special tasks. For example, inserting time stamps as part of the playback.