# SemanticsNodeInteractionCollection

Artifact: [androidx.compose.ui:ui-test](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/test/SemanticsNodeInteraction.kt+class:androidx.compose.ui.test.SemanticsNodeInteractionCollection) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Common/AllAndroid/JVM
- Cmn

  ```
  class SemanticsNodeInteractionCollection
  ```

*** ** * ** ***

Represents a collection of semantics nodes and the path to fetch them from the semantics tree. One can interact with these nodes by performing assertions such as `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.SemanticsNodeInteractionCollection).assertCountEquals(kotlin.Int)`, or navigate to other nodes such as `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection#get(kotlin.Int)`.

An instance of `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection` can be obtained from `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionsProvider#onAllNodes(androidx.compose.ui.test.SemanticsMatcher,kotlin.Boolean)` and convenience methods that use a specific filter, such as `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.SemanticsNodeInteractionsProvider).onAllNodesWithText(kotlin.String,kotlin.Boolean,kotlin.Boolean,kotlin.Boolean)`.

For example, here is how you verify that there are exactly two clickable items:

```kotlin
import androidx.compose.ui.test.assertCountEquals
import androidx.compose.ui.test.hasClickAction

composeTestRule.onAllNodes(hasClickAction()).assertCountEquals(2)
```

## Summary

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection#SemanticsNodeInteractionCollection(androidx.compose.ui.test.TestContext,kotlin.Boolean,androidx.compose.ui.test.SemanticsMatcher)( testContext: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/TestContext, useUnmergedTree: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, matcher: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher )` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection#SemanticsNodeInteractionCollection(androidx.compose.ui.test.TestContext,kotlin.Boolean,androidx.compose.ui.test.SemanticsSelector)( testContext: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/TestContext, useUnmergedTree: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, selector: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsSelector )` | Cmn |

| ### Public functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/semantics/SemanticsNode>` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection#fetchSemanticsNodes(kotlin.Boolean,kotlin.String)( atLeastOneRootRequired: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, errorMessageOnFail: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html? )` Returns the semantics nodes captured by this object. | Cmn |
| `operator https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteraction` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection#get(kotlin.Int)(index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Retrieve node at the given index of this collection. | Cmn |

| ### Extension functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection.https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection#(androidx.compose.ui.test.SemanticsNodeInteractionCollection).tryPerformAccessibilityChecks()()` Tries to perform accessibility checks on the current screen. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection.https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection#(androidx.compose.ui.test.SemanticsNodeInteractionCollection).assertAll(androidx.compose.ui.test.SemanticsMatcher)( matcher: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher )` Asserts that all the nodes in this collection satisfy the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.SemanticsNodeInteractionCollection).assertAll(androidx.compose.ui.test.SemanticsMatcher)`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection.https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection#(androidx.compose.ui.test.SemanticsNodeInteractionCollection).assertAny(androidx.compose.ui.test.SemanticsMatcher)( matcher: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher )` Asserts that this collection contains at least one element that satisfies the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.SemanticsNodeInteractionCollection).assertAny(androidx.compose.ui.test.SemanticsMatcher)`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection.https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection#(androidx.compose.ui.test.SemanticsNodeInteractionCollection).assertCountEquals(kotlin.Int)( expectedSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Asserts that this collection of nodes is equal to the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.SemanticsNodeInteractionCollection).assertCountEquals(kotlin.Int)`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection` | `@https://developer.android.com/reference/kotlin/androidx/compose/ui/test/ExperimentalTestApi https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection.[invokeGlobalAssertions](https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection#(androidx.compose.ui.test.SemanticsNodeInteractionCollection).invokeGlobalAssertions())()` **This function is deprecated.** This API has been removed and its intended usage to run accessibility checks can now be done via \`SemanticsNodeInteraction.tryPerformAccessibilityChecks()\` | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection.https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection#(androidx.compose.ui.test.SemanticsNodeInteractionCollection).printToLog(kotlin.String,kotlin.Int)( tag: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, maxDepth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Prints all the semantics nodes information into logs (as debug level). | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection.https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection#(androidx.compose.ui.test.SemanticsNodeInteractionCollection).printToString(kotlin.Int)(maxDepth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Prints all the semantics nodes information it holds into string. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection.https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection#(androidx.compose.ui.test.SemanticsNodeInteractionCollection).filter(androidx.compose.ui.test.SemanticsMatcher)(matcher: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher)` Returns all the nodes matching the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.SemanticsNodeInteractionCollection).filter(androidx.compose.ui.test.SemanticsMatcher)`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteraction` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection.https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection#(androidx.compose.ui.test.SemanticsNodeInteractionCollection).filterToOne(androidx.compose.ui.test.SemanticsMatcher)( matcher: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher )` Expects to return exactly one node matching the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.SemanticsNodeInteractionCollection).filterToOne(androidx.compose.ui.test.SemanticsMatcher)`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteraction` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection.https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection#(androidx.compose.ui.test.SemanticsNodeInteractionCollection).onFirst()()` Returns the first node in this collection. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteraction` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection.https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection#(androidx.compose.ui.test.SemanticsNodeInteractionCollection).onLast()()` Returns the last node in this collection. | Cmn |

