我需要在appium中探索wait命令。登录后,可能有2个场景,我希望我的代码等到找到这2个元素中的任何一个。
答案 0 :(得分:0)
您可以在xpath string
中使用或运算符为这两个定位器使用xpathString xpath =“// * [contains(@text,'登录')或 含有(@资源-ID, '/ drawerImgBtn')]“;
Wait waitForElement = new FluentWait(automationDriver.appiumDriver).withTimeout(timeoutInSeconds, TimeUnit.SECONDS).pollingEvery(1, TimeUnit.SECONDS).ignoring(NoSuchElementException.class);
MobileElement element=(MobileElement) waitForElement.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(xpathString)));
if(element.isDisplayed())
{
return true;
}
else
{
return false;
}