В селениуме 2.50 + и 3.0.1 отлично работал такой код:
new WebElementWait(someWebElement, 120).until(fixed());
Где сам предикат выглядит вот так:
//
public static final Predicate<WebElement> fixed() {
return new Predicate<WebElement>() {
private Point prevLocation = null;
private Dimension prevSize = null;
@Override
public boolean apply(WebElement element) {
if (element.getLocation().equals(prevLocation) && element.getSize().equals(prevSize)) {
return true;
} else {
prevLocation = element.getLocation();
prevSize = element.getSize();
return false;
}
}
};
}
//
После миграции на 3.3.1 в этой строке:
new WebElementWait(someWebElement, 120).until(fixed());
Часть fixed() выделяется красным и IntellijIdea ругается на:
until (java.util.function.Function<? super org.openqa.selenium.WebElement,V> in FluentWait cannot be aplied
to (com.google.common.base.Predicate<org.openqa.selenium.WebElement>)
reason: no instance(s) of type variable(s) V exist so that Predicate<WebElement> conforms to Function<? super WebElement, V>
Что нужно сделать, чтобы всё заработало? :-)