在 perform(...) 期间获取 NoMatchingViewException,但在前面的 check(...)
Getting NoMatchingViewException during perform(...), but not the preceding check(...)
我有这个简单的 Espresso 交互:
onView(atIndex(withId(R.id.editTextTextWidget), 0)).inRoot(authViewRootMatcher)
.check(matches(allOf(isDisplayed(), isEnabled())))
.perform(typeText("1"));
check(matches(allOf(isDisplayed(), isEnabled())))
按预期通过,但下面的perform(typeText("1"))
没有。我想不通为什么,我这辈子都想不通。
所以,我不敢相信我会问这个问题,但是我如何以 Android 的名义使用 Espresso
将文本输入到我的 EditText
中,其 ID 是R.id.editTextTextWidget
?
我通过拆分 check(...)
调用和 perform(...)
调用解决了这个问题:
onView(atIndex(withId(R.id.editTextTextWidget), 0)).inRoot(authViewRootMatcher)
.check(matches(allOf(isDisplayed(), isEnabled())));
onView(atIndex(withId(R.id.editTextTextWidget), 0)).inRoot(authViewRootMatcher)
.perform(typeText("1"));
出于某种原因,这行得通,而原来的行不通。 #GooglePlz
我有这个简单的 Espresso 交互:
onView(atIndex(withId(R.id.editTextTextWidget), 0)).inRoot(authViewRootMatcher)
.check(matches(allOf(isDisplayed(), isEnabled())))
.perform(typeText("1"));
check(matches(allOf(isDisplayed(), isEnabled())))
按预期通过,但下面的perform(typeText("1"))
没有。我想不通为什么,我这辈子都想不通。
所以,我不敢相信我会问这个问题,但是我如何以 Android 的名义使用 Espresso
将文本输入到我的 EditText
中,其 ID 是R.id.editTextTextWidget
?
我通过拆分 check(...)
调用和 perform(...)
调用解决了这个问题:
onView(atIndex(withId(R.id.editTextTextWidget), 0)).inRoot(authViewRootMatcher)
.check(matches(allOf(isDisplayed(), isEnabled())));
onView(atIndex(withId(R.id.editTextTextWidget), 0)).inRoot(authViewRootMatcher)
.perform(typeText("1"));
出于某种原因,这行得通,而原来的行不通。 #GooglePlz