Android自动化测试 Robotium(5)Spinner控件

发表于:2015-8-21 13:08

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:小毛子    来源:51Testing软件测试网采编

  Spinner 控件:
  默认显示:【选择的是:北京】
  操作步骤:
  1.点击【城市】下拉框
  2.选择【上海】
  验证:TextView 显示:【选择的是:上海】
public void testUI() throws Exception {
this.Spinner();
}
public void Spinner(){
solo.clickOnButton("Spinner");
boolean actual = solo.isSpinnerTextSelected(0,"北京");
solo.pressSpinnerItem(0, 1);
boolean actual1 = solo.searchText("选择的是:上海");
assertEquals("This is not found",true, actual1);
}
  isSpinnerTextSelected 拥有两个参数
  public boolean isSpinnerTextSelected(int index, String text)
  index:定位选择的Spinner,第一个为0
  text:所选择的Spinner存在的文本
  这个API返回的是一个布尔值,当满足条件时返回true
  pressSpinnerItem 拥有两个参数
  public void pressSpinnerItem(int spinnerIndex, int itemIndex)
  spinnerIndex:定位要使用的Spinner,第一个为0
  intemIndex:定位所要按下的下拉项,如图:北京=0 上海=1 天津=2 ....
  Spinner实现:http://luwenjie.blog.51cto.com/925779/917238
Android自动化测试 Robotium(4)CheckBox控件
《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号