Element with "gone" visibility

Hi,

I am using appium for my android app.
I am trying to find an element which has visibility “gone” by default (unless you click a specific button for it to be displayed).
The problem is after clicking the relevant button I can see the element I am trying to find but the ui automator viewer cant see it.

I have its id and I’m trying by code to find using “driver.findElement(id)” and nothing works.
It seems to be that it is defined by default “gone” in the android code that makes all the problem.

Any suggestion ?

Thanks

Hello, shani

So it depends on how your project is structured.
What you need there is some kind of a refresh of the page that you are inspecting after you push that button.

In my case, every screen has a particular pageobject class.

So, a method that I will use to do that refresh would be something like this:

public DashboardPage moreInformation() {
    WebElement moreInformationButton = driver.findElement(By.name("WEITERE INFORMATIONEN"));
    moreInformationButton.click();
    return new DashboardPage(driver);
}

So, what this method does, is this:
Searches for “Weitere Informationen” element, then clicks on it, then returns the same page that I am in “DashboardPage(driver)” and calls for the driver again. So its kind of a refresh on the page.

In my case, after this refresh, more elements show up so I will be able to identify them. Otherwise, it won’t work.

So, in my opinion, if your project structure is not very reliable, you should take some time researching about “Appium project structure”. You can find plenty tutorials on the internet on how it should be correctly done.

I hope it helped! :slight_smile:

Thanks for your detailed answer :slight_smile:

After deeper investigation myself and Shani did , we’ve found that the problem is not related to the Page object / Appium , but to the app impl …

The initial control’s state was invisible , and move to visibility was made by some animation’s manipulation (but the visibility state remained “INVISIBLE”) , so by some minor tweak we did , we are changing the visibility status …

Works like a charm :slight_smile:

1 Like

Glad I could help and I’m happy that you guys found the solution in the end! :slight_smile:

is there a way to enable with JavaScriptExecutor? because .executeScript in appium does not have it.