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( ); 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章