私は登録ダイアログを持っており、エスプレッソを使用してテストする必要がありますが、常に「階層内の複数のビューに一致します」というエラーが表示されます。登録ダイアログのエスプレッソ:階層内の複数のビューに一致します
パート:
<com.rey.material.widget.EditText
android:id="@+id/input_name"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_gravity="center"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="8dp"
android:hint="@string/name_hint_registration_dialog"
android:inputType="text"
android:textSize="18sp"
app:et_dividerColor="@color/my_primary"
app:et_dividerHeight="1dp"
app:et_labelEnable="true"
app:et_labelTextColor="@color/my_primary"
app:et_labelTextSize="14sp"
app:et_supportLines="1"/>
私の簡単なコード:
onView(withId(R.id.input_name))
.perform(typeText(numberEnter));
とエラー:
android.support.test.espresso.AmbiguousViewMatcherException:「(IDを持ちます: com.zf.openmaticsdetagtive:id/input_nameとコンテンツの説明を持つ) 'は、階層内の複数のビューに一致します。 問題ビューには、以下の「**** MATCHES ****」とマークされています。
+----->EditText{id=2131689737, res-name=input_name, desc=Name, visibility=VISIBLE, width=730, height=64, 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=true, editor-info=[inputType=0x1 imeOptions=0x8000005 privateImeOptions=null actionLabel=null actionId=0 initialSelStart=0 initialSelEnd=0 initialCapsMode=0x0 hintText=Name label=null packageName=null fieldId=0 fieldName=null extras=null ], x=21.0, y=96.0, child-count=2} ****MATCHES****
+------>InternalEditText{id=2131689737, res-name=input_name, desc=Name, visibility=VISIBLE, width=730, height=38, 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=true, editor-info=[inputType=0x1 imeOptions=0x8000005 privateImeOptions=null actionLabel=null actionId=0 initialSelStart=0 initialSelEnd=0 initialCapsMode=0x0 hintText=Name label=null packageName=null fieldId=0 fieldName=null extras=null ], x=0.0, y=26.0, text=, hint=Name, input-type=1, ime-target=true, has-links=false} ****MATCHES****
このIDの他の要素はありませんが、この問題の原因は何ですか? InternalEditTextとEditTextの違いは何ですか? com.rey.material.widget.EditTextを使用している可能性がありますか? ヘルプまたはヒントの事前のおかげで
ありがとうございますが、どうすればいいですか?それは同じように見えます。私はすでに "contentDescription"を追加して、onView(allIf(with.Id(R.id.input_name)、hasContentDescription())のようなビューを見つけようとしています...)しかし、今でもまだ結果があります – JohnA
ありがとう!あなたは私にアイデアを与え、私はonView(allOf(withId(R.id.input_name)、isClickable())を使用しました) – JohnA