クラスエイリアス
クラスエイリアス は要素をフィルターするための特別なフィルターです。
クラスエイリアス | 対応するclassName (Android) | 対応するtype (iOS) |
---|---|---|
label | android.widget.TextView | XCUIElementTypeStaticText |
input | android.widget.EditText | XCUIElementTypeTextField XCUIElementTypeSecureTextField |
image | android.widget.ImageView | XCUIElementTypeImage |
button | android.widget.Button android.widget.ImageButton android.widget.CheckBox |
XCUIElementTypeButton |
switch | android.widget.Switch | XCUIElementTypeSwitch |
widget | (上記のすべて) | (上記のすべて) |
scrollable | N/A (scrollable=“true” が適用されます) |
XCUIElementTypeTextField XCUIElementTypeSecureTextField |
クラスエイリアス は各プラットフォームの実装を隠蔽して取り扱いを容易にします。
例
it.tap(".button&&Submit")
上記は実行時に以下のように展開されます。
Android
it.tap(".(android.widget.Button|android.widget.ImageButton|android.widget.CheckBox)&&Submit")
iOS
it.tap(".XCUIElementTypeButton&&Submit")
クラスエイリアスを使用すると特定のclassName(またはtype)を記述するよりも記述が簡潔になります。