App focus not setting focus as expected
I do the following, and yet sometimes the application (Visual Studio) does not start with focus and other times it does:
VSApp = App(VS_exe_path)
VSApp.open()
# wait for visual studio to start. And it could take almost 90 seconds to start up on a slow machine
wait("VSStartPa
type("l", KEY_CTRL + KEY_ALT)
if not exists(
# report a problem
else:
# open a solution file
I can tell that the type() didn't go to Visual Studio because I watched the code run. If I add a VSApp.focus() in between the "wait()" and "type()", Visual Studio loses focus if it has it, takes it if it doesn't (meaning no real change in behavior).
Any tips on how to prevent this? I looked at the similar question posted about Firefox (184407), but I know there is only 1 Visual Studio application/window up and running (task manager only shows one devenv.exe process). There may be other apps running, but I thought that by doing the "VSApp = App()" I ensured the VSApp.focus would only affect the one and only Visual Studio instance running.
Thanks,
Beth
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- SikuliX Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Beth Griffin
- Solved:
- Last query:
- Last reply: