Sikuli object identification fails if the browser is not in foreground

Asked by Satheesh on 2017-05-18

In our environment, at times, the browser may not be in the foreground ,

This makes the object identification to fail and the entire test fails.

Is there a way to ensure or bring the browser to fore ground before performing sikuli scripts.

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Last query:
Last reply:
masuo (masuo-ohara) said : #1

The solution depends on the environment.
When os is Windows, App.focus() feature is valid.


Satheesh (satheesh.jey) said : #2

This is what I have tried,

I am running my tests on VM and the problem here is when the browser window is kept in fore Ground, object identification passes but if its in back ground, it fails.

I have tried

App appBrowser = new App("Internet Explorer");
Screen s = appBrowser.window().getScreen();

This does not bring the screen to fore ground.

1) Recently I used
switchApp(application) ( ), on Mac.
You may want to give it a try.

2) A few times I used approach not involving AppFocus()

a) Checked if browser window is on foreground searching for some title image
b) If it is not, invoke click on application icon in Taskbar (or Dock or whatever is other system way to bring app to front)

Can you help with this problem?

Provide an answer of your own, or ask Satheesh for more information if necessary.

To post a message you must log in.