0
ViewInteraction textView1 = onView(allOf(withText("Me"), isDisplayed())); 

textView1.perform(click());无法点击选项卡按钮

作品。

记录仪的记录

ViewInteraction relativeLayout = onView(
      allOf(withClassName(is("android.widget.RelativeLayout")), 
        withParent(withId(android.R.id.tabs)), 
        isDisplayed())); 
    relativeLayout.perform(click()); 

不工作。这将是很好,有人帮我不能直接使用Text“我”,并与ID接近它(因为它是一个多语种的应用程序)

+0

你能提供完整的代码 –

回答

1

只要使用withId与TextView的ID:

onView(allOf(withId(R.id.textViewId), isDisplayed())).perform(click());