## Public constructors

### SemanticsNodeInteractionCollection

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
SemanticsNodeInteractionCollection(
    testContext: TestContext,
    useUnmergedTree: Boolean,
    matcher: SemanticsMatcher
)
```

### SemanticsNodeInteractionCollection

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
SemanticsNodeInteractionCollection(
    testContext: TestContext,
    useUnmergedTree: Boolean,
    selector: SemanticsSelector
)
```

## Public functions

### fetchSemanticsNodes

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
fun fetchSemanticsNodes(
    atLeastOneRootRequired: Boolean = true,
    errorMessageOnFail: String? = null
): List<SemanticsNode>
```

Returns the semantics nodes captured by this object.

Note: Accessing this object involves synchronization with your UI. If you are accessing this multiple times in one atomic operation, it is better to cache the result instead of calling this API multiple times.

| Parameters |
|---|---|
| `atLeastOneRootRequired: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = true` | Whether to throw an error in case there is no compose content in the current test app. |
| `errorMessageOnFail: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html? = null` | Custom error message to append when this fails to retrieve the nodes. |

### get

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
operator fun get(index: Int): SemanticsNodeInteraction
```

Retrieve node at the given index of this collection.

Any subsequent operation on its result will expect exactly one element found (unless `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteraction#assertDoesNotExist()` is used) and will throw `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-assertion-error/index.html` if none or more than one element is found.

## Extension functions

### SemanticsNodeInteractionCollection.tryPerformAccessibilityChecks

Cmn Artifact: [androidx.compose.ui:ui-test](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/test/Actions.kt+function:tryPerformAccessibilityChecks)

```
fun SemanticsNodeInteractionCollection.tryPerformAccessibilityChecks(): SemanticsNodeInteractionCollection
```

Tries to perform accessibility checks on the current screen. This will only actually do something if (1) accessibility checks are enabled and (2) accessibility checks are implemented for the platform on which the test runs.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-assertion-error/index.html` | if accessibility problems are found |

### SemanticsNodeInteractionCollection.assertAll

Cmn Artifact: [androidx.compose.ui:ui-test](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/test/Assertions.kt+function:assertAll)

```
fun SemanticsNodeInteractionCollection.assertAll(
    matcher: SemanticsMatcher
): SemanticsNodeInteractionCollection
```

Asserts that all the nodes in this collection satisfy the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.SemanticsNodeInteractionCollection).assertAll(androidx.compose.ui.test.SemanticsMatcher)`.

This passes also for empty collections.

| Parameters |
|---|---|
| `matcher: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher` | Matcher that has to be satisfied by all the nodes in the collection. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-assertion-error/index.html` | if the collection contains at least one element that does not satisfy the given matcher. |

### SemanticsNodeInteractionCollection.assertAny

Cmn Artifact: [androidx.compose.ui:ui-test](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/test/Assertions.kt+function:assertAny)

```
fun SemanticsNodeInteractionCollection.assertAny(
    matcher: SemanticsMatcher
): SemanticsNodeInteractionCollection
```

Asserts that this collection contains at least one element that satisfies the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.SemanticsNodeInteractionCollection).assertAny(androidx.compose.ui.test.SemanticsMatcher)`.

| Parameters |
|---|---|
| `matcher: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher` | Matcher that has to be satisfied by at least one of the nodes in the collection. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-assertion-error/index.html` | if not at least one matching node was node. |

### SemanticsNodeInteractionCollection.assertCountEquals

Cmn Artifact: [androidx.compose.ui:ui-test](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/test/Assertions.kt+function:assertCountEquals)

```
fun SemanticsNodeInteractionCollection.assertCountEquals(
    expectedSize: Int
): SemanticsNodeInteractionCollection
```

Asserts that this collection of nodes is equal to the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.SemanticsNodeInteractionCollection).assertCountEquals(kotlin.Int)`.

