簡體   English   中英

在Robotium中選擇微調框錯誤的項目

[英]Select Item of Spinner error in Robotium

我做一個包含Spinner的UI測試。 當我執行時:

  solo.clickOnView(solo.getView(R.id.spinner_editwebsite));

微調器可以顯示選項,但無法選擇選項,則測試停止!

然后發生錯誤!

我嘗試添加

`solo.pressSpinnerItem(0,1);` 

在...后面

`solo.clickOnView(solo.getView(R.id.spinner_editwebsite));`

但不行!

看一下這個答案:

看來他們現在把這些課都上了。 只是自己遇到了這個問題,但是找到了一種正確且通用的方法。

 // 0 is the first spinner in the layout View view1 = solo.getView(Spinner.class, 0); solo.clickOnView(view1); solo.scrollToTop(); // I put this in here so that it always keeps the list at start // select the 10th item in the spinner solo.clickOnView(solo.getView(TextView.class, 10)); 

來自: 如何使用Robotium單擊微調器中的第一項?

如您所見,嘗試使用的方法似乎已被棄用。 嘗試使用上面的代碼代替您的代碼。

希望對你有幫助

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM