Reputation: 37
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
Upvotes: 0
Views: 510
Reputation: 6910
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));
}
Upvotes: 0