# NoMatchingViewException

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/NoMatchingViewException.java+class:androidx.test.espresso.NoMatchingViewException)

*** ** * ** ***


```
public final class NoMatchingViewException extends RuntimeException implements RootViewException
```

<br />

|---|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||||
| ↳ | [kotlin.Throwable](https://developer.android.com/reference/java/lang/Throwable.html) ||||
|   | ↳ | [java.lang.Exception](https://developer.android.com/reference/java/lang/Exception.html) |||
|   |   | ↳ | [java.lang.RuntimeException](https://developer.android.com/reference/java/lang/RuntimeException.html) ||
|   |   |   | ↳ | [androidx.test.espresso.NoMatchingViewException](https://developer.android.com/reference/androidx/test/espresso/NoMatchingViewException) |

*** ** * ** ***

Indicates that a given matcher did not match any elements in the view hierarchy.

Contains details about the matcher and the current view hierarchy to aid in debugging.

Since this is usually an unrecoverable error this exception is a runtime exception.

References to the view and failing matcher are purposefully not included in the state of this object - since it will most likely be created on the UI thread and thrown on the instrumentation thread, it would be invalid to touch the view on the instrumentation thread. Also the view hierarchy may have changed since exception creation (leading to more confusion).

## Summary

| ### Nested types |
|---|
| `public class https://developer.android.com/reference/androidx/test/espresso/NoMatchingViewException.Builder` Builder for `https://developer.android.com/reference/androidx/test/espresso/NoMatchingViewException`. |

| ### Public fields |
|---|---|
| `https://developer.android.com/reference/android/view/View.html` | `https://developer.android.com/reference/androidx/test/espresso/NoMatchingViewException#rootView()` |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/android/view/View.html` | `https://developer.android.com/reference/androidx/test/espresso/NoMatchingViewException#getRootView()()` Returns the root view where this exception is thrown. |
| `https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/test/espresso/NoMatchingViewException#getViewMatcherDescription()()` Returns a string description of the ViewMatcher that did not match any view in the hierarchy. |

### Inherited methods

From [java.lang.Throwable](https://developer.android.com/reference/java/lang/Throwable.html) `synchronized final void` `https://developer.android.com/reference/java/lang/Throwable.html#addSuppressed(java.lang.Throwable)(https://developer.android.com/reference/java/lang/Throwable.html exception)` `synchronized https://developer.android.com/reference/java/lang/Throwable.html` `https://developer.android.com/reference/java/lang/Throwable.html#fillInStackTrace()()` `synchronized https://developer.android.com/reference/java/lang/Throwable.html` `https://developer.android.com/reference/java/lang/Throwable.html#getCause()()` `https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/java/lang/Throwable.html#getLocalizedMessage()()` `https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/java/lang/Throwable.html#getMessage()()` `StackTraceElement[]` `https://developer.android.com/reference/java/lang/Throwable.html#getStackTrace()()` `synchronized final Throwable[]` `https://developer.android.com/reference/java/lang/Throwable.html#getSuppressed()()` `synchronized https://developer.android.com/reference/java/lang/Throwable.html` `https://developer.android.com/reference/java/lang/Throwable.html#initCause(java.lang.Throwable)(https://developer.android.com/reference/java/lang/Throwable.html cause)` `void` `https://developer.android.com/reference/java/lang/Throwable.html#printStackTrace()()` `void` `https://developer.android.com/reference/java/lang/Throwable.html#setStackTrace(java.lang.StackTraceElement[])(StackTraceElement[] stackTrace)` `https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/java/lang/Throwable.html#toString()()`

## Public fields

### rootView

```
public View rootView
```

## Public methods

### getRootView

```
public View getRootView()
```

Returns the root view where this exception is thrown.

### getViewMatcherDescription

```
public String getViewMatcherDescription()
```

Returns a string description of the ViewMatcher that did not match any view in the hierarchy.