Hello. Has anyone had experience using Appium with...
# multiplatform
i
Hello. Has anyone had experience using Appium with Compose Multiplatform? Appium doesn't see testTag at all!
m
you have to use standard HTML attributes —
data-testid
,
aria-label
then
driver.findElement(By.cssSelector("[data-testid='login_button']"))
v
If you're automating Android with Appium or w/e else, for test tags to become visible you need to set the Android:
Copy code
Modifier.semantics { testTagsAsResourceId = true }
The way I've done it is I've created an expect/actual called
platformTestTagsAsResourceId
, implement it in the Android source like this:
Copy code
actual var SemanticsPropertyReceiver.platformTestTagsAsResourceId: Boolean
    get() = testTagsAsResourceId
    set(value) {
        testTagsAsResourceId = value
    }
and add this semantics modifier on the top most composable of your app