3

I've had a helper class for Selenium that worked like a charm previously, and out of the blue, this issue came up.

I've also attached a screenshot of the affected functions.

until (java.util.function.Function) in FluentWait cannot be applied to (org.openqa.selenium.support.ui.ExpectedCondition)   reason: no instance(s) of type variable(s) V exist so that ExpectedCondition conforms to Function

enter image description here

Mohamed Said
  • 524
  • 7
  • 27
  • None of the waits are FluentWait here in your code. These are types of ExplicitWait. Make the correction in your Question Subject & Question body. – undetected Selenium Apr 23 '17 at 12:51
  • @Dev That's the error that Intellij is throwing. – Mohamed Said Apr 23 '17 at 12:56
  • 1
    Observe the documentation of ExplicitWait here - http://www.seleniumhq.org/docs/04_webdriver_advanced.jsp – undetected Selenium Apr 23 '17 at 13:11
  • @Dev Thank you for the added reference, however the issue hasn't been resolved. – Mohamed Said Apr 23 '17 at 13:17
  • What are the steps you want to perform? What worked for you till now? Show your code. Where are you exactly stuck? – undetected Selenium Apr 23 '17 at 13:19
  • @Dev the test case is supposed to wait for a clickable button for signing up users to complete. but that doesn't happen because the class throws error I suppose. it used to work before but not anymore. The registration is a three phase pages and each page there's a continue button that validates server side(ajax call) and I also call this explicit wait function to tell it to wait before clicking on each page – Mohamed Said Apr 23 '17 at 13:28
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/142401/discussion-between-dev-and-mohamed-hesham). – undetected Selenium Apr 23 '17 at 13:32
  • @Dev `WebDriverWait` extends `FluentWait`. See the docs. https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/support/ui/WebDriverWait.html – JeffC Apr 23 '17 at 17:20
  • Possible duplicate of [wait.until(ExpectedConditions) doesnt work any more in selenium](http://stackoverflow.com/questions/42421148/wait-untilexpectedconditions-doesnt-work-any-more-in-selenium) – JeffC Apr 23 '17 at 17:21
  • It's always a good practice to google the error that you get before posting an question. It's extremely unlikely that you are the first to get said error message and it saves everyone time having to answer a question that has already been answered. – JeffC Apr 23 '17 at 17:22
  • @JeffC Thank you for your link as well as your downvote, I never ask on here before I google the error I have, try googling it first and if you came up with solutions let me know. And as someone who is new to Selenium I had to ask here, and I guess that's why Stackoverflow is for? – Mohamed Said Apr 23 '17 at 17:50
  • I did google it and the first result was the question that I dup'd this to. If you did google it, you should put some of the things you tried so we don't have to guess what all you have tried or if you tried anything. This is all covered in [ask]. – JeffC Apr 23 '17 at 19:01
  • @Dev is not familiar with Selenium, perhaps, and isn't aware it isn't your own library but a very common third party one. – Keith Tyler Jun 20 '17 at 20:32

4 Answers4

3

The solution that worked for me was to update the jre used by Intellij. that resolved the issue.

Update: Google Guava 23.0 also fixed the issue for some people.

Mohamed Said
  • 524
  • 7
  • 27
2

Just use the following in your pom.xml

<build>
   <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
   </plugins>        
</build>
0

Try to use it:

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-devtools</artifactId>
            <version>4.0.0-alpha-6</version>
        </dependency>
Kosmos
  • 333
  • 1
  • 5
  • 16
-1

In my case previously I was using the below one in pom.xml

 <dependency>
     <groupId>org.seleniumhq.selenium</groupId>
     <artifactId>selenium-java</artifactId>
     <version>3.141.59</version>
 </dependency>

I removed the above one and replaced with this

      <dependency>
          <groupId>org.seleniumhq.selenium</groupId>
          <artifactId>selenium-java</artifactId>
          <version>3.0.1</version>
          <scope>compile</scope>
      </dependency>

It worked and "until(java.util.function.Function) in FluentWait cannot be applied to" this error gone from my IntelliJ class.

Something is deprecated or not working in newer selenium jar version. so use old one.
You can also add following dependency specifically in pom.xml and check.
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-support</artifactId>
        <version>3.0.1</version>
    </dependency>
Saeid Amini
  • 1,313
  • 5
  • 16
  • 26