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

Android Espresso BaseMatcher匹配的方法不会在屏幕上的所有视图中循环,android,android-espresso,Android,Android Espresso,Espresso BaseMatcher匹配的方法不会在屏幕上的所有视图中循环 相反,它只是在当前窗口UI元素中循环 示例,如果我有一个带有对话框窗口的活动 它只在对话框UI元素中循环 new BaseMatcher<View>() { @Override public void describeTo(Description description) { description.appendTex

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;
             }

         };
newbasematcher(){
@凌驾
公共无效说明(说明){
description.appendText(String.format(“查找XPath为%s的元素”,XPath));
}
@凌驾
公共布尔匹配(对象项){
//在这里,我正在检查活动内部的匹配视图
//该项始终来自对话框
//活动视图不是此方法调用的一部分
返回条件;
}
};

你能添加你的浓缩咖啡代码吗?最好是作为?@MDNaseemAshraf谢谢我添加了我的matcher代码你能添加你的浓缩咖啡代码吗?最好是作为?@MDNaseemAshraf谢谢我添加了我的matcher代码