← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #674758]: Focus on a app running as a java process from an IDE

 

Question #674758 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/674758

Description changed to:
Hello! Firstly great work. Really excited to use 1.1.4 api jar (love
that its cross-platform!).

I'm trying to use sikulix's latest 1.1.4 api jar in my Jruby test
framework(for interacting with a Java Swing GUI) and it works pretty
good - except I have to always get my APP to the foreground and run the
tests. I did refer some of the recommendations in here (for the prior
versions) but none seem to work.

Here is how my app is getting launched as(on my mac):

window "<app's main window name>" of application process "java" of
application "System Events",    #Notice the app name is java

So I tried several different options but none seem to work   -

Option 1:

test_app = App.new("java")
test_app.focus("app's main window name")


Option 2:   

# Find an image on the app window  and
test_app = App.focused_window              


Option 3:

test_app = App.new('System Events')
App.focus("my app's main window")

[error] App.focus failed:  [-1:Oracle ()]  My app's main window


Option3 - works only when my app window is the only window active,


Any suggestions on how to get the App focused without manual intervention and some tips on using the api directly in my tests.

Thanks

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