LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to simulate keyboard input to a console application? (https://www.linuxquestions.org/questions/linux-software-2/how-to-simulate-keyboard-input-to-a-console-application-905920/)

notepod 10-01-2011 07:25 AM

How to simulate keyboard input to a console application?
 
I have developed an application in bash that uses "whiptail" to display dialogs in a terminal. (I personnally don't like this kind of UI but i'm only a developer, i don't make decisions ...). Anyway, now i have to test it, and i would like to simulate a user that types values, press "Enter", "Echap", "Tab", "down arrow", "up arrow"

I didn't get expect working and it seems it is not possible (http://oldsite.debianhelp.org/node/11812).

There is no X on the machine, so xdotool cannot be used.

So, how can i test this kind of dialogs ? Is it possible to write to the process stdin and "make it believe" it receive input from the tty ? Or maybe by writing to a specific device in /dev ?

Thanks

rustek 10-01-2011 12:33 PM

This may sound silly, but you could ssh in and automate the testing on the client machine.

notepod 10-01-2011 04:32 PM

Yes, it's a good idea !

anyway, someone found the solution on stackoverflow:
http://stackoverflow.com/questions/7...370822#7370822


All times are GMT -5. The time now is 07:34 PM.