groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mohan Radhakrishnan <>
Subject Groovy code with Function or Predicate
Date Mon, 11 Dec 2017 09:36:04 GMT

When I try to pass a lambda to a Selenium API call I see this error.
Believe this version of Selenium uses Guava lambdas.

I understand that I need to be explicit and specify whether it is a
Function or a Predicate. But don't know how to do this with groovy.

So here I may have to explicitly declare a Function with an 'apply' method.

Cannot resolve which method to invoke for [class Fluent$_closure1] due to
overlapping prototypes between:

                         ieDriver = new ChromeDriver();

   class Fluent{

     ChromeDriver ieDriver;
     def application =  {  wd -> wd.findElement("q"))}

     Fluent( ChromeDriver ieDriver){
      this.ieDriver = ieDriver;


     public WebElement waitFluently(){

           Wait wait = new FluentWait( ieDriver)
                  .withTimeout(10, SECONDS )
                  .pollingEvery(5, SECONDS)
WebElement foo = wait.until(application);

                                  WebElement element = new
Fluent(ieDriver).waitFluently(); //driver.findElement("q"));
                           }catch(Exception e) {
                        " Exception " + e.getMessage());


View raw message