Set Scroll Direction
First, set the scrolling direction related API
| return value |
Api |
Describe |
| Uiscrollable |
Setashorizontallist |
Set the scrolling direction to scroll horizontally |
| Uiscrollable |
Setasverticallist |
Set scrolling reverse for portrait scrolling |
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= "Testsetas"; Androidid= "1"; NewUiautomatorhelper (Jarname, TestClass, testname, Androidid); } Public voidTestsetas ()throwsuiobjectnotfoundexception{uidevice.getinstance (). Presshome (); Sleep (1000); UiObject people=NewUiObject (NewUiselector (). Text ("People")); People.click (); Sleep (2000); uiscrollable Scroll=NewUiscrollable (NewUiselector (). ClassName ("Android.support.v4.view.ViewPager")); //set to scroll horizontallyscroll.setashorizontallist (); Scroll.scrollbackward (); Sleep (2000); Scroll.scrollforward (); Sleep (2000); //set to scroll verticallyscroll.setasverticallist (); Scroll.scrollforward (); } }Demo.java
Android Wireless test-uiautomator uiscrollable API Introduction Eight