2

I just want to ask if someone is able to translate this to a normal method or convert this to lambda expression 8 or higher

 public void waitUntilDocIsReady() 
 {
    new WebDriverWait(driver, 30).until((ExpectedCondition<Boolean>) wd ->
    ((JavascriptExecutor) wd).executeScript("return document.readyState").equals("complete"));
 }

Actually this is running as expected in my local machine but once I tried to run it in Jenkin Server. I'm having an error "lambda expressions are not supported in -source 1.6" Thank you everyone! I'm really sorry for asking this question. I hope someone can answer this.

Talenel
  • 422
  • 2
  • 6
  • 25
  • Hi Vins, yes I know sorry for that :( – Aldrin Combalicer Sy Dec 12 '17 at 08:07
  • 2
    From that error, there problem isn't in your Java; it's that your jenkins job is trying to compile it with Java 1.6 instead of 1.8. Make sure you have Java 8 installed on the machine, and that the job is configured to use it. – yshavit Dec 12 '17 at 08:20
  • 2
    @AldrinCombalicerSy seems jenkins is running java 1.6. Either update that or "dumb" down the EC part. Try this one if this works - https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/support/ui/ExpectedConditions.html#jsReturnsValue-java.lang.String- . https://www.programcreek.com/java-api-examples/index.php?api=org.openqa.selenium.support.ui.ExpectedCondition Else look at this with examples of custom EC, 5th has javascript. Combine your js in 4th example and it should work. – Grasshopper Dec 12 '17 at 08:32
  • 2
    @AldrinCombalicerSy By the way - there is no point waiting until `document.readyState` is `complete`. Read answer in [this question](https://stackoverflow.com/questions/47709234/selenium-ie-webdriver-only-works-while-debugging/47710701#47710701) – Fenio Dec 12 '17 at 14:43
  • @RafałLaskowski Thank you! It solves my problem – Aldrin Combalicer Sy Dec 13 '17 at 02:38
  • @AldrinCombalicerSy Give the upvote to answer in that question :) – Fenio Dec 13 '17 at 07:56

0 Answers0