How to use switchApp() to check whether a specified is opened or not
I want to use switchApp() to check whether a specified window in my company's application is opened or not.
The goal is:
If it's opened, script continue.
If not, throw an exception.
I don't want to use exists() or wait() with screenshots because of some reasons in the application I am going to test with.
However, I found that script continue even the window can't be found by switchApp().
Although red line is displayed in the console:
[error] App.focus failed: Calculator not found
setThrowException() can't work too.
So I use this logic in my script:
cat = switchApp(
if (cat == 0):
print "continue"
else:
raise Exception("NO!!!")
Excuse me, is there a better way please?
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- SikuliX Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- RaiMan
- Solved:
- Last query:
- Last reply: