Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/324.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java FluentWait类型中的方法until(函数)不适用于参数_Java_Selenium_Selenium Webdriver_Appium - Fatal编程技术网

Java FluentWait类型中的方法until(函数)不适用于参数

Java FluentWait类型中的方法until(函数)不适用于参数,java,selenium,selenium-webdriver,appium,Java,Selenium,Selenium Webdriver,Appium,我在通过selenium webdriver使用appium的方法之前遇到了一个问题。它抛出了这个错误 FluentWait类型中的方法until(Function)不适用于参数(new Function(){}) 我遵循了公司的每一个选择,但没有一个奏效 使用Java1.8,在POM文件中添加了几乎所有的依赖项 public class AppInit { public static void setUp(AndroidDriver<AndroidElement> adr

我在通过selenium webdriver使用appium的
方法之前遇到了一个问题。它抛出了这个错误

FluentWait类型中的方法until(Function)不适用于参数(new Function(){})

我遵循了公司的每一个选择,但没有一个奏效

使用Java1.8,在POM文件中添加了几乎所有的依赖项

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;
            }
        });
    }

}
公共类AppInit{
公共静态无效设置(AndroidDriver adriver)引发InterruptedException,MalformedUrlexException{
...........
网络驱动程序;
最终WebDriverWait等待=新的WebDriverWait(驱动程序,5);
最终结果为testXpath=By.xpath(“///android.widget.Button[@content desc='someid']);
wait.until(ExpectedConditions.visibilityOfElementLocated(testXpath)).click();
}
公共静态无效单击菜单(){
网络驱动程序;
新的WebDriverWait(驱动程序,60)。直到(新函数(){
布尔值isWindowFound=Boolean.FALSE;
公共布尔应用(WebDriver驱动程序){
试一试{
driver.switchTo().window(“您的窗口名”);
isWindowFound=Boolean.TRUE;
}捕获(无捕获){
System.out.println(“未找到您的窗口名”);
System.out.println(driver.getTitle());
返回已找到的窗口;
}
返回已找到的窗口;
}
});
}
}

添加以下依赖项已修复此问题

    <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>

org.seleniumhq.selenium
硒爪哇
3.5.2
番石榴
番石榴
23