---
title: "filterToOne"
description: "Expects to return exactly one node matching the given [matcher].

Any subsequent operation on its result will expect exactly one element found (unless
[SemanticsNodeInteraction.assertDoesNotExist] is used) and will throw [AssertionError] if no
element is found."
type: "function"
---

<div class='type'>Function</div>


<a id='references'></a>
<div class='sourceset sourceset-common'>Common</div>


```kotlin
@CheckResult
fun SemanticsNodeInteractionCollection.filterToOne(
    matcher: SemanticsMatcher
): SemanticsNodeInteraction
```


Expects to return exactly one node matching the given `matcher`.

Any subsequent operation on its result will expect exactly one element found (unless
`SemanticsNodeInteraction.assertDoesNotExist` is used) and will throw `AssertionError` if no
element is found.

#### Parameters

| | |
| --- | --- |
| matcher | Matcher to use for the filtering. |




