Судя по иерархии, похоже, что идентификатор теста cc-card-input
назначен оболочке, а не самому текстовому полю. В частности, в этом разделе показано, что:
+----------->CreditCardForm{id=243, visibility=VISIBLE, width=787, height=115, 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=true, is-selected=false, layout-params=android.view.ViewGroup$LayoutParams@ad170a6, tag=cc-card-input, root-is-layout-requested=false, has-input-connection=false, x=3.0, y=3.0, child-count=2}
|
+------------>LinearLayout{id=2131296373, res-name=cc_form_layout, visibility=VISIBLE, width=703, height=69, 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=true, is-selected=false, layout-params=android.widget.RelativeLayout$LayoutParams@ce0b53d, tag=null, root-is-layout-requested=false, has-input-connection=false, x=42.0, y=21.0, child-count=2}
|
+------------->FrameLayout{id=-1, visibility=VISIBLE, width=94, height=53, 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=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@5c61800, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=8.0, child-count=2}
|
+-------------->ImageView{id=-1, visibility=VISIBLE, width=84, height=53, 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, layout-params=android.widget.FrameLayout$LayoutParams@a86839, tag=null, root-is-layout-requested=false, has-input-connection=false, x=10.0, y=0.0}
|
+-------------->ImageView{id=-1, 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, layout-params=android.widget.FrameLayout$LayoutParams@c8bee7e, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0}
|
+------------->CreditCardEntry{id=2131296370, res-name=cc_entry, visibility=VISIBLE, width=609, height=69, 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=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@e74b42c, tag=null, root-is-layout-requested=false, has-input-connection=false, x=94.0, y=0.0, child-count=1}
|
+-------------->LinearLayout{id=2131296371, res-name=cc_entry_internal, visibility=VISIBLE, width=1632, height=63, 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=true, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@1f4748a, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=4}
|
+--------------->CreditCardText{id=2131296368, res-name=cc_card, visibility=VISIBLE, width=1080, height=63, 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=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@d53dafb, tag=null, root-is-layout-requested=false, has-input-connection=true, editor-info=[inputType=0x2 imeOptions=0x10000006 privateImeOptions=null actionLabel=null actionId=0 initialSelStart=0 initialSelEnd=0 initialCapsMode=0x0 hintText=1234 5678 9012 3456 label=null packageName=null fieldId=0 fieldName=null extras=null ], x=0.0, y=0.0, text=, hint=1234 5678 9012 3456, input-type=2, ime-target=true, has-links=false}
|
+--------------->TextView{id=2131296374, res-name=cc_four_digits, visibility=VISIBLE, width=104, height=63, 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=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@28ee718, tag=null, root-is-layout-requested=false, has-input-connection=false, x=1080.0, y=0.0, text=4242, input-type=0, ime-target=false, has-links=false}
(просмотрите тег, связанный с представлением CreditCardForm
)
Хотя он действительно видим, вы можете эффективно typeText()
только над представлениями, которые текстовые вводы (а именно, когда открывается программная клавиатура).
Перестановка идентификатора теста в представление, способное эффективно принимать ввод, решит его (мне трудно сказать, какой именно, который соответствует иерархии, как взгляды кажутся заказными).