Ask Your Question

Revision history [back]

Trying to automate desktop application using sikuli integrated with eclipse.

I am new to sikuli, I have built a maven project (added 'sikulixapi.jar' in build path). Problem Description: 1.Create a screenshot folder inside the project directory. Placed all the images in the same folder 'screenshot'. 2.Was trying to click on the word document, so created the blank document named it 'Doc2.png'. The same image and the file is placed inside the screenshot folder (inside the project directory).

Sharing the code snippet as well:

package SikuliAutomation;

import java.io.File; import org.sikuli.script.ImagePath; import org.sikuli.script.FindFailed; import org.sikuli.script.Screen;

public class SikuliWordAutomate {

public static void main(String[] args) throws FindFailed  {
    // TODO Auto-generated method stub
    String basePath=System.getProperty("user.dir");
    String extPath=basePath+File.separator+"screenshot";
    System.out.println(extPath);
    ImagePath.setBundlePath(extPath);
    String paths = ImagePath.getBundlePath();

        System.out.println(paths);

    Screen s = new Screen();
    s.find("Doc2.png");
    s.doubleClick("Doc2.png");
    System.out.println("File icon clicked");



}

}

Problem: Every time I am trying to run the code, its throwing error

/Users/sayanisengupta/Desktop/EclipseWorkspace/SikuliPOC/screenshot /Users/sayanisengupta/Desktop/EclipseWorkspace/SikuliPOC/screenshot Exception in thread "main" CvException [org.opencv.core.CvException: cv::Exception: OpenCV(3.4.2) /Users/raimundhocke/SikuliX/OpenCV/opencv-3.4.2/modules/core/src/matrix.cpp:235: error: (-215:Assertion failed) s >= 0 in function 'setSize' ] at org.opencv.imgproc.Imgproc.matchTemplate_0(Native Method) at org.opencv.imgproc.Imgproc.matchTemplate(Imgproc.java:2607) at org.sikuli.script.Finder$Finder2.doFindMatch(Finder.java:896) at org.sikuli.script.Finder$Finder2.doFind(Finder.java:868) at org.sikuli.script.Finder$Finder2.find(Finder.java:617) at org.sikuli.script.Finder.find(Finder.java:280) at org.sikuli.script.Region.runFinder(Region.java:2905) at org.sikuli.script.Region.doFind(Region.java:2841) at org.sikuli.script.Region.find(Region.java:2334) at SikuliAutomation.SikuliWordAutomate.main(SikuliWordAutomate.java:23)

Please help me on the same, let me know how to resolve this issue.