xdotool
Command line automation for X11.
xdotool search --onlyvisible --name {{firefox}}
xdotool click {{3}}
xdotool getactivewindow
xdotool windowfocus --sync {{12345}}
xdotool type --delay {{500}} "Hello world"
xdotool key {{KP_Enter}}