ViewInteraction textView1 = onView(allOf(withText("Me"), isDisplayed()));
textView1.perform(点击());
。
The Recorder Records
ViewInteraction relativeLayout = onView(
allOf(withClassName(is("android.widget.RelativeLayout")),
withParent(withId(android.R.id.tabs)),
isDisplayed()));
relativeLayout.perform(click());
是行不通的。这将是很好的,有人帮助我不直接使用文本"我"和接近它与ID(因为它是一个多语言的应用程序)
使用withId和TextView id:
onView(allOf(withId(R.id.textViewId), isDisplayed())).perform(click());