How can I give WebDriverWait and ExpectedConditions for appium driver type as <Mobile Element>?

  1. I have used List waitAllElementsToBeVisibleByLocator(WebDriver driver, By by) helper method as for defining the List of WebElements.

  2. While using appium driver , I got warning message as “AppiumDriver is a raw type. References to generic type AppiumDriver should be parameterized”, So I have added argument as AppiumDriver “MobileElement” for appium driver.

  3. After including AppiumDriver “MobileElement” , I am facing conflicts in casting from WebElement to AppiumDriver MobileElement.

  4. If I change List “WebElement” waitAllElementsToBeVisibleByLocator() as List “MobileElement” waitAllElementsToBeVisibleByLocator means , I am getting error message as change return type as List “WebElement”.

  5. How can I give WebDriverWait and ExpectedConditions for appium driver?

// helper method
public static List waitAllElementsToBeVisibleByLocator(
WebDriver driver, By by) {
WebDriverWait wait = new WebDriverWait(driver, 10);

    return wait.until(ExpectedConditions
            .visibilityOfAllElementsLocatedBy(by));
}

// method, which I have referred from helper method
public List getSavedPhotos() {
return AppiumHelper.waitAllElementsToBeVisibleByLocator(getDriver(),
getPhotoGalleryImageElementName());
}

1 Like

Make Appium driver of type WebElement then this conflict will be resolved.

AppiumDriver [WebElement] driver;

@amitjaincoer191, Ok I will make appium driver as WebElement.