← Back to team overview

sikuli-driver team mailing list archive

[Question #234119]: How to use switchApp() to check whether the specified

 

New question #234119 on Sikuli:
https://answers.launchpad.net/sikuli/+question/234119

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("Calculator") # Here I use Calculator instead of my company's application
if (cat == 0):
    print "continue"
else:
    raise Exception("NO!!!")

Excuse me, is there a better way please?

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.