← Back to team overview

sikuli-driver team mailing list archive

[Bug 1762381] [NEW] App.open() is not returning the instance.

 

Public bug reported:

App.open() method call does not return the instance of the opened
application instead it always return null whether application open
successfully or not.

method is "private App openAndWait(int waitTime)". Because of "notFound"
variable is false it returns null. But "appPID" is greater than 0.

sikulixapi - 1.1.1 version
OS - 64 bit windows 10

How to reproduce.

App app = App.open("C:\\Program Files (x86)\\Microsoft
Office\\root\\Office16\\EXCEL.EXE");

this will return null but excel will be opened successfully.

Method location in App.java class

private App openAndWait(int waitTime) {
    if (isImmediate) {
      appPID = _osUtil.open(appNameGiven);
    } else {
      AppEntry appEntry = makeAppEntry();
      init(_osUtil.open(appEntry));
    }
    if (appPID < 0) {
      Debug.error("App.open failed: " + appNameGiven + " not found");
      notFound = true;
    } else {
      Debug.action("App.open " + this.toStringShort());
    }
    if (isImmediate && notFound) {
      return null;
    }
    if (waitTime > 0) {
      if (!isRunning(waitTime)) {
        return null;
      }
    }
    return this;
  }

Always execute this line.
if (isImmediate && notFound) {
      return null;
}

** Affects: sikuli
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1762381

Title:
  App.open() is not returning the instance.

Status in Sikuli:
  New

Bug description:
  App.open() method call does not return the instance of the opened
  application instead it always return null whether application open
  successfully or not.

  method is "private App openAndWait(int waitTime)". Because of
  "notFound" variable is false it returns null. But "appPID" is greater
  than 0.

  sikulixapi - 1.1.1 version
  OS - 64 bit windows 10

  How to reproduce.

  App app = App.open("C:\\Program Files (x86)\\Microsoft
  Office\\root\\Office16\\EXCEL.EXE");

  this will return null but excel will be opened successfully.

  Method location in App.java class

  private App openAndWait(int waitTime) {
      if (isImmediate) {
        appPID = _osUtil.open(appNameGiven);
      } else {
        AppEntry appEntry = makeAppEntry();
        init(_osUtil.open(appEntry));
      }
      if (appPID < 0) {
        Debug.error("App.open failed: " + appNameGiven + " not found");
        notFound = true;
      } else {
        Debug.action("App.open " + this.toStringShort());
      }
      if (isImmediate && notFound) {
        return null;
      }
      if (waitTime > 0) {
        if (!isRunning(waitTime)) {
          return null;
        }
      }
      return this;
    }

  Always execute this line.
  if (isImmediate && notFound) {
        return null;
  }

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1762381/+subscriptions


Follow ups