Not able to find elements of sticky bar menu items

Hi ,

I am automating android app using selenium and appium (android driver)
Using uiautomator viewer for inspecting the element

When I scroll up the page some menu items remains sticky on page and when contents which was previously below the sticky menu items collapses and hides behind sticky menu items then I am not able to locate sticky menu items , Please suggest me any solution for that,

I mean physically that sticky menu items are visible but uiautomatorviewer is not able to locate those items,its locating the contents behind the sticky menu item

If my understanding is right, you have two “layers” of UI elements in your application. The top layer contains your “sticky menu” and the bottom layer is the main application’s UI. Uiautomatorviewer might be returning data for your top layer. Can you double check the UI hierarchy tree in the top right pane of Uiautomatorviewer? The second layer’s data might be listed a bit down on the tree.

Please find attachment

once sticky menu bar items sticks and content below it collapses ,uiautomatorviewer is not able to capture sticky menu items, it starts capturing content behind it

Please help me out with this

That’s certainly interesting! Do you mind if we take a closer look? You can save a copy of whatever data uiautomatorviewer has by clicking the floppy icon in the top left. You can copy and paste the contents of the .uix file that gets saved to a pastebin:

Hey please find uix attachments for both scenarios

Pasting uix for both in pastebin

If my understanding is right, you’re looking for data on the big “DONATE” button at the bottom of the screen.

I found it immediately in your UIX file. It’s near the bottom of your UI tree, so just scroll all the way down and look around there. You can also type in “DONATE” in the text field above the tree layout in uiautomatorviewer to search for the DONATE element.

No no,I am looking for funding,the pitch and videos container below top video view

Please help me out in finding these container sticky tab controls

Ah, I see. That’s interesting. Do you know if this page is displayed using a WebView?

Hey , Can you please tell me how to check webview elements in Native android app ?

If you’re testing on a device running KitKat (API 19) or newer, you have to rebuild the application to enable WebView debugging. See WebView.setWebContentsDebuggingEnabled. When this is done, you can check if debugging is enabled by using Chromium to visit chrome://inspect/#devices. Supposedly, you can do this in Firefox as well with the Valence add-on.

Anyway, once this is done, you can switch contexts in during the Appium driver session with the context method call. You can retrieve lists of contexts using getContextHandles(). If you switch to the WebView context, you might be able to see your elements.

Another excellent way to check if everything is working as you expect, see if you can see the same elements if you see the same elements in a regular browser (use the inspection feature of Firefox or Chromium).

I think this is not a webview (I can not inspect any of the element in browser), Developers have used some 3rd party scrollview but they don’t know about their customization of code so that this visibility should retain on sticky behavior i.e. Funding,the pitch and videos container visibility after swipe

@Degard Can you please help me out in this issue listed above ?

Hi, check picture below.
It seems you are searching Relative layout which you call sticky menu. (blue frame)
Funding button in green frame.

@degard No,No you are taking element behind funding sticky menu item

See screenshot

oh, I see.
Does It happen only when sticky menu is located on top?

This happens only when the content below it comes behind sticky menu

It is strange,
I have no idea why it happens.

You can print all elements in your script using method: driver.getPageSources() and check if it is here.
Or check it in appium inspector.

Hmm… You’re sort of stuck then. Appium uses Android’s Uiautomator under the hood to do all of its element searching and interaction. If Uiautomator does not return anything, then Appium can’t return anything either.

All is not lost, however! You can still click on these missing elements and have the application react accordingly. You have to hardcode some values into your test logic to send taps to where you think the sticky menu bar will be. The difficulty here often lies in figuring out a way to consistently get the menu bar in a position you can easily predict. One option is to scroll all the way down so you can get the menu bar at the top where you know it will be.

The better option in the long run is to investigate how exactly the menu bar is being constructed and drawn by the third party library.