私が使用して私のエスプレッソテストのチェックボックスのチェックを外す/チェックしようとしています:エスプレッソのページ要素に焦点を当てるには?
termsAndConditionsCheckbox.check(matches(isChecked()));
termsAndConditionsCheckbox.perform(scrollTo()).perform(click());
termsAndConditionsCheckbox.check(matches(isNotChecked()));
しかし、エラーを取得する:
(scrollToを除去してクリックするだけを使用してみましたError performing 'scroll to' on view
Caused by: java.lang.RuntimeException: Action will not be performed because the target view does not match one or more of the following constraints:
(view has effective visibility=VISIBLE and is descendant of a: (is assignable from class: class android.widget.ScrollView or is assignable from class: class android.widget.HorizontalScrollView))
Target view: "AppCompatCheckBox{id=2131689839, res-name=tnc_checkbox, visibility=VISIBLE, width=96, height=96, 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-conn
)にはまだできない.Butクリックを実行します。
'CheckBox'は' ScrollView'の中にありますか? –
いいえ、scrollTo()のようないくつかのオプションを試しました –
'scrollTo()'はターゲット要素が 'ScrollView'の子であることを期待しています。したがって、ビューが大きすぎて画面に収まらない場合は、それをレイアウトXML内の 'ScrollView'でラップします。すぐに完全な答えを書くだろう。 –