Quick Slide
First, rapid sliding related concepts
1. Step Length: The time to slide from one point to another
2, Sweep frequency: For example, the list, how many times to slide to the bottom, the number of sliding is the number of sweeps
Second, the relevant API
return value |
Api |
Describe |
Boolean |
Flingbackward () |
Quickly slide backwards with step 5 |
Boolean |
Filingforward () |
Slide forward fast with step 5 |
Boolean |
flingtobeginning (int maxswipes) |
Custom sweep count quickly slide to start with step 5 |
Boolean |
Flingtoend (int maxswipes) |
Custom scans quickly swipe to the end with step 5 |
Iii. Examples of API applications
PackageCom.testuiselector;ImportCom.android.uiautomator.core.UiDevice;ImportCom.android.uiautomator.core.UiObject;Importcom.android.uiautomator.core.UiObjectNotFoundException;Importcom.android.uiautomator.core.UiScrollable;ImportCom.android.uiautomator.core.UiSelector;Importcom.android.uiautomator.testrunner.UiAutomatorTestCase; Public classDemoextendsUiautomatortestcase {/** * @paramargs*/ Public Static voidMain (string[] args) {String jarname, TestClass, testname, Androidid; Jarname= "Demo2"; TestClass= "Com.testuiselector.Demo"; TestName= "Testfling"; Androidid= "1"; NewUiautomatorhelper (Jarname, TestClass, testname, Androidid); } Public voidTestfling ()throwsuiobjectnotfoundexception{uidevice.getinstance (). Presshome (); Sleep (2000); Uiselector L=NewUiselector (). Text ("People"); UiObject P=NewUiObject (L); P.click (); Sleep (2000); uiscrollable Scroll=NewUiscrollable (NewUiselector (). ClassName ("Android.widget.ListView")); Scroll.flingforward (); Sleep (3000); Scroll.flingbackward (); Sleep (3000); Scroll.flingtoend (5); Sleep (3000); Scroll.flingtobeginning (5); }}
Demo.java
Android Wireless test-uiautomator uiscrollable API Introduction two