There are multiple horizontal Recyclerview
on a screen. I want to perform a espresso click event on first item of first horizontal Recyclerview
. Please let me know how we can achieve it.
onView(withId(R.id.craousal_recyclerview))
.perform(RecyclerViewActions.actionOnItemAtPosition(1, new ClickOnImageView()));
public class ClickOnImageView implements ViewAction {
ViewAction click = click();
@Override
public Matcher<View> getConstraints() {
return click.getConstraints();
}
@Override
public String getDescription() {
return " click on custom image view";
}
@Override
public void perform(UiController uiController, View view) {
click.perform(uiController, view.findViewById(R.id.craousal_imageview));
}
It's giving me the following exception:
android.support.test.espresso.AmbiguousViewMatcherException