public void positionMatch() {
Criteria c1 = new TypeCriteria(UIATableCell.class);
PropertyEqualCriteria c2 = new NameCriteria(buttonName);
Assert.assertEquals(c2.getMatchingStrategy(), MatchingStrategy.exact);
Criteria c = new AndCriteria(c1, c2);
UIAElement element = driver.findElement(c);
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);
}