Some attributes are not visible in Appium

Hello, i use appium 2.0.0-beta.67 (java).
my android application is based on kotlin and this is part of my code:

 <Button
        android:id="@+id/testBottomClick"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="test"
        android:tag="example"
        android:contentDescription="simple_description"
        android:hint="@string/test_hint" />

but when i checking this element using appium, visable are not “tag” attribute, visable contentDescription, also hint, but non ‘tag’.

i wont to visable ‘tag’ or some custom attribute field.

can anyone help me?

Looks like there is an implementation for AndroidFindBy(tagName=sometag) in Java Client:

ok this method works but i have same problem with appium inspector. what can i do?

Can you explain what you are trying to do? Inspector is great and all, but at the end of the day it’s just a tool that has some limitations. There are users on this forum who don’t use Inspector at all, but rely on methods like:

driver.getPageSource()

Maybe something like that could work for you?

I’m trying to figure out what the reason is.
appium or dev. code;

driver.getPageSource() and also appium inspector “tag” not exist

content-desc exist but not ‘TAG’

This may just be a limitation of Inspector. You could try the ‘copy xml source to clipboard’ button on inspector and then search for ‘tag’ and see what you find.

I just tried on my app but we either don’t use tags, or I can’t see them. Really if you are looking for elements the best advice is to use ‘resource-id’, which is a more standard approach.

I don’t think you can see these in UIAutomatorViewer either, so I would say it’s a limitation of the tools, not a problem in your code.

in some cases it is possible :slight_smile:

https://medium.com/androiddevelopers/accessing-composables-from-uiautomator-cf316515edc2

all dev need is add one line of code to see tags as IDs in UiAutomator

Hmm. I didn’t get that this poster is using Jetpack Compose, but it’s possible!

Tags won’t be visible in the UiAutomator page source because they are not exposed to the accessibility framework. Although you can use Espresso driver as a possible alternative.

There are also several hidden accessibility attributes. They could be retrieved using the extra property. You may try to experiment with it