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