Selector
Represents an intent query used to locate target UI nodes in a Compose Multiplatform view tree.
Selectors are passed to test scope methods (such as click(), input(), waitFor(), and assertVisible()) to resolve specific UI nodes across platforms.
Types of Selectors
Auto: Checks explicit
testTagfirst, falling back to visible text matching. Created via auto.Tag: Strictly matches explicit
testTagproperties. Created via tag.Text: Strictly matches visible text substrings. Created via text.
Indexing Constraints
When multiple UI elements match a query, use indexing functions:
first: Picks the first visible match (index 0).
last: Picks the last visible match (index -1).
atIndex: Picks an explicit 0-indexed position.
Example Usage
// Automatic matching (tag first, then text)
click("Submit")
click(auto("Submit"))
// Exact testTag matching
click(tag("login_button"))
// Target the 2nd matching element
click(text("Delete").atIndex(1))Content copied to clipboard