← Back to team overview

sikuli-driver team mailing list archive

[Question #295053]: .focus() and .isRunning() Issues

 

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

Hello - I have been experiencing a strange issue with the App class. As of just last week I had been getting different behavior out of both these methods.

Currently trying to get SikuliX to verify that a program which opens many different windows and processes started correctly. Most of the windows have java.exe as their process (but have different PIDs).

Last week code of this nature worked well -

app=App("window title name here")
app.focus()
if not app.isRunning():
       print "False" 
else:
       print "True"

After testing it was determined that the app.focus() was needed for app.isRunning() to pick if the window was running or not consistently.

Now however after running app.focus() the app seems to be stripped of its window title and is now only recognized as it's short name-

Code and Output Example:
I will use DESIRED for the name of the app I want and OTHER as the title of another java.exe program that also starts with the program. This is the first one that opens so that is why it always shows up.

Code:
app = App("DESIRED")
print(app.getName())
print(app.getWindow())
app.focus()
print(app.getWindow())
print(app.isRunning())
print(app.getWindow())
print(app.isRunning()) 

Output:
java.exe
Desired App
[error] App.focus failed: [12860:java.exe (OTHER)] DESIRED
Other App
False
Other App
True

**************************************

The script brings focus to the desired window correctly but then says the focus failed.

EXAMPLE 2:

Code:
appName = "DESIRED"
app = App(appName)
print(app.getName())
print(app.getWindow())
App.focus(appName)
print(app.getWindow())
print(app.isRunning())
print(app.getWindow())
print(app.isRunning())
print(app.getWindow())

output:
java.exe
DESIRED
[log] App.focus: [8304:DESIRED]
DESIRED
False
DESIRED
True
OTHER

*********************************************

Another person is running the same exact full scripts as I am and having it work the way it was last week, even though the log kicks back a focus error, it searches for the correct PID with .isRunning() and does not change it.

Anyone have any input or ideas on this? Happy to provide other information. 


-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.