Espresso BaseMatcher匹配方法不会在屏幕上的所有视图中循环

时间:2019-04-02 09:03:47

标签: android android-espresso viewmatcher

Espresso BaseMatcher匹配方法不会在屏幕上的所有视图中循环 相反,它仅在当前窗口UI元素中循环

例如我有一个活动以及对话框窗口的示例 它仅遍历对话框UI元素。

 new BaseMatcher<View>() {
             @Override
             public void describeTo(Description description) {
                 description.appendText(String.format("Looked for element with XPath %s", xpath));
             }

             @Override
             public boolean matches(Object item) {
                 //here I am checking for matched view inside activity
                 // the item is always from dialog
                 //activity views are not part of this matches method calls
                 return condition;
             }

         };

0 个答案:

没有答案