I am new to Espresso at this point and I am getting this Exception:
android.support.test.espresso.AmbiguousViewMatcherException: 'with id: android:id/checkbox' matches multiple views in the hierarchy.
This happens when trying to check for a non checked box: onView(withId(android.R.id.checkbox)).check(matches(not(isChecked())));
My understanding is that I have 3 checkboxes and for some reason they all match this description, my question becomes: how can I differentiate between the checkboxes?
This is the error log that I am getting:
android.support.test.espresso.AmbiguousViewMatcherException: 'with id: android:id/checkbox' matches multiple views in the hierarchy.
Problem views are marked with '****MATCHES****' below.
View Hierarchy:
+>DecorView{id=-1, visibility=VISIBLE, width=1440, height=2560, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=3}
|
+->LinearLayout{id=-1, visibility=VISIBLE, width=1440, height=2392, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2}
|
+-->ViewStub{id=16909225, res-name=action_mode_bar_stub, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0}
|
+-->FrameLayout{id=-1, visibility=VISIBLE, width=1440, height=2308, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=84.0, child-count=1}
|
+--->ActionBarOverlayLayout{id=2131492999, res-name=decor_content_parent, visibility=VISIBLE, width=1440, height=2308, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2}
|
+---->ContentFrameLayout{id=16908290, res-name=content, visibility=VISIBLE, width=1440, height=2112, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=196.0, child-count=1}
|
+----->ScrollView{id=-1, visibility=VISIBLE, width=1440, height=2112, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1}
|
+------>LinearLayout{id=-1, visibility=VISIBLE, width=1440, height=1162, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=5}
|
+------->FontedTextView{id=-1, visibility=VISIBLE, width=1334, height=88, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=53.0, y=105.0, text=Paperless Delivery & Data Sharing, input-type=0, ime-target=false, has-links=false}
|
+------->FontedTextView{id=-1, desc=Check/un-check each box to change your preferences then tap save., visibility=VISIBLE, width=1334, height=138, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=53.0, y=263.0, text=Check/un-check each box to change your preferences then tap save., input-type=0, ime-target=false, has-links=false}
|
+------->View{id=-1, visibility=VISIBLE, width=1440, height=1, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=471.0}
|
+------->LinearLayout{id=2131493744, res-name=settings_prefs_consents_layout, visibility=VISIBLE, width=1440, height=689, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=472.0, child-count=3}
|
+-------->LinearLayout{id=2131493745, res-name=meh, desc=Entitlement 1 checked. Description 1. Read more., visibility=VISIBLE, width=1440, height=191, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=32.0, child-count=2}
|
+--------->AppCompatCheckBox{id=16908289, res-name=checkbox, visibility=VISIBLE, width=103, height=102, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=true, is-focusable=true, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=53.0, y=53.0, text=, input-type=0, ime-target=true, has-links=false, is-checked=true} ****MATCHES****
|
+--------->LinearLayout{id=-1, visibility=VISIBLE, width=1196, height=138, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=191.0, y=53.0, child-count=2}
|
+---------->FontedTextView{id=16908308, res-name=text1, visibility=VISIBLE, width=1196, height=69, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=Entitlement 1, input-type=0, ime-target=false, has-links=false}
|
+---------->FontedTextView{id=16908309, res-name=text2, visibility=VISIBLE, width=1196, height=69, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=69.0, text=Description 1 Read more., input-type=0, ime-target=false, has-links=false}
|
+-------->LinearLayout{id=2131493745, res-name=meh, desc=Entitlement 2 unchecked. Description 2. Read more., visibility=VISIBLE, width=1440, height=191, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=223.0, child-count=2}
|
+--------->AppCompatCheckBox{id=16908289, res-name=checkbox, visibility=VISIBLE, width=102, height=102, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=53.0, y=53.0, text=, input-type=0, ime-target=false, has-links=false, is-checked=false} ****MATCHES****
|
+--------->LinearLayout{id=-1, visibility=VISIBLE, width=1197, height=138, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=190.0, y=53.0, child-count=2}
|
+---------->FontedTextView{id=16908308, res-name=text1, visibility=VISIBLE, width=1197, height=69, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=Entitlement 2, input-type=0, ime-target=false, has-links=false}
|
+---------->FontedTextView{id=16908309, res-name=text2, visibility=VISIBLE, width=1197, height=69, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=69.0, text=Description 2 Read more., input-type=0, ime-target=false, has-links=false}
|
+-------->LinearLayout{id=2131493745, res-name=meh, desc=Entitlement 3 checked. Description 3. Read more., visibility=VISIBLE, width=1440, height=191, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=414.0, child-count=2}
|
+--------->AppCompatCheckBox{id=16908289, res-name=checkbox, visibility=VISIBLE, width=103, height=102, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=53.0, y=53.0, text=, input-type=0, ime-target=false, has-links=false, is-checked=true} ****MATCHES****
|
+--------->LinearLayout{id=-1, visibility=VISIBLE, width=1196, height=138, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=191.0, y=53.0, child-count=2}
|
+---------->FontedTextView{id=16908308, res-name=text1, visibility=VISIBLE, width=1196, height=69, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, text=Entitlement 3, input-type=0, ime-target=false, has-links=false}
Aucun commentaire:
Enregistrer un commentaire