finding-nodes-by-tag-text-content
Installation
SKILL.md
Finding Nodes by Tag, Text, or Content Description — Tag From Production, Find by Tag From Tests
Every Compose UI test starts by locating a semantics node. This skill picks the right finder, reasons about the count contract, and decides when to flip useUnmergedTree. Use it whenever the developer is staring at a "Reason: Expected exactly '1' node but could not find any node that satisfies …" error.
When to use this skill
- The developer reports "no node matched" / "multiple nodes matched" / "tag not found" / "ambiguous match" from
SemanticsNodeInteraction. - The developer asks how to locate a
Button,Text,Icon,IconButton,Switch, or any other composable inside a test. - The developer mentions
onNodeWithTag,onNodeWithText,onNodeWithContentDescription,onAllNodesWith*, oronRoot. - A test passes locally but is brittle to copy edits or i18n rotation of the UI strings.
- The developer asks about
useUnmergedTree, the merged tree, or "why does my inner Text not exist".
When NOT to use this skill
- The right node is found but assertions fail — see
../../assertions/asserting-node-state-and-text/SKILL.md(state) or../../assertions/asserting-bounds-and-dimensions/SKILL.md(geometry). - The finder returns one node but custom predicates are needed — see
../composing-semantics-matchers/SKILL.md. - The right node exists but only as a child/sibling/descendant — see
../traversing-the-semantics-tree/SKILL.md. - The semantics tree itself needs inspection — see
../../debug/printing-the-semantics-tree/SKILL.md.