當我嘗試運行下面的測試時,我得到了AmbiguousViewMatcherException,我怎麼能從多個視圖中獲得預期的視圖。Espresso 2.0 AmbiguousViewMatcherException viewpager listviews
昂達(hasToString(startsWith( 「ALS」)))inAdapterView(allOf(withId(android.R.id.list)))atPosition(0).perform(點擊())。。
android.support.test.espresso.AmbiguousViewMatcherException: '(with id: android:id/list)' 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=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=0.0, child-count=3}
|
+->LinearLayout{id=-1, visibility=VISIBLE, width=1440, height=2392, 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=0.0, child-count=2}
|
+-->ViewStub{id=16909171, 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=16908290, res-name=content, visibility=VISIBLE, width=1440, height=2304, 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=88.0, child-count=1}
|
+--->ViewPager{id=2131558505, res-name=pager, visibility=VISIBLE, width=1440, height=2304, has-focus=false, 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=3}
|
+---->KayakPagerTabStrip{id=2131558506, res-name=tabstrip, visibility=VISIBLE, width=1440, height=112, 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=0.0, child-count=3}
|
+----->TextView{id=-1, visibility=VISIBLE, width=0, height=66, 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=0.0, y=25.0, text=, input-type=0, ime-target=false, has-links=false}
|
+----->TextView{id=-1, visibility=VISIBLE, width=56, height=66, 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=692.0, y=25.0, text=All, input-type=0, ime-target=false, has-links=false}
|
+----->TextView{id=-1, visibility=VISIBLE, width=201, height=66, 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=1239.0, y=25.0, text=Favorites, input-type=0, ime-target=false, has-links=false}
|
+---->FrameLayout{id=-1, visibility=VISIBLE, width=1440, height=2192, 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=112.0, child-count=2}
|
+----->LinearLayout{id=16711682, visibility=VISIBLE, width=1440, height=2192, 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, child-count=1}
|
+------>ProgressBar{id=-1, visibility=VISIBLE, width=266, height=266, 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=587.0, y=963.0}
|
+----->FrameLayout{id=16711683, 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, child-count=2}
|
+------>TextView{id=16711681, 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, text=, input-type=0, ime-target=false, has-links=false}
|
+ ------>的ListView {ID = 16908298,RES-名稱=列表中,能見度= VISIBLE, 寬度= 0,高度= 0,具有聚焦=假, has-focusable = false, has-window-focus = true,is-clickable = true,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,child-count = 0} **** MATCHES ****
|
+---->FrameLayout{id=-1, visibility=VISIBLE, width=1440, height=2192, 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=1440.0, y=112.0, child-count=2}
|
+----->LinearLayout{id=16711682, visibility=VISIBLE, width=1440, height=2192, 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, child-count=1}
|
+------>ProgressBar{id=-1, visibility=VISIBLE, width=266, height=266, 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=587.0, y=963.0}
|
+----->FrameLayout{id=16711683, 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, child-count=2}
|
+------>TextView{id=16711681, 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, text=, input-type=0, ime-target=false, has-links=false}
|
+ ------>的ListView {ID = 16908298,RES-名稱=列表中,能見度= VISIBLE, 寬度= 0,高度= 0,具有聚焦=假,具有-可聚焦= false, has-window-focus = true,is-clickable = true,is-enabled = true, is-focused = false,is-focusable = false,is-layout-requested = true, is-selected =假的,根是佈局請求=假, 具有輸入連接=假,X = 0.0,Y = 0.0,對兒童計數= 0} **** **** MATCHES
|
+->View{id=16908335, res-name=statusBarBackground, visibility=VISIBLE, width=1440, 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=0.0, y=0.0}
|
+->View{id=16908336, res-name=navigationBarBackground, visibility=VISIBLE, width=1440, height=168, 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=2392.0}
|
謝謝你的作品。 – Talha
不適用於我espresso 2.2.1 –