Provides a detailed error message on failure.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-assertion-error/index.html` | if the size is not equal to `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.SemanticsNodeInteractionCollection).assertCountEquals(kotlin.Int)` |

### SemanticsNodeInteractionCollection.invokeGlobalAssertions

Cmn Artifact: [androidx.compose.ui:ui-test](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/test/GlobalAssertions.kt+function:invokeGlobalAssertions)

```
@ExperimentalTestApi
fun SemanticsNodeInteractionCollection.[invokeGlobalAssertions](https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection#(androidx.compose.ui.test.SemanticsNodeInteractionCollection).invokeGlobalAssertions())(): SemanticsNodeInteractionCollection
```

> [!CAUTION]
> **This function is deprecated.**   
> This API has been removed and its intended usage to run accessibility checks can now be done via \`SemanticsNodeInteraction.tryPerformAccessibilityChecks()\`, use this instead:
>
> ```kotlin
> onFirst().tryPerformAccessibilityChecks()
> ```

Executes all of the assertions registered by `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#addGlobalAssertion(kotlin.String,kotlin.Function1)`, each of which will receive the first node of this collection. This may be useful in a custom test action.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection` | the `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteractionCollection` that is the receiver of this method |

### SemanticsNodeInteractionCollection.printToLog

Cmn Artifact: [androidx.compose.ui:ui-test](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/test/Output.kt+function:printToLog)

```
fun SemanticsNodeInteractionCollection.printToLog(
    tag: String,
    maxDepth: Int = 0
): Unit
```

Prints all the semantics nodes information into logs (as debug level).

By default this does not print nodes sub-hierarchies. This can be changed by setting a custom max depth in `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.SemanticsNodeInteractionCollection).printToLog(kotlin.String,kotlin.Int)`.

Note that this will fetch the latest snapshot of nodes it sees in the hierarchy for the IDs it collected before. So the output can change over time if the tree changes.

| Parameters |
|---|---|
| `tag: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The tag to be used in the log messages. Must not be negative. |
| `maxDepth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = 0` | Max depth of the nodes in hierarchy to print. Zero will print nodes in this collection only. |

### SemanticsNodeInteractionCollection.printToString

Cmn Artifact: [androidx.compose.ui:ui-test](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/test/Output.kt+function:printToString)

```
fun SemanticsNodeInteractionCollection.printToString(maxDepth: Int = 0): String
```

Prints all the semantics nodes information it holds into string.

By default this does not print nodes sub-hierarchies. This can be changed by setting a custom max depth in `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.SemanticsNodeInteractionCollection).printToString(kotlin.Int)`.

Note that this will fetch the latest snapshot of nodes it sees in the hierarchy for the IDs it collected before. So the output can change over time if the tree changes.

| Parameters |
|---|---|
| `maxDepth: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = 0` | Max depth of the nodes in hierarchy to print. Zero will print nodes in this collection only. Must not be negative. |

### SemanticsNodeInteractionCollection.filter

Cmn Artifact: [androidx.compose.ui:ui-test](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/test/Selectors.kt+function:filter)

```
fun SemanticsNodeInteractionCollection.filter(matcher: SemanticsMatcher): SemanticsNodeInteractionCollection
```

Returns all the nodes matching the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.SemanticsNodeInteractionCollection).filter(androidx.compose.ui.test.SemanticsMatcher)`.

| Parameters |
|---|---|
| `matcher: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher` | Matcher to use for the filtering. |

### SemanticsNodeInteractionCollection.filterToOne

Cmn Artifact: [androidx.compose.ui:ui-test](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/test/Selectors.kt+function:filterToOne)

```
fun SemanticsNodeInteractionCollection.filterToOne(
    matcher: SemanticsMatcher
): SemanticsNodeInteraction
```

Expects to return exactly one node matching the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.test.SemanticsNodeInteractionCollection).filterToOne(androidx.compose.ui.test.SemanticsMatcher)`.

Any subsequent operation on its result will expect exactly one element found (unless `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteraction#assertDoesNotExist()` is used) and will throw `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-assertion-error/index.html` if no element is found.

| Parameters |
|---|---|
| `matcher: https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsMatcher` | Matcher to use for the filtering. |

### SemanticsNodeInteractionCollection.onFirst

Cmn Artifact: [androidx.compose.ui:ui-test](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/test/Selectors.kt+function:onFirst)

```
fun SemanticsNodeInteractionCollection.onFirst(): SemanticsNodeInteraction
```

Returns the first node in this collection.

Any subsequent operation on its result will expect exactly one element found (unless `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteraction#assertDoesNotExist()` is used) and will throw `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-assertion-error/index.html` if no element is found.

### SemanticsNodeInteractionCollection.onLast

Cmn Artifact: [androidx.compose.ui:ui-test](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/test/Selectors.kt+function:onLast)

```
fun SemanticsNodeInteractionCollection.onLast(): SemanticsNodeInteraction
```

Returns the last node in this collection.

Any subsequent operation on its result will expect exactly one element found (unless `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/SemanticsNodeInteraction#assertDoesNotExist()` is used) and will throw `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-assertion-error/index.html` if no element is found.