複数のオプションを試しました。どちらも私のために働いた。 uiautomatorを使ってスピナーの要素を選択することは可能ですか?uiautomatorでスピナー要素を選択
コード例:
UiObject spinner = mDevice.findObject(new UiSelector().className("android.widget.Spinner")
.instance(0));
try {
Integer cnt = spinner.getChildCount();
if (cnt > 0) {
UiObject item = spinner.getChild(new UiSelector().index(cnt-1));
item.click();
}
} catch (UiObjectNotFoundException e){}
UIオートメーションを使用する代わりに、エスプレッソライブラリを使用する必要があります。http://stackoverflow.com/questions/31420839/android-espresso-check-selected-spinner-text –