Closed benjamin-sailer closed 2 years ago
Just for the record: Moving to Java 11 fixed that issue partly. As a workaround I copied the FluentWait-class into my project (using the same package) and modified two the two until methods to
a) accept java.util.function.Function
and
import java.util.function.Function;
...
@Override
public <T> T until(Function<? super Fluent, T> isTrue) {
updateWaitWithDefaultExceptions();
return wait.until(isTrue);
}
b) provide a function calling isTrue.accept
to wait.until
:
public FluentWait until(com.google.common.base.Predicate<Fluent> isTrue) {
updateWaitWithDefaultExceptions();
wait.until(f -> isTrue.apply(f));
return this;
}
Seems (probably more than) a bit hacky as this relies on the classloader feeding my own version of org.fluentlenium.core.wait.FluentWait
instead of the one provided by the fluentlenium dependency.
Works for me but anyway a dependency upgrade may be worth a try in serenity-bdd core.
We will probably deprecate FluentLenium integration in future versions as the $() operator in Serenity does much the same thing.
Which would mean basically dropping the ThucydidesFluentAdapter
and the PageObject.fluent()
method (resp. marking them @deprecated
in the first step)?
Looking forward to seeing the new version and getting an idea how much this would change (I assume in our case it wouldn't be a long way to go).
Using net.serenity-bdd:serenity-core:jar:2.2.13:compile, I encountered a NoSuchMethodError:
The last line of our code is MyClass.MyMethod(MyClass.java:myLine:
await().atMost(waitDurationInSeconds, TimeUnit.SECONDS).until(".ui-autocomplete-item").areDisplayed()
Digging a bit into this, i found an (non-)issue of https://github.com/SeleniumHQ/selenium/issues/3606, which basically turned out to be a version incompatibility, which I would pin down to serenity-core's fluentlenium-dependency, which is quite old - around April 16, the newest version is 4.3.1. From mvn dependency:tree, I get:
If I open the class
org.fluentlenium.core.wait.FluenWait
of this dependency in my IDE, it already detects compile errors like:(line 98: Required Type: Function; Provided: Predicate)
Unfortunately fluentlenium did a major rework of their API even between 0.x and 1.0, so adapting to a newer version was out of scope for me for this bug report.
Please consider upgrading the fluentlenium dependency.
All the best Benajmin