Can't handle Element found but not getting any error

Hi all.

When I use driver.findElement(by.id(“valueOfId”)); I don’t get any error about “No such element”, “Can’t find element” or something related. If I send a valueOfId that doesn’t exist in my view, I get one of those errors. So, I assume my script is finding the element, but when I print the “isDisplayed” result, I get false.

Can any one help me?

Are you using Android or iOS? On iOS, you can “find” and element that is not displayed, but that’s not the case on Android

Thanks. I’m using android. appium 1.6.4 (but getting same result on 1.5.3). Android 5.0. chromedriver 2.25. java-client-3.3.0. selenium-server-standalone-2-53.1

So much for the easy answer :slight_smile:

At this point, I would resort to inspecting the object and validating the other values to ensure I have the correct object.

I think I getting close to the answer… I made this:

List<WebElement> buttons = driver.findElements(By.xpath("//button"));
for(WebElement e : buttons){
        System.out.println(e.getAttribute("id"));
}

And I’m getting 2 pairs of each button:

skipButton
skipButton
nextButton
nextButton
and so on

Then, it could be an error of the app logic or an error on appium, any case, I’ll try to click the second one

It worked!!!

I’m not specialist on web development, but since the attribute is called ID, I thought there couldn’t be more than one with the same value.

Congratulations. And welcome to the second level of resource-id hell on Android