I've just installed SikuliX(sikulixapi-2.0.4.jar) and Eclipse Oxygen under Ubuntu 16.04. The testing program is the following :
import org.sikuli.script.*;
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();
}
}
}
However, when I run the testing program I receive the error message below :
[error] ImagePath: find: not there: imgs/spotlight.png
FindFailed: imgs/spotlight.png: (0x0) in R[0,0 1280x800]@S(0) Line 2222, in file Region.java at org.sikuli.script.Region.wait(Region.java:2222) at org.sikuli.script.Region.wait(Region.java:2240) at org.sikuli.script.Region.getLocationFromTarget(Region.java:3188) at org.sikuli.script.Region.click(Region.java:3806) at org.sikuli.script.Region.click(Region.java:3782) at Test.main(Test.java:9)
I made a search and I found another post related to this bug at https://answers.launchpad.net/sikuli/+question/668883 .
I made my first screenshot using Gnome screenshot and another screenshot using Gimp screenshot, however I still receiving the same error in the both case.
As you can see below, the picture spotlight.png seems to be found by Eclipse in the project. Thanks in advance for your help.
Good afternoon for this case I discovered that
sikuli
does not automatically detect the root folder of the project. What you should do for this case is specify the folder using the commandSystem.getProperty("user.dir")
;