2

I am running into an issue with until method using appium through selenium webdriver. It throws this error

The method until(Function) in the type FluentWait is not applicable for the arguments (new Function(){})

I followed every option from prior posts but none have worked.

Using Java 1.8, added pretty much every dependency in POM file.

public class AppInit {

    public static void setUp(AndroidDriver<AndroidElement> adriver) throws InterruptedException, MalformedURLException {
        ...........
        WebDriver driver;
        final WebDriverWait wait = new WebDriverWait(driver, 5);
        final By testXpath = By.xpath("////android.widget.Button[@content-desc='someid']");
        wait.until(ExpectedConditions.visibilityOfElementLocated(testXpath)).click();
   }

   public static void clickMenu() {
        WebDriver driver;
        new WebDriverWait(driver, 60).until(new Function<WebDriver, Boolean>() {
            Boolean isWindowFound = Boolean.FALSE;
            public Boolean apply(WebDriver driver) {
                try {
                   driver.switchTo().window("Your Window Name");
                   isWindowFound = Boolean.TRUE;
                } catch (NoSuchWindowException e) {
                   System.out.println("Your Window Name not found");
                   System.out.println(driver.getTitle());
                   return isWindowFound;
                }
                return isWindowFound;
            }
        });
    }

}
Andrew Myers
  • 2,754
  • 5
  • 32
  • 40
Panee S
  • 104
  • 1
  • 9

2 Answers2

1

Adding below dependencies has fixed the issue

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

    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>23.0</version>
    </dependency>
Panee S
  • 104
  • 1
  • 9
0

In case this helps someone - I was using Selenium-java version "3.141.59" and was able to compile the project fine using maven but was getting compile time errors in eclipse although I generated the eclipse project settings using maven itself. I then only added below guava dependency and my compile time errors in eclipse went away

<dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>23.0</version>
    </dependency>
Shailendra
  • 8,874
  • 2
  • 28
  • 37