[英]Select Item of Spinner error in Robotium
I make a UI Test that contains a Spinner
. 我做一个包含
Spinner
的UI测试。 When I execute: 当我执行时:
solo.clickOnView(solo.getView(R.id.spinner_editwebsite));
The spinner can show the options,but can not select the options then the test stopped! 微调器可以显示选项,但无法选择选项,则测试停止!
Then an error occurred! 然后发生错误!
I try to add 我尝试添加
`solo.pressSpinnerItem(0,1);`
behind the 在...后面
`solo.clickOnView(solo.getView(R.id.spinner_editwebsite));`
but not work! 但不行!
take a look at this answer: 看一下这个答案:
Seems they took those classes out now.
看来他们现在把这些课都上了。 Just ran into this myself but found a way to do this properly and generically.
只是自己遇到了这个问题,但是找到了一种正确且通用的方法。
// 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));
From: How do I click the first item in a spinner using Robotium?
来自: 如何使用Robotium单击微调器中的第一项?
As you can see a method which you try to use seems to be depracated. 如您所见,尝试使用的方法似乎已被弃用。 Try to use code above instead of yours.
尝试使用上面的代码代替您的代码。
Hope it help 希望对你有帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.