我试图检查,看是否有视图与长者preSSO。下面是一些伪code显示什么我想:
I am trying to check to see if a view is displayed with Espresso. Here is some pseudo code to show what I am trying:
if (!Espresso.onView(withId(R.id.someID)).check(doesNotExist()){
// then do something
} else {
// do nothing, or what have you
}
但我的问题是。检查(doesNotExist())
不返回布尔值。这只是一个断言。随着UiAutomator我能够只是做一些事情,像这样:
But my problem is .check(doesNotExist())
does not return boolean. It is just an assertion. With UiAutomator I was able to just do something like so:
if (UiAutomator.getbyId(SomeId).exists){
.....
}
我发现了这一点; 查线46 。还没有找到如何使用它。
I found this; check line 46. Still can't find out how to use it.
我们需要这种功能,我结束了实施它如下:
We need that functionality and I ended up implementing it below:
https://github.com/marcosdiez/es$p$psso_clone
if(onView(withText("click OK to Continue")).exists()){
doSomething();
} else {
doSomethingElse();
}
我希望这是对您有用。
I hope it is useful for you.