So I want to simulate key presses in a SPECIFIC window\chrome tab. For eg, with pyautogui:
import pyautogui as py
while True:
py.press("1")
py.press("space")
py.press("4")
This works when I'm on a tab, but if I go to another tab, it will simulate the key presses there. I want it to only simulate key presses in a specific tab, even if I'm in another tab. Is there a way to modify the above program to do this, or is there another pythonic way to achieve this?
Unfortunately, PyAutoGUI can't do this because it only blindly clicks on the screen at x, y coordinates. Unless you know the coordinates of the tab, you won't be able to put it in focus and send key presses to the window.
I recommend a library like Selenium for doing GUI automation in web browsers.