/*
* 等待元素出现
*/
public boolean waitForAeAppear(AndroidElement androidElement, int timeOutInSeconds) {
try {
WebDriverWait wait = new WebDriverWait(aDriver, timeOutInSeconds);
wait.until(ExpectedConditions.visibilityOf(androidElement));
return true;
} catch (Exception e) {
return false;
}
}
public boolean waitForAeTextAppear(String text, int timeOutInSeconds) {
try {
WebDriverWait wait = new WebDriverWait(aDriver, timeOutInSeconds);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(String.format("//*[@text='%s']", text))));
return true;
} catch (Exception e) {
return false;
}
}
请教为什么第一种直接等待 androidElement 不起作用
而第二种能够正常等待