javasikuliregionsikuli-script

How to uniquely identify an image in sikuli on windows 10. I'm getting an exception


I have two similar images, one image is on the left and one is on the right hand side of the screen. I want to click on the image on the left.

My idea in the code is to create a region for the image on the left then click the image on that region but when I run a code I get the following exception: image to search (650, 330) is larger than image to search in (1, 1).


Region region = new Region(650,330,0,0); 
Pattern element = region.find("myimage.png");
Screen screen = element.getScreen();
screen.doubleClick();

So how can I uniquely identify the image on the left using sikuli? I'm using sikuli version 2.0.5


Solution

  • A Region is defined: new Region(x, y, w, h)

    Your Region is at (650, 330) with width/height 0 (which internally is 1 pixel).

    Region region = new Region(0, 0, 650,330); 
    Match match = region.find("myimage.png");
    match.doubleClick();
    

    RaiMan from SikuliX