UIARect position = element.getRect();
//center
Criteria
test =
new LocationCriteria(position.getX() + (position.getWidth() / 2),
position.getY() + (position.getHeight() / 2));
UIAElement res = driver.findElement(test);
Assert.assertEquals(res.getName(), buttonName);
// bottom right corner
int x = position.getX() + position.getWidth() - 1;
int y = position.getY() + position.getHeight() - 1;
test = new LocationCriteria(x, y);
res = driver.findElement(test);
Assert.assertEquals(res.getName(), buttonName);
// middle
x = position.getX() + (position.getWidth() / 2);
y = position.getY() + (position.getHeight() / 2);
test = new LocationCriteria(x, y);
res = driver.findElement(test);
Assert.assertEquals(res.getName(), buttonName);
}