How to catch a View with Tag by Espresso in Android?

前端 未结 2 1162
自闭症患者
自闭症患者 2021-01-18 01:34

I have a PinCodeView that extends LinearLayout. I have following code in my init() method. DigitEditText extends Ed

2条回答
  •  天涯浪人
    2021-01-18 02:14

    Since withTagValue needs an instance of org.hamcrest.Matcher as an argument, we can create a simple one using the Matcher.is method to find views with a certain tag in your expresso test:

    String tagValue = "lorem impsum";
    ViewInteraction viewWithTagVI = onView(withTagValue(is((Object) tagValue)));
    

提交回复
热议问题