xdotool allows you to simulate keyboard input, control mouse actions, move or resize windows, and more. It achieves this by leveraging the X11 XTEST extension along with other Xlib functions.
# List all visible window IDs matching a given name
xdotool search --onlyvisible --name "127.0.0.1:3393"
52428807
100663984