title: Selenium Java Lambda Implementation for Explicit Waits
body: <p>I am trying to implement Java Lambda concept for selenium webdriver waits. I need to convert custom webdriver wait something like this </p>
  
  <pre><code>  (new WebDriverWait(driver(), 5))
              .until(new ExpectedCondition&lt;WebElement&gt;() {
                  public WebElement apply(WebDriver d) {
                      return d.findElement(By.linkText(""));
                  }
              });
  </code></pre>
  
  <p>to</p>
  
  <pre><code> (new WebDriverWait(driver(), 5)).until((driver) -&gt; driver.findElement(By.linkText("")));
  </code></pre>
  
  <p>But it does not matches the functional interface of 'until' refers to and throws error.</p>
  
  <p>So i tried passing the Lambda as it supports.</p>
  
  <p>Attempt1</p>
  
  <pre><code>Predicate&lt;WebDriver&gt; isVisible = (dr) -&gt; dr.findElement(
       By.linkText("")).isDisplayed();
       webDriverWait.until(isVisible);
  </code></pre>
  
  <p>It kind of works but is not what i require because it returns only void.</p>
  
  <p>Need your help or advice on this.</p>