uk.sponte.automation.seleniumpom.webdriverConditions.ElementLocationMovingCondition Maven / Gradle / Ivy
package uk.sponte.automation.seleniumpom.webdriverConditions;
import org.openqa.selenium.Point;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedCondition;
import javax.annotation.Nullable;
/**
* Created by n450777 on 10/03/2016.
*/
public class ElementLocationMovingCondition implements
ExpectedCondition {
private Point location;
private WebElement element;
public ElementLocationMovingCondition(WebElement element) {
this.element = element;
this.location = element.getLocation();
}
@Nullable
@Override
public WebElement apply(@Nullable WebDriver webDriver) {
Point newLocation = element.getLocation();
if(this.location.equals(newLocation)) {
this.location = newLocation;
return null;
}
return element;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy