FindFailed During Spotlight Tutorial

Asked by Chris Carela on 2018-05-11

Hello all,

HARDWARE: MacBook Pro (Retina 15in, 2880 x 1800) with 2 additional monitors (1920 x 1080)
IDE: Eclipse
SIKULI: v1.1.2

I'm attempting to run the common "Spotlight" tutorial found here http://doc.sikuli.org/faq/030-java-dev.html. Whenever I run this, I'm met with a FindFailed error message. Specific details below.

NOTES:
- imgs folder contains both spotlight.png and spotlight-input.png
- sikulixapi.jar has been configured to the Java Build Path

MY CODE:

import org.sikuli.script.*;
import org.sikuli.script.FindFailed;
import org.sikuli.script.ImagePath;
import org.sikuli.script.Screen;

public class test {

    public static void main(String[] args) {
        Screen s = new Screen();
        try{
            s.click("imgs/spotlight.png");
            s.wait("imgs/spotlight-input.png");
            s.click();
            s.write("hello world#ENTER.");
        }
        catch(FindFailed e){
                e.printStackTrace();
        }

}

}

MY ERROR:
FindFailed: imgs/spotlight.png: (70x42) in S(0)[0,0 1440x900] E:Y, T:3.0
  Line 2782, in file Region.java

 at org.sikuli.script.Region.wait(Region.java:2782)
 at org.sikuli.script.Region.find(Region.java:2329)
 at org.sikuli.script.Region.getLocationFromTarget(Region.java:3238)
 at org.sikuli.script.Region.click(Region.java:3736)
 at org.sikuli.script.Region.click(Region.java:3721)
 at sikuli2.test.main(test.java:14)

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
Chris Carela
Solved:
2018-05-15
Last query:
2018-05-15
Last reply:
2018-05-12
masuo (masuo-ohara) said : #1

The prepared images may not be suitable for SikuliX.
If you can use SikuliX IDE in your MacBook, try SikuliX IDE instead of Eclipse.
By using SikuliX IDE you can capture images.

Chris Carela (chriscarela) said : #2

Thanks @masuo, your comment gave me the idea that the screenshot tool was causing some sort of image layering issue.

I tried retaking the screenshots w/ the MacBook's screen capturing tool and now everything works!