5.0.0-BETA5: parameter type conflict
Description
WebElement element = wait.until(ExpectedConditions.visibilityOf(el));
->
Error:(235, 38) java: method until in class org.openqa.selenium.support.ui.FluentWait<T> cannot be applied to given types;
required: java.util.function.Function<? super org.openqa.selenium.WebDriver,V>
found: org.openqa.selenium.support.ui.ExpectedCondition<org.openqa.selenium.WebElement>
reason: cannot infer type-variable(s) V
(argument mismatch; org.openqa.selenium.support.ui.ExpectedCondition<org.openqa.selenium.WebElement> cannot be converted to java.util.function.Function<? super org.openqa.selenium.WebDriver,V>)
@amedvedjev Are you sure that it is appium issue?
@TikhomirovSergey of course not :-). but it appears when i switch pom.xml to latest 5th version. Can you use mentioned in your code without issue?
now reverted back to 4th.
thanks for any idea what to check.
@amedvedjev It is defenetely the bug of selenium. Take a look at the https://github.com/SeleniumHQ/selenium/blob/master/java/client/src/org/openqa/selenium/support/ui/FluentWait.java#L34
and
https://github.com/SeleniumHQ/selenium/blob/master/java/client/src/org/openqa/selenium/support/ui/FluentWait.java#L204
and now
https://github.com/SeleniumHQ/selenium/blob/master/java/client/src/org/openqa/selenium/support/ui/ExpectedCondition.java#L20
It is the bug of selenium!
ok. indeed. thanks for help. https://github.com/SeleniumHQ/selenium/issues/3606
anyway the issue started appear in Selenium 3.2.0. Do we need to use buggy version of selenium?
@amedvedjev It was not expected. You can exclude 3.2.0 at the configuration
I am confused - I also have just moved up versions - to selenium 3.3.1 using the java package and I am seeing the same issue on a line of code like this - element = wait.until(ExpectedConditions.elementToBeClickable((By) identifier));
error: cannot access Function
wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt("toolIFrame"));
required: Function<? super WebDriver,T>
found: ExpectedCondition
It looks like this was a guava issue? I don't understand what the fix is - it looks like the issues for this are closed?
If I back down to the 3.0.0 level of selenium then i can compile again...
@amyreit You are correct; there is somewhat of a conflict if you use the latest version of Selenium. What ended up resolving issues for me was including the latest version of guava within my pom.xml; even though I had not used it.
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.3.1</version>
</dependency>
I don't have a pom file - I'm using eclipse and java.... so not sure how to make this compile work? The guava 21 is included in my classpath....
Tried to add latest guava to my pom, didn't make a difference. Making an anonymous function as advised by http://stackoverflow.com/a/42546102 to match the signature is a workaround, but for a first time selenium user, I gotta admit I prefer to rely on the official documentation, so I downgraded to 3.0.1. Especially since I'm not sure of the usage of ExpectedConditions static methods in that context. Seems to be more of the documentation requiring an update, but having the first main doc example fail to compile doesn't get you started on the right foot.
Especially since I'm not sure of the usage of ExpectedConditions static methods in that context.
Its an issue in Selenium Server latest where in it should be fixed if you exclude guava from java-client and add latest guava by yourself. If possible will raise a PR and fix it at selenium end soon.
Instead of com.google.guava.guava I'm using com.google.inject.juice 3.0 with selenium-java 3.4.0. My maven project builds with no problem. However if I use com.google.inject.juice 4.x then I encounter the same issues described above.
I updated https://mvnrepository.com/artifact/com.google.guava/guava to the latest version "23.0". It fixed my problem.
I too had faced the same issue and the issue got solved with adding below dependencies in my pom file:
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>5.0.0-BETA6</version>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>23.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.4.0</version>
</dependency>
Issue is resolved now :) Thank you!