I want in my test get the Text from a node.
**var nodes=onAllNodes(myNode).fetchSemanticsNodes()**
println("Test_printlog ########### start ${nodes.size}")
// give a corret number
for (node in nodes) {
println("TestNODE ${node.config}")
I have:
TestNODE SemanticsConfiguration@972964b{ mergeDescendants=true,TestTag : myTestTag, Text : my text,
If I want to get the Text property I tried to use node.config.get
but wat is the parameter to pass to the get to get the text?
in the documentation said:
androidx.compose.ui.semantics.SemanticsConfiguration public final operator fun get( key: SemanticsPropertyKey ): T Retrieves the value for the given property if one has been set. If a value has not been set, throws IllegalStateException
I try several time... but I have always error
like for example if I use node.config.get("Text")
Type mismatch. Required: SemanticsPropertyKey<TypeVariable(T)> Found: String
What is the correct syntax to get the Text property from node.config.get?
I found..... add:
import androidx.compose.ui.semantics.SemanticsProperties.Text
and use
node.config.getOrNull(Text)}
in this way you can also find all the other semantic properties:
import androidx.compose.ui.semantics.SemanticsProperties.TestTag
node.config.getOrNull(TestTag)}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With