Solo类常用方法

Solo类常用方法  

 点击: 

clickOnButton(int)—Clicks on a Button with a given index. clickOnButton(String)—Clicks on a Button with a given text. clickOnCheckBox(int)—Clicks on a CheckBox with a given index. 
clickOnView(View)—Clicks on a given View.  
clickOnText(String)—Clicks on a View displaying a given text. clickLongOnText(String)—Long clicks on a given View. 

clickOnRadioButton(int)—Clicks on a RadioButton with a given index. clickOnScreen(float, float)—Clicks on a given coordinate on the screen. 


取得: 

getCurrentActivity()—Returns the current Activity.  
getText(String)—Returns a TextView which shows a given text.  getView(int)—Returns a View with a given id.  

getEditText(String)—Returns an EditText which shows a given text.   getImage(int)—Returns an ImageView with a given index.  


 拖拽: 

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


搜索: 

searchText(String)—Searches for a text string and returns true if at least one item is found with the expected text. searchEditText(String)—Searches for a text string in the EditText objects located in the current Activity.  

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


 其他常用方法:

点击菜单:
solo.clickOnMenuItem( );

输入:

solo.enterText( );   

返回:

solo.goBack( ); 

回到上一个Activity:

solo.goBackToActivity( );

断言Activity:
solo.assertCurrentActivity( ); 

猜你喜欢

转载自blog.csdn.net/maryshine/article/details/52712135