Espresso - typeText not working

前端 未结 10 1094
名媛妹妹
名媛妹妹 2021-02-13 22:20

I\'m trying to type some text inside an EditText:


    public void testSearch() {
          onView(withId(R.id.titleInput)).perform(typeText(\"Engineer\"));
          


        
10条回答
  •  无人及你
    2021-02-13 22:37

    Had the same issue using Espresso 2. As a workaround I'm using replaceText instead of typeText.

    public void testSearch() {
          onView(withId(R.id.titleInput)).perform(click(), replaceText("Engineer"));
          onView(withId(R.id.titleInput)).check(matches(withText("Engineer")));
    }
    

提交回复
热议问题