码迷,mamicode.com
首页 > Windows程序 > 详细

老李分享:robotium常用API 1

时间:2016-01-11 17:57:08      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:

robotium常用API

 

Robotium中最重要的类Solo类:其中提供了模拟用户活动的点击、搜索、拖拽等方法。

英文api(经常断开连接打不开):http://www.jarvana.com/jarvana/view/com/jayway/android/robotium/robotium-solo/2.0.1/robotium-solo-2.0.1-javadoc.jar!/index-all.html

中文API: http://www.robotium.cn/archives/category/api/page/7

(源代码解析-Solo : http://www.robotium.cn/archives/1050)

 

 

典型方法:(更多方法及解释请查看以上api)

其中很多方法都是根据控件的索引值进行操作

①  点击:

clickOnButton(int)—Clickson a Button with a givenindex.根据索引值点击Button.

clickOnButton(String)—Clickson a Button with a giventext.根据文本点击Button.

clickOnCheckBox(int)—Clickson a CheckBox with a givenindex.

clickOnView(View)—Clickson a given View.

clickOnText(String)—Clickson a View displaying agiven text.

clickLongOnText(String)—Longclicks on a givenView.

clickOnRadioButton(int)—Clickson a RadioButton with a givenindex.

clickOnScreen(float, float)—Clickson a given coordinate on the screen.

②  取得:

getCurrentActivity()—Returnsthe current Activity.

getText(String)—Returnsa TextView which shows a given text.

getView(int)—Returnsa View with a given id.

getEditText(String)—Returnsan EditText which shows a given text.  

getImage(int)—Returnsan ImageView with a given index.

③  拖拽:

drag(float, float, float,float, int)—Simulate touching a given location anddragging it to a new location.

④  搜索:

searchText(String)—Searchesfor a text string and returnstrue if at least one item is found with the expected text.

searchEditText(String)—Searchesfor a text string in the EditText objects located in the current Activity.

searchButton(String, boolean)—Searchesfor a Button with the given text string and returns true if at least one Buttonis found.

 

老李分享:robotium常用API 1

标签:

原文地址:http://www.cnblogs.com/poptest/p/5121905.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!