Find failedwhen searching on multiple Screens

Asked by LuisBow

Hello. I am working on Eclipse IDE building a display test automation tool. I have been trying to find images on my secondary screen, and the help online has not solved my problem yet.
A simple call to getBounds() returns what is expected: 2 monitors side by side, with coordinates starting at (0,0,192,1080) and screen2 starting at (1920,0,1920,1200). When I try to find an image on screen2, Sikuli returns a find failed error.

This is what my code looks like:

         Screen s1 = new Screen();
  Screen s2 = new Screen(1);
  System.out.println(s1.getBounds());
  System.out.println(s2.getBounds());

If I try to find the image on the secondary screen with s2, I get the find failed. However, if I move the image to my primary screen and use s2 to find it, Sikuli successfully finds the image, but returns wrong coordinates. (as if it thinks it found the image in the secondary screen with coordinates from the secondary screen, but that was not the case)
The coordinates returned were (3454,203), which would indicate it was found in the secondary screen. But it did not.

If I try to find the same image in the same place (primary screen) but using s1 this time, I get correct coordinates, indicating it was found on the primary screen.

I need help trying to figure out how to tell Sikuli to watch for things on the secondary screen, and also some insight as to why the find() function would return wrong/out of place coordinates.

Thanks!

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

what version of SikuliX?
what system?

Revision history for this message
LuisBow (titobogran) said :
#2

I am using the sikuli-java.jar file in my program, version 1.0.1 I believe on a Windows 7 machine.

Revision history for this message
Best RaiMan (raimund-hocke) said :
#3

you should switch to 1.1.0, where the respective jar is sikulixapi.jar.
start here: http://sikulix.com

Revision history for this message
LuisBow (titobogran) said :
#4

Updating to 1.1.0 fixed my problem.
Thanks RaiMan!

Revision history for this message
LuisBow (titobogran) said :
#5

Thanks RaiMan, that solved my question.