3

How can I enter text in the text fields of the window shown by a program in an automated manner?

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
lms-lms
  • 31
  • 1
  • 2
    possible duplicate of [How to inject keystrokes via a shell script?](http://unix.stackexchange.com/questions/14879/how-to-inject-keystrokes-via-a-shell-script) – muru Dec 05 '14 at 08:27
  • @muru, I don't agree it's a duplicate. Here it's more specific and can call for different answers: typically one or the other of the existing X application testing frameworks. – Stéphane Chazelas Dec 05 '14 at 11:03
  • 1
    @StéphaneChazelas Ah. I was looking for an existing post for `xdotool`, and thought that one was general enough. – muru Dec 05 '14 at 11:06
  • What do you mean by _"the linux terminal"_? What do you mean by _graphical program_? A X11 one? – Stéphane Chazelas Dec 05 '14 at 11:06

1 Answers1

1

In order to simulate user input you can use xdottool which is mentioned in comments to your question.

Besides, there is xaut (formerly xautomation) python lib. You cas simulate mouse movement and mouse clicks, keystrokes, and manipulate windows from Python.

Moreover, there's X11:GUITest perl package. This can be used to interact (SendKeys, ClickMouseButton, FindWindowLike, etc.) with applications running under an X Windows environment. Including applications built (GTK+, Qt, Motif, etc.) upon X11 / Xlib.

kirill-a
  • 2,883
  • 1
  • 16
  • 22