无法点击标签按钮

时间:2016-11-11 10:39:17

标签: android android-espresso android-espresso-recorder

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

textView1.perform(点击());

作品。

记录器记录

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

不起作用。有人帮助我不直接使用Text" Me"并使用ID(因为它是一个多语言应用程序)来接近它

1 个答案:

答案 0 :(得分:1)

只需将withId与TextView id:

一起使用即可
onView(allOf(withId(R.id.textViewId), isDisplayed())).perform(click());
相关问题