sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #58172
Re: [Question #701089]: Cannot verify an object on screen
Question #701089 on SikuliX changed:
https://answers.launchpad.net/sikuli/+question/701089
Status: Open => Answered
RaiMan proposed the following answer:
URL path1 = "Sikuli/test1.png";
... is not valid Java: a String cannot be converted to an URL
Finder() and Finder.find() accept valid path strings.
Valid means, that the image file can be loaded from the given path: absolute paths always work if valid.
Relative paths can only be evaluated against a valid ImagePath.
In your case it would give:
String path1 = "Sikuli/test1.png";
Finder finder = new Finder(path1);
[error] ImagePath: find: not in ImagePath: Sikuli/test1.png
[debug] ImagePath: BundlePath: --- not set ---
[error] java.lang.NullPointerException: Cannot invoke "java.awt.image.BufferedImage.getType()" because "bImg" is null
I do not know, where your folder "Sikuli" is in your file system, but something like this would help:
ImagePath.setBundlePath("/..../somewhere/Sikuli/");
and then:
String path1 = "test1.png";
String path2 = "test2.png";
Finder finder = new Finder(path1);
finder.find(path2);
if (finder.hasNext()) {
System.out.println("found");
}
would work.
I recommend to use SikuliX 2.0.5 and Java 8+ 64-Bit, because earlier
versions are no longer supported in case of problems.
--
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.