# ViewFinder

# ViewFinder

Artifact: [androidx.test.espresso:espresso-core](https://developer.android.com/jetpack/androidx/releases/test-espresso)  
[View Source](https://cs.android.com/search?q=file:androidx/test/espresso/ViewFinder.java+class:androidx.test.espresso.ViewFinder)

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/androidx/test/espresso/ViewFinder "View this page in Java")


```
interface ViewFinder
```

<br />

Known direct subclasses  
[ViewFinderImpl](https://developer.android.com/reference/kotlin/androidx/test/espresso/base/ViewFinderImpl)  

|-------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------|
| [ViewFinderImpl](https://developer.android.com/reference/kotlin/androidx/test/espresso/base/ViewFinderImpl) | Implementation of [ViewFinder](https://developer.android.com/reference/kotlin/androidx/test/espresso/ViewFinder). |

*** ** * ** ***

Uses matchers to locate particular views within the view hierarchy.

## Summary

|                           ### Public functions                            |
|---------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [View](https://developer.android.com/reference/android/view/View.html)`!` | [getView](https://developer.android.com/reference/kotlin/androidx/test/espresso/ViewFinder#getView())`()` Immediately locates a single view within the provided view hierarchy. |

## Public functions

### getView

```
fun getView(): View!
```

Immediately locates a single view within the provided view hierarchy.

If multiple views match, or if no views match the appropriate exception is thrown.  

|                                  Returns                                  |
|---------------------------------------------------------------------------|---------------------------------------------------------------------|
| [View](https://developer.android.com/reference/android/view/View.html)`!` | A singular view which matches the matcher we were constructed with. |

|                                                                           Throws                                                                            |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------|
| [androidx.test.espresso.AmbiguousViewMatcherException](https://developer.android.com/reference/kotlin/androidx/test/espresso/AmbiguousViewMatcherException) | when multiple views match |
| [androidx.test.espresso.NoMatchingViewException](https://developer.android.com/reference/kotlin/androidx/test/espresso/NoMatchingViewException)             | when no views match.      |