【发布时间】:2019-01-17 07:02:39
【问题描述】:
我遇到了until 方法通过 selenium webdriver 使用 appium 的问题。它抛出这个错误
FluentWait 类型中的方法 until(Function) 不适用于参数(new Function(){})
我遵循了prior posts 的所有选项,但没有一个有效。
使用 Java 1.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;
}
});
}
}
【问题讨论】:
标签: java selenium selenium-webdriver appium