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