I am trying to check/uncheck a checkbox in my espresso test using:

```
 termsAndConditionsCheckbox.check(matches(isChecked()));
 termsAndConditionsCheckbox.perform(scrollTo()).perform(click());
 termsAndConditionsCheckbox.check(matches(isNotChecked()));

```

But getting error:

```
Error performing 'scroll to' on view
Caused by: java.lang.RuntimeException: Action will not be performed because the target view does not match one or more of the following constraints:
          (view has effective visibility=VISIBLE and is descendant of a: (is assignable from class: class android.widget.ScrollView or is assignable from class: class android.widget.HorizontalScrollView))
          Target view: "AppCompatCheckBox{id=2131689839, res-name=tnc_checkbox, visibility=VISIBLE, width=96, height=96, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-conn

```

Tried by removing scrollTo and only using click() .But still unable to perform the click.