1page.title=UiCollection 2parent.title=uiautomator 3parent.link=index.html 4@jd:body 5<style> 6 h4.jd-details-title {background-color: #DEE8F1;} 7</style> 8<p>Used to enumerate a container's user interface (UI) elements for the purpose of counting, 9 or targeting a sub elements by a child's text or description. 10</p> 11 12<div class="jd-descr"> 13 14 15<h2>Summary</h2> 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39<!-- ======== CONSTRUCTOR SUMMARY ======== --> 40<table id="pubctors" class="jd-sumtable"><tr><th colspan="12">Public Constructors</th></tr> 41 42 43 44 45 <tr class="api" > 46 <td class="jd-typecol"> 47 48 49 50 51 52 53 </td> 54 <td class="jd-linkcol" width="100%"> 55 <span class="sympad"><a href="#UiCollection(com.android.uiautomator.core.UiSelector)">UiCollection</a></span>(<a href="UiSelector.html">UiSelector</a> selector) 56 57 </td></tr> 58 59 60 61</table> 62 63 64 65 66 67 68<!-- ========== METHOD SUMMARY =========== --> 69<table id="pubmethods" class="jd-sumtable"><tr><th colspan="12">Public Methods</th></tr> 70 71 72 73 74 <tr class="api" > 75 <td class="jd-typecol"> 76 77 78 79 80 81 <a href="UiObject.html">UiObject</a> 82 </td> 83 <td class="jd-linkcol" width="100%"> 84 <span class="sympad"><a href="#getChildByDescription(com.android.uiautomator.core.UiSelector, java.lang.String)">getChildByDescription</a></span>(<a href="UiSelector.html">UiSelector</a> childPattern, String text) 85 86 <div class="jd-descrdiv">Searches for child UI element within the constraints of this <code><a href="UiSelector.html">UiSelector</a></code> 87 selector.</div> 88 89 </td></tr> 90 91 92 93 <tr class="api" > 94 <td class="jd-typecol"> 95 96 97 98 99 100 <a href="UiObject.html">UiObject</a> 101 </td> 102 <td class="jd-linkcol" width="100%"> 103 <span class="sympad"><a href="#getChildByInstance(com.android.uiautomator.core.UiSelector, int)">getChildByInstance</a></span>(<a href="UiSelector.html">UiSelector</a> childPattern, int instance) 104 105 <div class="jd-descrdiv">Searches for child UI element within the constraints of this <code><a href="UiSelector.html">UiSelector</a></code>.</div> 106 107 </td></tr> 108 109 110 111 <tr class="api" > 112 <td class="jd-typecol"> 113 114 115 116 117 118 <a href="UiObject.html">UiObject</a> 119 </td> 120 <td class="jd-linkcol" width="100%"> 121 <span class="sympad"><a href="#getChildByText(com.android.uiautomator.core.UiSelector, java.lang.String)">getChildByText</a></span>(<a href="UiSelector.html">UiSelector</a> childPattern, String text) 122 123 <div class="jd-descrdiv">Searches for child UI element within the constraints of this <code><a href="UiSelector.html">UiSelector</a></code>.</div> 124 125 </td></tr> 126 127 128 129 <tr class="api" > 130 <td class="jd-typecol"> 131 132 133 134 135 136 int 137 </td> 138 <td class="jd-linkcol" width="100%"> 139 <span class="sympad"><a href="#getChildCount(com.android.uiautomator.core.UiSelector)">getChildCount</a></span>(<a href="UiSelector.html">UiSelector</a> childPattern) 140 141 <div class="jd-descrdiv">Counts child UI element instances matching the <code>childPattern</code> 142 argument.</div> 143 144 </td></tr> 145 146 147 148</table> 149 150 151 152 153 154 155 156<!-- ========== METHOD SUMMARY =========== --> 157<table id="inhmethods" class="jd-sumtable"><tr><th> 158 <a href="#" class="toggle-all" onclick="return toggleAllInherited(this, null)">[Expand]</a> 159 <div style="clear:left;">Inherited Methods</div></th></tr> 160 161 162<tr class="api apilevel-" > 163<td colspan="12"> 164 <a href="#" onclick="return toggleInherited(this, null)" id="inherited-methods-com.android.uiautomator.core.UiObject" class="jd-expando-trigger closed" 165 ><img id="inherited-methods-com.android.uiautomator.core.UiObject-trigger" 166 src="../../../../../assets/images/triangle-closed.png" 167 class="jd-expando-trigger-img" /></a> 168From class 169 170 <a href="UiObject.html">com.android.uiautomator.core.UiObject</a> 171 172<div id="inherited-methods-com.android.uiautomator.core.UiObject"> 173 <div id="inherited-methods-com.android.uiautomator.core.UiObject-list" 174 class="jd-inheritedlinks"> 175 </div> 176 <div id="inherited-methods-com.android.uiautomator.core.UiObject-summary" style="display: none;"> 177 <table class="jd-sumtable-expando"> 178 179 180 181 182 <tr class="api" > 183 <td class="jd-typecol"> 184 185 186 187 188 189 void 190 </td> 191 <td class="jd-linkcol" width="100%"> 192 <span class="sympad"><a href="UiObject.html#clearTextField()">clearTextField</a></span>() 193 194 <div class="jd-descrdiv">Clears the existing text contents in an editable field.</div> 195 196 </td></tr> 197 198 199 200 <tr class="api" > 201 <td class="jd-typecol"> 202 203 204 205 206 207 boolean 208 </td> 209 <td class="jd-linkcol" width="100%"> 210 <span class="sympad"><a href="UiObject.html#click()">click</a></span>() 211 212 <div class="jd-descrdiv">Performs a click at the center of the visible bounds of the UI element represented 213 by this UiObject.</div> 214 215 </td></tr> 216 217 218 219 <tr class="api" > 220 <td class="jd-typecol"> 221 222 223 224 225 226 boolean 227 </td> 228 <td class="jd-linkcol" width="100%"> 229 <span class="sympad"><a href="UiObject.html#clickAndWaitForNewWindow(long)">clickAndWaitForNewWindow</a></span>(long timeout) 230 231 <div class="jd-descrdiv">Performs a click at the center of the visible bounds of the UI element represented 232 by this UiObject and waits for window transitions.</div> 233 234 </td></tr> 235 236 237 238 <tr class="api" > 239 <td class="jd-typecol"> 240 241 242 243 244 245 boolean 246 </td> 247 <td class="jd-linkcol" width="100%"> 248 <span class="sympad"><a href="UiObject.html#clickAndWaitForNewWindow()">clickAndWaitForNewWindow</a></span>() 249 250 <div class="jd-descrdiv">See <code><a href="UiObject.html#clickAndWaitForNewWindow(long)">clickAndWaitForNewWindow(long)</a></code> 251 This method is intended to reliably wait for window transitions that would typically take 252 longer than the usual default timeouts.</div> 253 254 </td></tr> 255 256 257 258 <tr class="api" > 259 <td class="jd-typecol"> 260 261 262 263 264 265 boolean 266 </td> 267 <td class="jd-linkcol" width="100%"> 268 <span class="sympad"><a href="UiObject.html#clickBottomRight()">clickBottomRight</a></span>() 269 270 <div class="jd-descrdiv">Clicks the bottom and right corner of the UI element</div> 271 272 </td></tr> 273 274 275 276 <tr class="api" > 277 <td class="jd-typecol"> 278 279 280 281 282 283 boolean 284 </td> 285 <td class="jd-linkcol" width="100%"> 286 <span class="sympad"><a href="UiObject.html#clickTopLeft()">clickTopLeft</a></span>() 287 288 <div class="jd-descrdiv">Clicks the top and left corner of the UI element</div> 289 290 </td></tr> 291 292 293 294 <tr class="api" > 295 <td class="jd-typecol"> 296 297 298 299 300 301 boolean 302 </td> 303 <td class="jd-linkcol" width="100%"> 304 <span class="sympad"><a href="UiObject.html#exists()">exists</a></span>() 305 306 <div class="jd-descrdiv">Check if UI element exists.</div> 307 308 </td></tr> 309 310 311 312 <tr class="api" > 313 <td class="jd-typecol"> 314 315 316 317 318 319 Rect 320 </td> 321 <td class="jd-linkcol" width="100%"> 322 <span class="sympad"><a href="UiObject.html#getBounds()">getBounds</a></span>() 323 324 <div class="jd-descrdiv">Returns the UI element's <code>bounds</code> property.</div> 325 326 </td></tr> 327 328 329 330 <tr class="api" > 331 <td class="jd-typecol"> 332 333 334 335 336 337 <a href="UiObject.html">UiObject</a> 338 </td> 339 <td class="jd-linkcol" width="100%"> 340 <span class="sympad"><a href="UiObject.html#getChild(com.android.uiautomator.core.UiSelector)">getChild</a></span>(<a href="UiSelector.html">UiSelector</a> selector) 341 342 <div class="jd-descrdiv">Creates a new UiObject representing a child UI element of the element currently represented 343 by this UiObject.</div> 344 345 </td></tr> 346 347 348 349 <tr class="api" > 350 <td class="jd-typecol"> 351 352 353 354 355 356 int 357 </td> 358 <td class="jd-linkcol" width="100%"> 359 <span class="sympad"><a href="UiObject.html#getChildCount()">getChildCount</a></span>() 360 361 <div class="jd-descrdiv">Counts the child UI elements immediately under the UI element currently represented by 362 this UiObject.</div> 363 364 </td></tr> 365 366 367 368 <tr class="api" > 369 <td class="jd-typecol"> 370 371 372 373 374 375 String 376 </td> 377 <td class="jd-linkcol" width="100%"> 378 <span class="sympad"><a href="UiObject.html#getContentDescription()">getContentDescription</a></span>() 379 380 <div class="jd-descrdiv">Reads the <code>content_desc</code> property of the UI element</div> 381 382 </td></tr> 383 384 385 386 <tr class="api" > 387 <td class="jd-typecol"> 388 389 390 391 392 393 <a href="UiObject.html">UiObject</a> 394 </td> 395 <td class="jd-linkcol" width="100%"> 396 <span class="sympad"><a href="UiObject.html#getFromParent(com.android.uiautomator.core.UiSelector)">getFromParent</a></span>(<a href="UiSelector.html">UiSelector</a> selector) 397 398 <div class="jd-descrdiv">Creates a new UiObject representing a child UI element from the parent element currently 399 represented by this object.</div> 400 401 </td></tr> 402 403 404 405 <tr class="api" > 406 <td class="jd-typecol"> 407 408 409 410 411 412 String 413 </td> 414 <td class="jd-linkcol" width="100%"> 415 <span class="sympad"><a href="UiObject.html#getPackageName()">getPackageName</a></span>() 416 417 <div class="jd-descrdiv">Reads the UI element's <code>package</code> property</div> 418 419 </td></tr> 420 421 422 423 <tr class="api" > 424 <td class="jd-typecol"> 425 426 427 final 428 429 430 <a href="UiSelector.html">UiSelector</a> 431 </td> 432 <td class="jd-linkcol" width="100%"> 433 <span class="sympad"><a href="UiObject.html#getSelector()">getSelector</a></span>() 434 435 <div class="jd-descrdiv">Debugging helper.</div> 436 437 </td></tr> 438 439 440 441 <tr class="api" > 442 <td class="jd-typecol"> 443 444 445 446 447 448 String 449 </td> 450 <td class="jd-linkcol" width="100%"> 451 <span class="sympad"><a href="UiObject.html#getText()">getText</a></span>() 452 453 <div class="jd-descrdiv">Reads the <code>text</code> property of the UI element</div> 454 455 </td></tr> 456 457 458 459 <tr class="api" > 460 <td class="jd-typecol"> 461 462 463 464 465 466 Rect 467 </td> 468 <td class="jd-linkcol" width="100%"> 469 <span class="sympad"><a href="UiObject.html#getVisibleBounds()">getVisibleBounds</a></span>() 470 471 <div class="jd-descrdiv">Returns the visible bounds of the UI element.</div> 472 473 </td></tr> 474 475 476 477 <tr class="api" > 478 <td class="jd-typecol"> 479 480 481 482 483 484 boolean 485 </td> 486 <td class="jd-linkcol" width="100%"> 487 <span class="sympad"><a href="UiObject.html#isCheckable()">isCheckable</a></span>() 488 489 <div class="jd-descrdiv">Check if the UI element's <code>checkable</code> property is currently true</div> 490 491 </td></tr> 492 493 494 495 <tr class="api" > 496 <td class="jd-typecol"> 497 498 499 500 501 502 boolean 503 </td> 504 <td class="jd-linkcol" width="100%"> 505 <span class="sympad"><a href="UiObject.html#isChecked()">isChecked</a></span>() 506 507 <div class="jd-descrdiv">Check if the UI element's <code>checked</code> property is currently true</div> 508 509 </td></tr> 510 511 512 513 <tr class="api" > 514 <td class="jd-typecol"> 515 516 517 518 519 520 boolean 521 </td> 522 <td class="jd-linkcol" width="100%"> 523 <span class="sympad"><a href="UiObject.html#isClickable()">isClickable</a></span>() 524 525 <div class="jd-descrdiv">Check if the UI element's <code>clickable</code> property is currently true</div> 526 527 </td></tr> 528 529 530 531 <tr class="api" > 532 <td class="jd-typecol"> 533 534 535 536 537 538 boolean 539 </td> 540 <td class="jd-linkcol" width="100%"> 541 <span class="sympad"><a href="UiObject.html#isEnabled()">isEnabled</a></span>() 542 543 <div class="jd-descrdiv">Check if the UI element's <code>enabled</code> property is currently true</div> 544 545 </td></tr> 546 547 548 549 <tr class="api" > 550 <td class="jd-typecol"> 551 552 553 554 555 556 boolean 557 </td> 558 <td class="jd-linkcol" width="100%"> 559 <span class="sympad"><a href="UiObject.html#isFocusable()">isFocusable</a></span>() 560 561 <div class="jd-descrdiv">Check if the UI element's <code>focusable</code> property is currently true</div> 562 563 </td></tr> 564 565 566 567 <tr class="api" > 568 <td class="jd-typecol"> 569 570 571 572 573 574 boolean 575 </td> 576 <td class="jd-linkcol" width="100%"> 577 <span class="sympad"><a href="UiObject.html#isFocused()">isFocused</a></span>() 578 579 <div class="jd-descrdiv">Check if the UI element's <code>focused</code> property is currently true</div> 580 581 </td></tr> 582 583 584 585 <tr class="api" > 586 <td class="jd-typecol"> 587 588 589 590 591 592 boolean 593 </td> 594 <td class="jd-linkcol" width="100%"> 595 <span class="sympad"><a href="UiObject.html#isLongClickable()">isLongClickable</a></span>() 596 597 <div class="jd-descrdiv">Check if the UI element's <code>long-clickable</code> property is currently true</div> 598 599 </td></tr> 600 601 602 603 <tr class="api" > 604 <td class="jd-typecol"> 605 606 607 608 609 610 boolean 611 </td> 612 <td class="jd-linkcol" width="100%"> 613 <span class="sympad"><a href="UiObject.html#isScrollable()">isScrollable</a></span>() 614 615 <div class="jd-descrdiv">Check if the UI element's <code>scrollable</code> property is currently true</div> 616 617 </td></tr> 618 619 620 621 <tr class="api" > 622 <td class="jd-typecol"> 623 624 625 626 627 628 boolean 629 </td> 630 <td class="jd-linkcol" width="100%"> 631 <span class="sympad"><a href="UiObject.html#isSelected()">isSelected</a></span>() 632 633 <div class="jd-descrdiv">Check if the UI element's <code>selected</code> property is currently true</div> 634 635 </td></tr> 636 637 638 639 <tr class="api" > 640 <td class="jd-typecol"> 641 642 643 644 645 646 boolean 647 </td> 648 <td class="jd-linkcol" width="100%"> 649 <span class="sympad"><a href="UiObject.html#longClick()">longClick</a></span>() 650 651 <div class="jd-descrdiv">Long clicks the center of the visible bounds of the UI element</div> 652 653 </td></tr> 654 655 656 657 <tr class="api" > 658 <td class="jd-typecol"> 659 660 661 662 663 664 boolean 665 </td> 666 <td class="jd-linkcol" width="100%"> 667 <span class="sympad"><a href="UiObject.html#longClickBottomRight()">longClickBottomRight</a></span>() 668 669 <div class="jd-descrdiv">Long clicks bottom and right corner of the UI element</div> 670 671 </td></tr> 672 673 674 675 <tr class="api" > 676 <td class="jd-typecol"> 677 678 679 680 681 682 boolean 683 </td> 684 <td class="jd-linkcol" width="100%"> 685 <span class="sympad"><a href="UiObject.html#longClickTopLeft()">longClickTopLeft</a></span>() 686 687 <div class="jd-descrdiv">Long clicks on the top and left corner of the UI element</div> 688 689 </td></tr> 690 691 692 693 <tr class="api" > 694 <td class="jd-typecol"> 695 696 697 698 699 700 boolean 701 </td> 702 <td class="jd-linkcol" width="100%"> 703 <span class="sympad"><a href="UiObject.html#setText(java.lang.String)">setText</a></span>(String text) 704 705 <div class="jd-descrdiv">Sets the text in an editable field, after clearing the field's content.</div> 706 707 </td></tr> 708 709 710 711 <tr class="api" > 712 <td class="jd-typecol"> 713 714 715 716 717 718 boolean 719 </td> 720 <td class="jd-linkcol" width="100%"> 721 <span class="sympad"><a href="UiObject.html#swipeDown(int)">swipeDown</a></span>(int steps) 722 723 <div class="jd-descrdiv">Perform the action on the UI element that is represented by this object, Also see 724 #scrollToBeginning(int), #scrollToEnd(int), #scrollBackward(), 725 #scrollForward().</div> 726 727 </td></tr> 728 729 730 731 <tr class="api" > 732 <td class="jd-typecol"> 733 734 735 736 737 738 boolean 739 </td> 740 <td class="jd-linkcol" width="100%"> 741 <span class="sympad"><a href="UiObject.html#swipeLeft(int)">swipeLeft</a></span>(int steps) 742 743 <div class="jd-descrdiv">Perform the action on the UI element that is represented by this object.</div> 744 745 </td></tr> 746 747 748 749 <tr class="api" > 750 <td class="jd-typecol"> 751 752 753 754 755 756 boolean 757 </td> 758 <td class="jd-linkcol" width="100%"> 759 <span class="sympad"><a href="UiObject.html#swipeRight(int)">swipeRight</a></span>(int steps) 760 761 <div class="jd-descrdiv">Perform the action on the UI element that is represented by this object.</div> 762 763 </td></tr> 764 765 766 767 <tr class="api" > 768 <td class="jd-typecol"> 769 770 771 772 773 774 boolean 775 </td> 776 <td class="jd-linkcol" width="100%"> 777 <span class="sympad"><a href="UiObject.html#swipeUp(int)">swipeUp</a></span>(int steps) 778 779 <div class="jd-descrdiv">Perform the action on the UI element that is represented by this UiObject.</div> 780 781 </td></tr> 782 783 784 785 <tr class="api" > 786 <td class="jd-typecol"> 787 788 789 790 791 792 boolean 793 </td> 794 <td class="jd-linkcol" width="100%"> 795 <span class="sympad"><a href="UiObject.html#waitForExists(long)">waitForExists</a></span>(long timeout) 796 797 <div class="jd-descrdiv">Waits a specified length of time for a UI element to become visible.</div> 798 799 </td></tr> 800 801 802 803 <tr class="api" > 804 <td class="jd-typecol"> 805 806 807 808 809 810 boolean 811 </td> 812 <td class="jd-linkcol" width="100%"> 813 <span class="sympad"><a href="UiObject.html#waitUntilGone(long)">waitUntilGone</a></span>(long timeout) 814 815 <div class="jd-descrdiv">Waits a specified length of time for a UI element to become undetectable.</div> 816 817 </td></tr> 818 819 820</table> 821 </div> 822</div> 823</td></tr> 824 825 826 827<tr class="api apilevel-" > 828<td colspan="12"> 829 <a href="#" onclick="return toggleInherited(this, null)" id="inherited-methods-java.lang.Object" class="jd-expando-trigger closed" 830 ><img id="inherited-methods-java.lang.Object-trigger" 831 src="../../../../../assets/images/triangle-closed.png" 832 class="jd-expando-trigger-img" /></a> 833From class 834 835 java.lang.Object 836 837<div id="inherited-methods-java.lang.Object"> 838 <div id="inherited-methods-java.lang.Object-list" 839 class="jd-inheritedlinks"> 840 </div> 841 <div id="inherited-methods-java.lang.Object-summary" style="display: none;"> 842 <table class="jd-sumtable-expando"> 843 844 845 846 847 <tr class="api" > 848 <td class="jd-typecol"> 849 850 851 852 853 854 boolean 855 </td> 856 <td class="jd-linkcol" width="100%"> 857 <span class="sympad">equals</span>(Object arg0) 858 859 </td></tr> 860 861 862 863 <tr class="api" > 864 <td class="jd-typecol"> 865 866 867 final 868 869 870 Class<?> 871 </td> 872 <td class="jd-linkcol" width="100%"> 873 <span class="sympad">getClass</span>() 874 875 </td></tr> 876 877 878 879 <tr class="api" > 880 <td class="jd-typecol"> 881 882 883 884 885 886 int 887 </td> 888 <td class="jd-linkcol" width="100%"> 889 <span class="sympad">hashCode</span>() 890 891 </td></tr> 892 893 894 895 <tr class="api" > 896 <td class="jd-typecol"> 897 898 899 final 900 901 902 void 903 </td> 904 <td class="jd-linkcol" width="100%"> 905 <span class="sympad">notify</span>() 906 907 </td></tr> 908 909 910 911 <tr class="api" > 912 <td class="jd-typecol"> 913 914 915 final 916 917 918 void 919 </td> 920 <td class="jd-linkcol" width="100%"> 921 <span class="sympad">notifyAll</span>() 922 923 </td></tr> 924 925 926 927 <tr class="api" > 928 <td class="jd-typecol"> 929 930 931 932 933 934 String 935 </td> 936 <td class="jd-linkcol" width="100%"> 937 <span class="sympad">toString</span>() 938 939 </td></tr> 940 941 942 943 <tr class="api" > 944 <td class="jd-typecol"> 945 946 947 final 948 949 950 void 951 </td> 952 <td class="jd-linkcol" width="100%"> 953 <span class="sympad">wait</span>() 954 955 </td></tr> 956 957 958 959 <tr class="api" > 960 <td class="jd-typecol"> 961 962 963 final 964 965 966 void 967 </td> 968 <td class="jd-linkcol" width="100%"> 969 <span class="sympad">wait</span>(long arg0, int arg1) 970 971 </td></tr> 972 973 974 975 <tr class="api" > 976 <td class="jd-typecol"> 977 978 979 final 980 981 982 void 983 </td> 984 <td class="jd-linkcol" width="100%"> 985 <span class="sympad">wait</span>(long arg0) 986 987 </td></tr> 988 989 990</table> 991 </div> 992</div> 993</td></tr> 994 995 996</table> 997 998 999</div><!-- jd-descr (summary) --> 1000 1001 1002<!-- ========= CONSTRUCTOR DETAIL ======== --> 1003<h2>Public Constructors</h2> 1004 1005 1006<a id="UiCollection(com.android.uiautomator.core.UiSelector)"></a> 1007 1008<div class="jd-details api "> 1009 <h4 class="jd-details-title"> 1010 <span class="normal"> 1011 public 1012 1013 1014 1015 1016 1017 </span> 1018 <span class="sympad">UiCollection</span> 1019 <span class="normal">(<a href="UiSelector.html">UiSelector</a> selector)</span> 1020 </h4> 1021 <div class="api-level"> 1022 <div> 1023 1024</div> 1025 1026 1027 1028 </div> 1029 <div class="jd-details-descr"> 1030 1031 <div class="jd-tagdata jd-tagdescr"><p></p></div> 1032 1033 </div> 1034</div> 1035 1036 1037 1038<!-- ========= METHOD DETAIL ======== --> 1039<!-- Public methdos --> 1040 1041<h2>Public Methods</h2> 1042 1043 1044<a id="getChildByDescription(com.android.uiautomator.core.UiSelector, java.lang.String)"></a> 1045 1046<div class="jd-details api "> 1047 <h4 class="jd-details-title"> 1048 <span class="normal"> 1049 public 1050 1051 1052 1053 1054 <a href="UiObject.html">UiObject</a> 1055 </span> 1056 <span class="sympad">getChildByDescription</span> 1057 <span class="normal">(<a href="UiSelector.html">UiSelector</a> childPattern, String text)</span> 1058 </h4> 1059 <div class="api-level"> 1060 <div> 1061 1062</div> 1063 1064 1065 1066 </div> 1067 <div class="jd-details-descr"> 1068 1069 <div class="jd-tagdata jd-tagdescr"><p>Searches for child UI element within the constraints of this <code><a href="UiSelector.html">UiSelector</a></code> 1070 selector. 1071 1072 It looks for any child matching the <code>childPattern</code> argument that has 1073 a child UI element anywhere within its sub hierarchy that has content-description text. 1074 The returned UiObject will point at the <code>childPattern</code> instance that matched the 1075 search and not at the identifying child element that matched the content description.</p></p></div> 1076 <div class="jd-tagdata"> 1077 <h5 class="jd-tagtitle">Parameters</h5> 1078 <table class="jd-tagtable"> 1079 <tr> 1080 <th>childPattern</th> 1081 <td><code><a href="UiSelector.html">UiSelector</a></code> selector of the child pattern to match and return</td> 1082 </tr> 1083 <tr> 1084 <th>text</th> 1085 <td>String of the identifying child contents of of the <code>childPattern</code></td> 1086 </tr> 1087 </table> 1088 </div> 1089 <div class="jd-tagdata"> 1090 <h5 class="jd-tagtitle">Returns</h5> 1091 <ul class="nolist"><li><code><a href="UiObject.html">UiObject</a></code> pointing at and instance of <code>childPattern</code></li></ul> 1092 </div> 1093 <div class="jd-tagdata"> 1094 <h5 class="jd-tagtitle">Throws</h5> 1095 <table class="jd-tagtable"> 1096 <tr> 1097 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 1098 <td></td> 1099 </tr> 1100 </table> 1101 </div> 1102 1103 </div> 1104</div> 1105 1106 1107<a id="getChildByInstance(com.android.uiautomator.core.UiSelector, int)"></a> 1108 1109<div class="jd-details api "> 1110 <h4 class="jd-details-title"> 1111 <span class="normal"> 1112 public 1113 1114 1115 1116 1117 <a href="UiObject.html">UiObject</a> 1118 </span> 1119 <span class="sympad">getChildByInstance</span> 1120 <span class="normal">(<a href="UiSelector.html">UiSelector</a> childPattern, int instance)</span> 1121 </h4> 1122 <div class="api-level"> 1123 <div> 1124 1125</div> 1126 1127 1128 1129 </div> 1130 <div class="jd-details-descr"> 1131 1132 <div class="jd-tagdata jd-tagdescr"><p>Searches for child UI element within the constraints of this <code><a href="UiSelector.html">UiSelector</a></code>. 1133 1134 It looks for any child matching the <code>childPattern</code> argument that has 1135 a child UI element anywhere within its sub hierarchy that is at the <code>instance</code> 1136 specified. The operation is performed only on the visible items and no scrolling is performed 1137 in this case.</p></div> 1138 <div class="jd-tagdata"> 1139 <h5 class="jd-tagtitle">Parameters</h5> 1140 <table class="jd-tagtable"> 1141 <tr> 1142 <th>childPattern</th> 1143 <td><code><a href="UiSelector.html">UiSelector</a></code> selector of the child pattern to match and return</td> 1144 </tr> 1145 <tr> 1146 <th>instance</th> 1147 <td>int the desired matched instance of this <code>childPattern</code></td> 1148 </tr> 1149 </table> 1150 </div> 1151 <div class="jd-tagdata"> 1152 <h5 class="jd-tagtitle">Returns</h5> 1153 <ul class="nolist"><li><code><a href="UiObject.html">UiObject</a></code> pointing at and instance of <code>childPattern</code> 1154</li></ul> 1155 </div> 1156 <div class="jd-tagdata"> 1157 <h5 class="jd-tagtitle">Throws</h5> 1158 <table class="jd-tagtable"> 1159 <tr> 1160 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 1161 <td></td> 1162 </tr> 1163 </table> 1164 </div> 1165 1166 </div> 1167</div> 1168 1169 1170<a id="getChildByText(com.android.uiautomator.core.UiSelector, java.lang.String)"></a> 1171 1172<div class="jd-details api "> 1173 <h4 class="jd-details-title"> 1174 <span class="normal"> 1175 public 1176 1177 1178 1179 1180 <a href="UiObject.html">UiObject</a> 1181 </span> 1182 <span class="sympad">getChildByText</span> 1183 <span class="normal">(<a href="UiSelector.html">UiSelector</a> childPattern, String text)</span> 1184 </h4> 1185 <div class="api-level"> 1186 <div> 1187 1188</div> 1189 1190 1191 1192 </div> 1193 <div class="jd-details-descr"> 1194 1195 <div class="jd-tagdata jd-tagdescr"><p>Searches for child UI element within the constraints of this <code><a href="UiSelector.html">UiSelector</a></code> 1196 selector. 1197 1198 It looks for any child matching the <code>childPattern</code> argument that has 1199 a child UI element anywhere within its sub hierarchy that has a text attribute equal to 1200 <code>text</code>. The returned UiObject will point at the <code>childPattern</code> 1201 instance that matched the search and not at the identifying child element that matched the 1202 text attribute.</p></p></div> 1203 <div class="jd-tagdata"> 1204 <h5 class="jd-tagtitle">Parameters</h5> 1205 <table class="jd-tagtable"> 1206 <tr> 1207 <th>childPattern</th> 1208 <td><code><a href="UiSelector.html">UiSelector</a></code> selector of the child pattern to match and return</td> 1209 </tr> 1210 <tr> 1211 <th>text</th> 1212 <td>String of the identifying child contents of of the <code>childPattern</code></td> 1213 </tr> 1214 </table> 1215 </div> 1216 <div class="jd-tagdata"> 1217 <h5 class="jd-tagtitle">Returns</h5> 1218 <ul class="nolist"><li><code><a href="UiObject.html">UiObject</a></code> pointing at and instance of <code>childPattern</code></li></ul> 1219 </div> 1220 <div class="jd-tagdata"> 1221 <h5 class="jd-tagtitle">Throws</h5> 1222 <table class="jd-tagtable"> 1223 <tr> 1224 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 1225 <td></td> 1226 </tr> 1227 </table> 1228 </div> 1229 1230 </div> 1231</div> 1232 1233 1234<a id="getChildCount(com.android.uiautomator.core.UiSelector)"></a> 1235 1236<div class="jd-details api "> 1237 <h4 class="jd-details-title"> 1238 <span class="normal"> 1239 public 1240 int 1241 </span> 1242 <span class="sympad">getChildCount</span> 1243 <span class="normal">(<a href="UiSelector.html">UiSelector</a> childPattern)</span> 1244 </h4> 1245 <div class="api-level"> 1246 </div> 1247 <div class="jd-details-descr"> 1248 1249 <div class="jd-tagdata jd-tagdescr"><p>Counts child UI element instances matching the <code>childPattern</code> 1250 argument. The method returns the number of matching UI elements that are 1251 currently visible. The count does not include items of a scrollable list 1252 that are off-screen.</p></div> 1253 <div class="jd-tagdata"> 1254 <h5 class="jd-tagtitle">Parameters</h5> 1255 <table class="jd-tagtable"> 1256 <tr> 1257 <th>childPattern</th> 1258 <td>a <code><a href="UiSelector.html">UiSelector</a></code> that represents the matching child UI 1259 elements to count</td> 1260 </tr> 1261 </table> 1262 </div> 1263 <div class="jd-tagdata"> 1264 <h5 class="jd-tagtitle">Returns</h5> 1265 <ul class="nolist"><li>the number of matched childPattern under the current <code><a href="UiCollection.html">UiCollection</a></code> 1266</li></ul> 1267 </div> 1268 1269 </div> 1270</div> 1271 1272