Introduction to four matching relationships
One or four types of matching relationships are described:
Second, examples:
Match string 0123456789
1, Exact match: 0123456789
2, including matching: 45678, 456, 678
3. Regular match: \d{10}
4. Initial match: 012, 01234, 01234567
Iii. Examples of procedures:
PackageCom.testuiselector;ImportCom.android.uiautomator.core.UiObject;Importcom.android.uiautomator.core.UiObjectNotFoundException;ImportCom.android.uiautomator.core.UiSelector;Importcom.android.uiautomator.testrunner.UiAutomatorTestCase; Public classDemo1extendsUiautomatortestcase {/** * @paramargs*/ Public Static voidMain (string[] args) {//TODO auto-generated Method StubString jarname, TestClass, testname, Androidid; Jarname= "Demo1"; TestClass= "Com.testuiselector.Demo1"; TestName= "Testmatch"; Androidid= "1"; NewUiautomatorhelper (Jarname, TestClass, testname, Androidid); } Public voidTestselector ()throwsuiobjectnotfoundexception{//uiselector l=new uiselector (). Text ("people");//Exact Match//uiselector l=new uiselector (). Textcontains ("Ople"); //uiselector l=new uiselector (). Textmatches (". *opl.*");Uiselector l=NewUiselector (). Textstartswith ("PEO"); UiObject people=NewUiObject (L); People.click (); }}
Demo1.java
Android Wireless test-uiautomator Uiselector API introduction of the third