mercredi 3 juin 2015

Appium: isDisplayed() vs findElements(by).size

Traditionally I always checked for the presence of objects in appium using:

    int count = driver.findElements(by).size();
            if (count == 0) {
        Logger.LogMessage("ElementDoesNotExist: " + by, Priority.Medium);
        return true;
    } else {
        Logger.LogMessage("ElementDoesExist: " + by, Priority.Medium);
        return false;
    }

However, I see there is now a isDisplayed() method:

    driver.findElement(by).isDisplayed()

Anyone know which is best to use and why?

Thanks,

Charlie

Aucun commentaire:

Enregistrer un commentaire