Images are not detected in sikuli in java inside Mac VM

Asked by Nissar on 2018-03-15

Images are not detected in sikuli for java inside Mac VM. When I checked by taking the screenshot using the java code, the screenshot returned in black screen. So it looks like script is not able to find the screen. I am able to access the vm machine using VNC.

Here are my configuration details

Java version: jdk1.8.0_161
Os version details: Apple Mac OS X 10.12 Client Type: Virtual Machine (vCloud)

maven pom file .. sikulix api I am using:
<!-- https://mvnrepository.com/artifact/com.sikulix/sikulixapi -->
  <dependency>
      <groupId>com.sikulix</groupId>
      <artifactId>sikulixapi</artifactId>
      <version>1.1.0</version>
  </dependency>

None of the images are detected by the selenium code in written in java. The same code works fine in my local mac machine. Also it works fine in another VM in macincloud.com.

The issue is Apple Mac OS X 10.12 Client Type: Virtual Machine (vCloud) which is deployed in Amazon EC2

Question information

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

please always a question first

RaiMan (raimund-hocke) said : #2

please try again with version 1.1.2

If SikuliX is running on Amazon EC2, than you have to make sure, that you have access to at least an emulated screen (e.g. xvfb or similar)

SikuliX does not work on headless environments.

Nissar (nissar) said : #3

Hi RaiMan,

Thanks for the quick reply, sorry for posting the question as bug as I am new to this platform.

I have access to the VM using VNC Viewer and I can see that sikuli script is actually opening the required app, but not able to detect the images.

Wont VNC Viewer serve as a emulated screen ?

RaiMan (raimund-hocke) said : #4

--- Wont VNC Viewer serve as a emulated screen ?
... normally not, depends on how the server is implemented.

You should run the SikuliX IDE on the EC2 Mac and look, what the capture and the Preview do.

But you have to check the screen situation, as it is seen by Java Graphics Environment.

As mentioned: use 1.1.2

Nissar (nissar) said : #5

I have installed SikuliX IDE 1.1.2 inside the VM and image capture and everything works fine through IDE.
Also updated my maven pom with 1.1.2 , still images are not detected from script, script level screenshot shows black screen

RaiMan (raimund-hocke) said : #6

--- Also updated my maven pom with 1.1.2 , still images are not detected from script
Not sure what you are talking about here: script for me means Python scripting.
Maven pom for me means Java programming.

So please be more specific with code snippets.

Nissar (nissar) said : #7

My code is in java

example code:
Screen s = new Screen();
s.wait(new Pattern("imagename.png").similar((float) 0.8), 180);

RaiMan (raimund-hocke) said : #8

should work, if the image is visible on the screen in that moment.

Can you help with this problem?

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

To post a message you must log in.