如何验证元素的位置



得到了一个元素的位置,但不知道如何验证它

我假设ExpectedValue为(0,0(

WebElement元素=common.getElement(对象(;点实际值=元素.getLocation((;

如何比较这些ActualValue和ExpectedValue

我假设您想使用JUnit进行验证:

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));

最新更新