Problem with App class in linux

Asked by Jose Miguel on 2019-03-22

Hello,

I've started a java project recently, which is sikuli-based. My environment is ARCH linux + eclipse + sikuli java API + KDE plasma.

Imagepath. Screen class, mouse.hover(), click() , etc. etc.... all of that works great. Pretty impressive stuff, I must say.

However, I've spent several hours in order to make the App class to work, but to no avail. I am a bit confused, since, according to the docs, its methods are pretty simple and self-explanatory.... and, well, Hell take me, but I've not been able to get such a simple piece of code to work:

---------
App browsy = new App("chromium");
  browsy.open();

  try
  {
   Thread.sleep(3000);
  }
  catch(InterruptedException ie)
  {}

  browsy.focus();
  browsy.close();
-------------

Chromium will open in a new window (lo and behold) , which is fine and ok. But after that, the window will not close. In fact, I cannot seem to be able to control the app object at all. I mean, for example:

- both isValid() and isRunning() will return false

- close() will do nothing, i.e., I can open a chromium window, but I cannot close it.

- if you purpousefully take the focus to another window (by simply clicking on it) , after the trhee seconds delay, browsy.focus() won't work either, i.e., the chromium window won't become the front-most window in the screen.

- getTitle() returns an empty string, getName() returns "chromium".

It seems like, I don't know, like if the app object, once I've called open() on it, wouldn't be able to "recognize" the chromium window anymore.

If you could shed some light on this one, I'd be very grateful !

thanks for your time,

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2019-03-22
Last reply:
2019-03-23
RaiMan (raimund-hocke) said : #1

Sorry for the inconvenience.

Currently and for the next few weeks I do not have an environment nor time (in the sense of priority) to evaluate Linux related problems.

Since you are using Java, you might look into the App/LinuxUtil classes for possible solutions.
See the related bug.

Internally xdotool and wmctrl are used to do the job.

Use for example Java's ProcessBuilder to issue your own commands to solve your problem.

Can you help with this problem?

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

To post a message you must log in.