Sikuli could locate a particular image on the screen , but still its unable to click on that image

Asked by sayantan

Using the below code i could verify that a particular image is present in the screen , but still i am unable to click on the particular icon
CODE:

public class s2 {

    public static void main(String[] args) throws FindFailed{

        Socket s= new Socket("127.0.0.1", 5933);

        s.setSoTimeout(1000);

        s.setKeepAlive(true);

        ConnectionController cc = new ConnectionController(s);

        cc.openConnection(0);
        cc.setPixelFormat(0, "Truecolor", 32, 0);

        cc.start(0);

        Thread.sleep(2000);
        VNCScreen vnc = new VNCScreen();
      Region r1=vnc.exists("COPY.png");
    if (r1 != null)
        System.out.print("exists");
    else
        System.out.print("doesn't exists");

      r1.click("COPY.png"); ------------------------> could locate the image , but still it clicks on some random region.

        }
}

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Tu Mi (mailtumi) said :
#1

it seems that several images were found. Can you give a try to use the pattern?
Example:
click(Pattern(COPY.png).similar(0.90).targetOffset(X,Y))

X and Y are the coordinates where to click.

http://sikulix-2014.readthedocs.io/en/latest/pattern.html

Can you help with this problem?

Provide an answer of your own, or ask sayantan for more information if necessary.

To post a message you must log in.