0

I am trying to implement a method to find the center of an image and click at that location. On a normal day I would have tried the getCenter() method of SikuliX. But, this time I need this method to be abstract and work for a wide number of images. All the images are exactly same in appearance but are of different dimensions (length & width). So I am trying to find the center by evaluating the coordinates of the corner and then finding out the center using simple coordinate geometry. Problem: I cannot click at a coordinate location. I guess SikuliX requires location object instead of coordinates. Is there any way I can convert coordinates into a location object.

Thank You

Eugene S
  • 6,709
  • 8
  • 57
  • 91
zeroth
  • 37
  • 2
  • 7
  • Do you mean you have a location you want to click represented by integers and you want to use them to set a click location? – Eugene S Mar 29 '17 at 07:32

1 Answers1

0

If I understand your question correctly and what you have is just integer/double/etc.. coordinates of a location you want to click, you can simply do something like this:

@Test
public void locationByInteger() throws FindFailed {

    Screen s = new Screen(0);

        int x = 100;
        int y = 100;

        s.click(new Location(x, y));

    }
Eugene S
  • 6,709
  • 8
  • 57
  • 91