← Back to team overview

sikuli-driver team mailing list archive

[Question #252375]: App.focus() only works randomly, how to use it effectivly?

 

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

I am having issues with the App.focus() method just sikuli in java. If I have a simple program such as:

        App p1= new App("p1");
        App p2= new App("p2");
        
        Screen screen = new Screen();
        
        for ( int i = 0; i < 10; i++ ) {
            screen.wait(1.0);
            p1.focus();
            screen.wait(1.0);
            p2.focus();
        }

It works fine. But if I run longer methods in between the two calls to .focus(), it often fails. I have seen multiple people having issues with this across the forums but the answers are usually  very short and do not address the issue. Any help would be much appreciated.

Thank you,

Loran

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