← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #698000]: Unable to bring window forward on Windows 10

 

Question #698000 on SikuliX changed:
https://answers.launchpad.net/sikuli/+question/698000

Jeff Harmon gave more information on the question:
Another use case to illustrate what I am seeing.  Here is Java code top
use App.open to bring Notepad++ to the foreground when already running
(works), waits 200ms, uses App.open to bring MS Edge to the foreground
when already runinng, waits 200ms, and then tries to bring Notepad++ to
the foreground again.

public static void main(String[] args) throws InterruptedException {
        Debug.setDebugLevel(3);
        Settings.ActionLogs = true;
        Settings.InfoLogs = true;
        Settings.DebugLogs = true;
        Debug.setLogFile("C:\\Users\\Jeff\\SikulixDebug.log");
        Debug.on(3);
        String notepadPPName = "\"C:\\Program Files (x86)\\Notepad++\\notepad++.exe\"";
        App notepadPP = new App(notepadPPName);
        boolean opened = notepadPP.open();
        notepadPP.focus();
        if (!opened || !notepadPP.hasFocus()) {
            System.err.println("test: Failed to open "+notepadPPName+", opened="+opened+",hasFocus="+notepadPP.hasFocus());
        } else {
            System.out.println("test: Successfully opened " + notepadPPName);
        }

        Thread.sleep(200);

        String edgeBrowserName = "\"C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe\"";
        App edgeBrowser = new App(edgeBrowserName);
        opened = edgeBrowser.open();
        if (!opened || !edgeBrowser.hasFocus()) {
            System.err.println("test: Failed to open "+edgeBrowserName+", opened="+opened+",hasFocus="+edgeBrowser.hasFocus());
        } else {
            System.out.println("test: Successfully opened " + edgeBrowserName);
        }


        Thread.sleep(200);

        notepadPP = new App(notepadPPName);
        opened = notepadPP.open();
        notepadPP.focus();
        if (!opened || !notepadPP.hasFocus()) {
            System.err.println("test: Failed to open "+notepadPPName+", opened="+opened+",hasFocus="+notepadPP.hasFocus());
        } else {
            System.out.println("test: Successfully opened " + notepadPPName);
        }

    }

Actual result is MSEdge never comes to the foreground.  Here are the
outputs:

test: Successfully opened "C:\Program Files (x86)\Notepad++\notepad++.exe"
test: Failed to open "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe", opened=true,hasFocus=false
test: Successfully opened "C:\Program Files (x86)\Notepad++\notepad++.exe"

And I do get a SikulixDebug.log file that has:

[debug] Debug: setLogFile: C:\Users\Jeff\SikulixDebug.log

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