0
votes

I have been tasked with using the Sikuli tool for test automation purposes. I need to know if it is possible to work with an image that is NOT on screen using Sikuli and if so, how.

Task: As of now I have a captured image, say image1, in a directory. I open image1 on my computer and capture more screenshots from image1 (using Sikuli) and store these in a directory and proceed with my tests.

For the task I mentioned above I was curious if I could do all of that without opening image1 on my computer and have Sikuli (or any java API's) directly work with the file.

Thank you for your help in advance.

3

3 Answers

0
votes

I'm not quite sure to understand the question. Of course you can use any image (not only the screenshot done in the Sikuli-IDE).

The Sikuli-IDE allows you to take screenshots and store them on the filesystem, but at the ends, it uses the images stored on the file system (per default, they are stored on the module's folder= where your python script is).

With Ctrl+T in the Sikuli-IDE, you can switch between a view using the screenshots and an other view using the path of the image. Images can be used from an other folder, from an other module, etc.

0
votes

You can save the image in a variable.

img = "D:/path/of/image/image.PNG"
if exists(img,1):
    mouseMove(img)

About save the image, do you want to save a screenshot or just the content of region of the image?

0
votes

Use following code to compare one image with other without opening and finding it in actual present screen . It is basically image comparing function.

 public static void main () {

      String sampleImage = s.capture().getFile();

      fn_matchingPattern ( "refImgPath" , sampleImage  , double minSim);

    }



    public static boolean fn_matchingPattern (String refImgPath , String sampleImgPath , double minSim) {

    try {
        f = null;
        f = new Finder(refImgPath);
        Pattern tempPattern = new Pattern (sampleImgPath).similar((float) minSim);
        f.find(tempPattern);
        if (f.hasNext())
            return true;
        else
            return false;

    } catch (IOException e) {
        LogReport.warn("Exception IOException Please check : Reference Img path " + refImgPath );
        return false;
    }
 }