Unable to Inspect Jetpack Compose testTag Elements in Katalon Mobile Spy

Hi Team,

We are working on an Android app built with Jetpack Compose, and we want to identify elements using testTag so that they can be inspected and automated with Katalon Studio Mobile Spy.

Our developer has tried the following approaches:

  1. Using semantics with testTag:
Text(
    text = "Product Details",
    color = AppColors.colorTextInputError,
    style = MaterialTheme.typography.bodySmall,
    modifier = Modifier.semantics {
        testTag = "tvTitle"
        contentDescription = "Product details"
    },
)
  1. Using the testTag method directly:
Text(
    text = "Product Details",
    color = AppColors.colorTextInputError,
    style = MaterialTheme.typography.bodySmall,
    modifier = Modifier.testTag("tvTitle"),
)
  1. Using layoutId with testTag:
Text(
    text = "Product Details",
    color = AppColors.colorTextInputError,
    style = MaterialTheme.typography.bodySmall,
    modifier = Modifier.layoutId("tvTitleLayoutId").testTag("tvTitle"),
)

However, in all cases, Katalon Mobile Spy is not able to detect or show these elements with testTag.
Instead, only generic or parent container nodes are visible, making it very hard to locate elements for automation.


:magnifying_glass_tilted_right: Question:

  • Does Katalon Mobile Spy support inspecting testTag attributes from Jetpack Compose?

  • If not, is there any workaround (e.g., mapping testTag to accessibilityId, contentDescription, or resource-id) so that Katalon can recognize the elements?

  • Has anyone successfully integrated Katalon with Jetpack Compose apps for element inspection and test automation?


Any guidance or workaround would be greatly appreciated :folded_hands:

Hi there, and thanks for posting in the Katalon community! :hugs:

To help you faster, please review our guide on Record Mobile Utility here:

Double-checking the steps and configurations might resolve the issue.

If the doc doesn’t help, feel free to provide more details, and a community member will assist you soon.

Thanks for being a part of our community!
Best,
Elly Tran

@duyluong can you help

Hello @Elly_Tran , thanks for your quick response! :folded_hands:

I went through the documentation you shared and double-checked the configurations, but unfortunately, it didn’t solve my issue.

To clarify again:

  • Our app is built with Jetpack Compose.

  • We are using testTag (via Modifier.testTag() and also with semantics) to uniquely identify elements.

  • However, Katalon Mobile Spy is able to detect other locators like name, xpath, id, claass.

My questions are:

  • Does Katalon Mobile Spy currently support detection of testTag attributes in Jetpack Compose?

  • If not, is there any workaround (e.g., mapping testTag to contentDescription or resource-id) that works with Katalon?

Would appreciate if someone who has worked with Jetpack Compose + Katalon Mobile Spy can share their experience.

Thanks again for the support!

@ashwini this is not a katalon thing, it is how compose exposes semantics to the accessibility tree. testTag alone is not sent to uiautomator, so appium (and therefore mobile spy) never sees it. you need one extra flag on the root of the screen:

Scaffold(
    modifier = Modifier.semantics { testTagsAsResourceId = true }
) { ... }

testTagsAsResourceId is in androidx.compose.ui.semantics (it is marked experimental, so your dev adds @OptIn(ExperimentalComposeUiApi::class)). once it is set on an ancestor, every testTag below it shows up as resource-id in the uiautomator2 page source. in mobile spy you then get tvTitle under resource-id and can use id or //*[@resource-id='tvTitle'] as the locator. it only needs to be set once per root composable, not per element.

contentDescription works too and shows up as accessibility id, but it is read out by talkback, so devs usually prefer not to abuse it for test ids. testTagsAsResourceId is the clean route.