How can i check the element is not visible in UI but present in PageSource

I am trying to find an element is not visible in the UI by using Appium and Java.


<android.widget.RelativeLayout index="0" text="" resource-id="com.test:id/test" class="android.widget.RelativeLayout" package="com.test" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="false" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[0,75][1080,1920]" instance="0">

p, li { white-space: pre-wrap; }

But In the pagesource, I see “com.test:id/test” enabled as true.

Method 1:-

driver.findElements( > 0

Result:- Return 1

Method 2:-

public WebElement test() {         
    WebDriverWait wait = new WebDriverWait(driver, 10);


Result:- Return true

It seems to be test is still visible in the pagesoure but not in the UI

How can i test it ?

As far as I know, Appium can’t detect the element until it is visible on UI. You will have to bring it in the UI may be through swipe or any other way as appropriate.

@Umar_Khan The element is not visible. But appium detecting and says as visible. How can I proceed ?

Element set enabled=true. so its says as visible instead not visible in UI. Its my guess.

Can you please send me uiautomator screen shot for the element you want to work with