RunTimeException in Android espresso when selecting spinner in dialog

前端 未结 4 678
Happy的楠姐
Happy的楠姐 2021-01-12 03:14

I have an activity where some dialog is openend. On this dialog there is a spinner. I want to select a specific value in this spinner, but I get following exception:

相关标签:
4条回答
  • 2021-01-12 03:54

    Try this:

    onData(allOf(is(instanceOf(String.class)), is(value)))
        .inRoot(isPlatformPopup()).perform(click());
    
    0 讨论(0)
  • 2021-01-12 04:02

    I had the same error when I tried to match an item inside a spinner inside a dialog-fragment. This helped:

    onView(withText(value)).inRoot(isPlatformPopup()).perform(click());
    
    0 讨论(0)
  • 2021-01-12 04:02

    I had the same error when I tried to match a text inside an alert dialog. This helped:

    onView(withText(text)).inRoot(RootMatchers.isDialog()).perform(click());
    
    0 讨论(0)
  • 2021-01-12 04:05

    I have same issue on Pixel 2 XL with Android Pie and I have to add

    .inRoot(isPlatformPopup())
    

    when for EditText appears credentials autofill spinner

    0 讨论(0)
提交回复
热议问题