'How to validate the location of an element

Got the location of an element, but don't know how to validate it

I assumed the ExpectedValue as (0, 0)

WebElement element = common.getElement(object); Point ActualValue = element.getLocation();

How to compare these ActualValue and the ExpectedValue



Solution 1:[1]

I assume you want to use JUnit for validation:

final WebElement element = webDriver.findElement(By.id("id"));
final Point location = element.getLocation();
final int x = location.getX();
final int y = location.getY();
assertThat(x, is(0));
assertThat(y, is(0));

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Artyom Rebrov