If you need to automate a GUI app, like you would script a CLI app with expect, use xdotool. It should be in your repo. What you can do for example:
( gedit & ) ; sleep 1; for key in H e l l o Return W o r l d ; do xdotool key $key; done
Find the key codes by running xev from your terminal and looking at stdout of xev:
KeyRelease event, serial 47, synthetic NO, window 0x3600001, root 0xe3, subw 0x0, time 569860511, (65,758), root:(1385,779), state 0x10, keycode 23 (keysym 0xff09, Tab), same_screen YES, XLookupString gives 1 bytes: (09) " " XFilterEvent returns: False
For Tab.