Gets and sets the maximum number of scroll constant values
One, get and set Max Scroll count constant value related API
return value |
Api |
Describe |
Int |
Getmaxsearchswipes () |
Gets the maximum number of slides during a search slide, with a default maximum scroll count of 30 |
Uiscrollable |
Setmaxsearchswipes (int swipes) |
To set the maximum number of slides |
Ii. 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= "Testsearchswipes"; Androidid= "1"; NewUiautomatorhelper (Jarname, TestClass, testname, Androidid); } Public voidTestsearchswipes ()throwsuiobjectnotfoundexception{uidevice.getinstance (). Presshome (); Sleep (1000); UiObject people=NewUiObject (NewUiselector (). Text ("People")); People.clickandwaitfornewwindow (); uiscrollable Scroll=NewUiscrollable (NewUiselector (). ClassName ("Android.widget.ListView")); //The maximum number of slides is the default 30 times, the contact X is successfully foundUiObject textview=NewUiObject (NewUiselector (). Text ("X")); Scroll.scrollintoview (TextView); Textview.click (); System.out.println ("Maximum number of slides =" +scroll.getmaxsearchswipes ()); Uidevice.getinstance (). Pressback (); //the setting is large sliding this hole is 3 times, resulting in not to contact a, so errorUiObject textview1=NewUiObject (NewUiselector (). Text ("A")); Scroll.setmaxsearchswipes (3); Scroll.scrollintoview (TEXTVIEW1); Textview.click (); }}
Demo.jaa
Android Wireless test-uiautomator uiscrollable API Introduction Four