1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119<!DOCTYPE html> 120<html devsite> 121<head> 122 123 124 <meta name="top_category" value="develop" /> 125 126 <meta name="subcategory" value="reference" /> 127 128 129 <meta name="book_path" value="/reference/android/support/test/_book.yaml" /> 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145<title>UiObject</title> 146 147 148</head> 149 150<body class="gc-documentation develop reference api apilevel-"> 151<div id="doc-api-level" class="" style="display:none"></div> 152 153 154 155 156<div id="naMessage"></div> 157 158<div id="api-info-block"> 159<div class="api-level"> 160 161 162 163 164</div> 165 166 167 168 169 170 171 172 173 174 175 176<div class="sum-details-links"> 177 178Summary: 179 180 181 182 183 184 <a href="#constants">Constants</a> 185 186 187 188 189 190 191 | <a href="#pubctors">Ctors</a> 192 193 194 195 196 | <a href="#pubmethods">Methods</a> 197 198 199 200 | <a href="#promethods">Protected Methods</a> 201 202 203 204 | <a href="#inhmethods">Inherited Methods</a> 205 206| <a href="#" onclick="return toggleAllClassInherited()" id="toggleAllClassInherited">[Expand All]</a> 207 208</div><!-- end sum-details-links --> 209</div><!-- end api-info-block --> 210 211<div class="api apilevel-" id="jd-content"> 212 213<!-- ======== START OF CLASS DATA ======== --> 214 215<h1 class="api-title">UiObject</h1> 216<p> 217<code class="api-signature"> 218 public 219 220 221 222 class 223 UiObject 224</code> 225<br> 226 227 228<code class="api-signature"> 229 230 extends Object 231 232 233 234</code> 235 236<code class="api-signature"> 237 238 239 240</code> 241 242</p><table class="jd-inheritance-table"> 243 244 245 <tr> 246 247 <td colspan="2" class="jd-inheritance-class-cell">java.lang.Object 248 </td> 249 </tr> 250 251 252 <tr> 253 254 <td class="jd-inheritance-space"> ↳</td> 255 256 <td colspan="1" class="jd-inheritance-class-cell">android.support.test.uiautomator.UiObject 257 </td> 258 </tr> 259 260 261</table> 262 <table class="jd-sumtable jd-sumtable-subclasses"> 263 <tr><td style="border:none;margin:0;padding:0;"> 264 265 <a href="#" onclick="return toggleInherited(this, null)" id="subclasses-direct" class="jd-expando-trigger closed" 266 ><img height="34" id="subclasses-direct-trigger" 267 src="/assets/images/styles/disclosure_down.png" 268 class="jd-expando-trigger-img" /></a>Known Direct Subclasses 269 270 <div id="subclasses-direct"> 271 <div id="subclasses-direct-list" 272 class="jd-inheritedlinks" 273 274 > 275 276 277 <a href="/reference/android/support/test/uiautomator/UiCollection.html">UiCollection</a> 278 279 280 </div> 281 <div id="subclasses-direct-summary" 282 style="display: none;" 283 > 284 285 <table class="jd-sumtable-expando"> 286 287 <tr class="alt-color api apilevel-" > 288 <td class="jd-linkcol"><a href="/reference/android/support/test/uiautomator/UiCollection.html">UiCollection</a></td> 289 <td class="jd-descrcol" width="100%"> 290 Used to enumerate a container's UI elements for the purpose of counting, 291 or targeting a sub elements by a child's text or description. 292 293 294 295 </td> 296 </tr> 297 298 299 </table> 300 301 </div> 302 </div> 303 </td></tr> 304 </table> 305 306 307 <table class="jd-sumtable jd-sumtable-subclasses"><tr><td colspan="2" style="border:none;margin:0;padding:0;"> 308 309 <a href="#" onclick="return toggleInherited(this, null)" id="subclasses-indirect" class="jd-expando-trigger closed" 310 ><img height="34" id="subclasses-indirect-trigger" 311 src="/assets/images/styles/disclosure_down.png" 312 class="jd-expando-trigger-img" /></a>Known Indirect Subclasses 313 314 <div id="subclasses-indirect"> 315 <div id="subclasses-indirect-list" 316 class="jd-inheritedlinks" 317 318 > 319 320 321 <a href="/reference/android/support/test/uiautomator/UiScrollable.html">UiScrollable</a> 322 323 324 </div> 325 <div id="subclasses-indirect-summary" 326 style="display: none;" 327 > 328 329 <table class="jd-sumtable-expando"> 330 331 <tr class="alt-color api apilevel-" > 332 <td class="jd-linkcol"><a href="/reference/android/support/test/uiautomator/UiScrollable.html">UiScrollable</a></td> 333 <td class="jd-descrcol" width="100%"> 334 UiScrollable is a <code><a href="/reference/android/support/test/uiautomator/UiCollection.html">UiCollection</a></code> and provides support for searching 335 for items in scrollable layout elements. 336 337 338 339 </td> 340 </tr> 341 342 343 </table> 344 345 </div> 346 </div> 347 </td></tr></table> 348 349 350 351<br><hr> 352 353 354 <p>A UiObject is a representation of a view. It is not in any way directly bound to a 355 view as an object reference. A UiObject contains information to help it 356 locate a matching view at runtime based on the <code><a href="/reference/android/support/test/uiautomator/UiSelector.html">UiSelector</a></code> properties specified in 357 its constructor. Once you create an instance of a UiObject, it can 358 be reused for different views that match the selector criteria.</p> 359 360 361 362 363 364 365 366<h2 class="api-section">Summary</h2> 367 368 369 370 371 372 373 374 375 376 377 378 379 380<!-- =========== ENUM CONSTANT SUMMARY =========== --> 381<table id="constants" class="responsive constants"> 382<tr><th colspan="2"><h3>Constants</h3></th></tr> 383 384 385 386 <tr class="api apilevel-" > 387 <td><code>int</code></td> 388 <td width="100%"> 389 <code><a href="/reference/android/support/test/uiautomator/UiObject.html#FINGER_TOUCH_HALF_WIDTH">FINGER_TOUCH_HALF_WIDTH</a></code> 390 <p> 391 392 393</p> 394 </td> 395 </tr> 396 397 398 <tr class="api apilevel-" > 399 <td><code>int</code></td> 400 <td width="100%"> 401 <code><a href="/reference/android/support/test/uiautomator/UiObject.html#SWIPE_MARGIN_LIMIT">SWIPE_MARGIN_LIMIT</a></code> 402 <p> 403 404 405</p> 406 </td> 407 </tr> 408 409 410 <tr class="api apilevel-" > 411 <td><code>long</code></td> 412 <td width="100%"> 413 <code><a href="/reference/android/support/test/uiautomator/UiObject.html#WAIT_FOR_EVENT_TMEOUT">WAIT_FOR_EVENT_TMEOUT</a></code> 414 <p><em> 415 This constant is deprecated. 416 use <code><a href="/reference/android/support/test/uiautomator/Configurator.html#setScrollAcknowledgmentTimeout(long)">setScrollAcknowledgmentTimeout(long)</a></code> 417</em> 418 419 420</p> 421 </td> 422 </tr> 423 424 425 <tr class="api apilevel-" > 426 <td><code>long</code></td> 427 <td width="100%"> 428 <code><a href="/reference/android/support/test/uiautomator/UiObject.html#WAIT_FOR_SELECTOR_POLL">WAIT_FOR_SELECTOR_POLL</a></code> 429 <p> 430 431 432</p> 433 </td> 434 </tr> 435 436 437 <tr class="api apilevel-" > 438 <td><code>long</code></td> 439 <td width="100%"> 440 <code><a href="/reference/android/support/test/uiautomator/UiObject.html#WAIT_FOR_SELECTOR_TIMEOUT">WAIT_FOR_SELECTOR_TIMEOUT</a></code> 441 <p><em> 442 This constant is deprecated. 443 use <code><a href="/reference/android/support/test/uiautomator/Configurator.html#setWaitForSelectorTimeout(long)">setWaitForSelectorTimeout(long)</a></code> 444</em> 445 446 447</p> 448 </td> 449 </tr> 450 451 452 <tr class="api apilevel-" > 453 <td><code>long</code></td> 454 <td width="100%"> 455 <code><a href="/reference/android/support/test/uiautomator/UiObject.html#WAIT_FOR_WINDOW_TMEOUT">WAIT_FOR_WINDOW_TMEOUT</a></code> 456 <p> 457 458 459</p> 460 </td> 461 </tr> 462 463 464 465</table> 466 467 468 469 470 471 472 473 474 475 476 477 478<!-- ======== CONSTRUCTOR SUMMARY ======== --> 479<table id="pubctors" class="responsive constructors"> 480<tr><th colspan="2"><h3>Public constructors</h3></th></tr> 481 482 483 484 485 <tr class="api apilevel-" > 486 487 488 <td width="100%"> 489 <code> 490 <a href="/reference/android/support/test/uiautomator/UiObject.html#UiObject(android.support.test.uiautomator.UiSelector)">UiObject</a>(<a href="/reference/android/support/test/uiautomator/UiSelector.html">UiSelector</a> selector) 491 </code> 492 493 <p><em> 494 This constructor is deprecated. 495 Use <code><a href="/reference/android/support/test/uiautomator/UiDevice.html#findObject(android.support.test.uiautomator.UiSelector)">findObject(UiSelector)</a></code> instead. This version hides 496 UiObject's dependency on UiDevice and is prone to misuse.</em> 497 498 499</p> 500 501 </td> 502 </tr> 503 504 505 506</table> 507 508 509 510 511 512 513<!-- ========== METHOD SUMMARY =========== --> 514<table id="pubmethods" class="responsive methods"> 515<tr><th colspan="2"><h3>Public methods</h3></th></tr> 516 517 518 519 520 <tr class="api apilevel-" > 521 522 523 <td><code> 524 525 526 527 528 529 void</code> 530 </td> 531 532 <td width="100%"> 533 <code> 534 <a href="/reference/android/support/test/uiautomator/UiObject.html#clearTextField()">clearTextField</a>() 535 </code> 536 537 <p>Clears the existing text contents in an editable field. 538 539 540</p> 541 542 </td> 543 </tr> 544 545 546 547 <tr class="api apilevel-" > 548 549 550 <td><code> 551 552 553 554 555 556 boolean</code> 557 </td> 558 559 <td width="100%"> 560 <code> 561 <a href="/reference/android/support/test/uiautomator/UiObject.html#click()">click</a>() 562 </code> 563 564 <p>Performs a click at the center of the visible bounds of the UI element represented 565 by this UiObject. 566 567 568</p> 569 570 </td> 571 </tr> 572 573 574 575 <tr class="api apilevel-" > 576 577 578 <td><code> 579 580 581 582 583 584 boolean</code> 585 </td> 586 587 <td width="100%"> 588 <code> 589 <a href="/reference/android/support/test/uiautomator/UiObject.html#clickAndWaitForNewWindow()">clickAndWaitForNewWindow</a>() 590 </code> 591 592 <p>Waits for window transitions that would typically take longer than the 593 usual default timeouts. 594 595 596</p> 597 598 </td> 599 </tr> 600 601 602 603 <tr class="api apilevel-" > 604 605 606 <td><code> 607 608 609 610 611 612 boolean</code> 613 </td> 614 615 <td width="100%"> 616 <code> 617 <a href="/reference/android/support/test/uiautomator/UiObject.html#clickAndWaitForNewWindow(long)">clickAndWaitForNewWindow</a>(long timeout) 618 </code> 619 620 <p>Performs a click at the center of the visible bounds of the UI element represented 621 by this UiObject and waits for window transitions. 622 623 624</p> 625 626 </td> 627 </tr> 628 629 630 631 <tr class="api apilevel-" > 632 633 634 <td><code> 635 636 637 638 639 640 boolean</code> 641 </td> 642 643 <td width="100%"> 644 <code> 645 <a href="/reference/android/support/test/uiautomator/UiObject.html#clickBottomRight()">clickBottomRight</a>() 646 </code> 647 648 <p>Clicks the bottom and right corner of the UI element 649 650 651</p> 652 653 </td> 654 </tr> 655 656 657 658 <tr class="api apilevel-" > 659 660 661 <td><code> 662 663 664 665 666 667 boolean</code> 668 </td> 669 670 <td width="100%"> 671 <code> 672 <a href="/reference/android/support/test/uiautomator/UiObject.html#clickTopLeft()">clickTopLeft</a>() 673 </code> 674 675 <p>Clicks the top and left corner of the UI element 676 677 678</p> 679 680 </td> 681 </tr> 682 683 684 685 <tr class="api apilevel-" > 686 687 688 <td><code> 689 690 691 692 693 694 boolean</code> 695 </td> 696 697 <td width="100%"> 698 <code> 699 <a href="/reference/android/support/test/uiautomator/UiObject.html#dragTo(android.support.test.uiautomator.UiObject, int)">dragTo</a>(<a href="/reference/android/support/test/uiautomator/UiObject.html">UiObject</a> destObj, int steps) 700 </code> 701 702 <p>Drags this object to a destination UiObject. 703 704 705</p> 706 707 </td> 708 </tr> 709 710 711 712 <tr class="api apilevel-" > 713 714 715 <td><code> 716 717 718 719 720 721 boolean</code> 722 </td> 723 724 <td width="100%"> 725 <code> 726 <a href="/reference/android/support/test/uiautomator/UiObject.html#dragTo(int, int, int)">dragTo</a>(int destX, int destY, int steps) 727 </code> 728 729 <p>Drags this object to arbitrary coordinates. 730 731 732</p> 733 734 </td> 735 </tr> 736 737 738 739 <tr class="api apilevel-" > 740 741 742 <td><code> 743 744 745 746 747 748 boolean</code> 749 </td> 750 751 <td width="100%"> 752 <code> 753 <a href="/reference/android/support/test/uiautomator/UiObject.html#exists()">exists</a>() 754 </code> 755 756 <p>Check if view exists. 757 758 759</p> 760 761 </td> 762 </tr> 763 764 765 766 <tr class="api apilevel-" > 767 768 769 <td><code> 770 771 772 773 774 775 Rect</code> 776 </td> 777 778 <td width="100%"> 779 <code> 780 <a href="/reference/android/support/test/uiautomator/UiObject.html#getBounds()">getBounds</a>() 781 </code> 782 783 <p>Returns the view's <code>bounds</code> property. 784 785 786</p> 787 788 </td> 789 </tr> 790 791 792 793 <tr class="api apilevel-" > 794 795 796 <td><code> 797 798 799 800 801 802 <a href="/reference/android/support/test/uiautomator/UiObject.html">UiObject</a></code> 803 </td> 804 805 <td width="100%"> 806 <code> 807 <a href="/reference/android/support/test/uiautomator/UiObject.html#getChild(android.support.test.uiautomator.UiSelector)">getChild</a>(<a href="/reference/android/support/test/uiautomator/UiSelector.html">UiSelector</a> selector) 808 </code> 809 810 <p>Creates a new UiObject for a child view that is under the present UiObject. 811 812 813</p> 814 815 </td> 816 </tr> 817 818 819 820 <tr class="api apilevel-" > 821 822 823 <td><code> 824 825 826 827 828 829 int</code> 830 </td> 831 832 <td width="100%"> 833 <code> 834 <a href="/reference/android/support/test/uiautomator/UiObject.html#getChildCount()">getChildCount</a>() 835 </code> 836 837 <p>Counts the child views immediately under the present UiObject. 838 839 840</p> 841 842 </td> 843 </tr> 844 845 846 847 <tr class="api apilevel-" > 848 849 850 <td><code> 851 852 853 854 855 856 String</code> 857 </td> 858 859 <td width="100%"> 860 <code> 861 <a href="/reference/android/support/test/uiautomator/UiObject.html#getClassName()">getClassName</a>() 862 </code> 863 864 <p>Retrieves the <code>className</code> property of the UI element. 865 866 867</p> 868 869 </td> 870 </tr> 871 872 873 874 <tr class="api apilevel-" > 875 876 877 <td><code> 878 879 880 881 882 883 String</code> 884 </td> 885 886 <td width="100%"> 887 <code> 888 <a href="/reference/android/support/test/uiautomator/UiObject.html#getContentDescription()">getContentDescription</a>() 889 </code> 890 891 <p>Reads the <code>content_desc</code> property of the UI element 892 893 894</p> 895 896 </td> 897 </tr> 898 899 900 901 <tr class="api apilevel-" > 902 903 904 <td><code> 905 906 907 908 909 910 <a href="/reference/android/support/test/uiautomator/UiObject.html">UiObject</a></code> 911 </td> 912 913 <td width="100%"> 914 <code> 915 <a href="/reference/android/support/test/uiautomator/UiObject.html#getFromParent(android.support.test.uiautomator.UiSelector)">getFromParent</a>(<a href="/reference/android/support/test/uiautomator/UiSelector.html">UiSelector</a> selector) 916 </code> 917 918 <p>Creates a new UiObject for a sibling view or a child of the sibling view, 919 relative to the present UiObject. 920 921 922</p> 923 924 </td> 925 </tr> 926 927 928 929 <tr class="api apilevel-" > 930 931 932 <td><code> 933 934 935 936 937 938 String</code> 939 </td> 940 941 <td width="100%"> 942 <code> 943 <a href="/reference/android/support/test/uiautomator/UiObject.html#getPackageName()">getPackageName</a>() 944 </code> 945 946 <p>Reads the view's <code>package</code> property 947 948 949</p> 950 951 </td> 952 </tr> 953 954 955 956 <tr class="api apilevel-" > 957 958 959 <td><code> 960 961 962 963 final 964 965 <a href="/reference/android/support/test/uiautomator/UiSelector.html">UiSelector</a></code> 966 </td> 967 968 <td width="100%"> 969 <code> 970 <a href="/reference/android/support/test/uiautomator/UiObject.html#getSelector()">getSelector</a>() 971 </code> 972 973 <p>Debugging helper. 974 975 976</p> 977 978 </td> 979 </tr> 980 981 982 983 <tr class="api apilevel-" > 984 985 986 <td><code> 987 988 989 990 991 992 String</code> 993 </td> 994 995 <td width="100%"> 996 <code> 997 <a href="/reference/android/support/test/uiautomator/UiObject.html#getText()">getText</a>() 998 </code> 999 1000 <p>Reads the <code>text</code> property of the UI element 1001 1002 1003</p> 1004 1005 </td> 1006 </tr> 1007 1008 1009 1010 <tr class="api apilevel-" > 1011 1012 1013 <td><code> 1014 1015 1016 1017 1018 1019 Rect</code> 1020 </td> 1021 1022 <td width="100%"> 1023 <code> 1024 <a href="/reference/android/support/test/uiautomator/UiObject.html#getVisibleBounds()">getVisibleBounds</a>() 1025 </code> 1026 1027 <p>Returns the visible bounds of the view. 1028 1029 1030</p> 1031 1032 </td> 1033 </tr> 1034 1035 1036 1037 <tr class="api apilevel-" > 1038 1039 1040 <td><code> 1041 1042 1043 1044 1045 1046 boolean</code> 1047 </td> 1048 1049 <td width="100%"> 1050 <code> 1051 <a href="/reference/android/support/test/uiautomator/UiObject.html#isCheckable()">isCheckable</a>() 1052 </code> 1053 1054 <p>Checks if the UI element's <code>checkable</code> property is currently true. 1055 1056 1057</p> 1058 1059 </td> 1060 </tr> 1061 1062 1063 1064 <tr class="api apilevel-" > 1065 1066 1067 <td><code> 1068 1069 1070 1071 1072 1073 boolean</code> 1074 </td> 1075 1076 <td width="100%"> 1077 <code> 1078 <a href="/reference/android/support/test/uiautomator/UiObject.html#isChecked()">isChecked</a>() 1079 </code> 1080 1081 <p>Check if the UI element's <code>checked</code> property is currently true 1082 1083 1084</p> 1085 1086 </td> 1087 </tr> 1088 1089 1090 1091 <tr class="api apilevel-" > 1092 1093 1094 <td><code> 1095 1096 1097 1098 1099 1100 boolean</code> 1101 </td> 1102 1103 <td width="100%"> 1104 <code> 1105 <a href="/reference/android/support/test/uiautomator/UiObject.html#isClickable()">isClickable</a>() 1106 </code> 1107 1108 <p>Checks if the UI element's <code>clickable</code> property is currently true. 1109 1110 1111</p> 1112 1113 </td> 1114 </tr> 1115 1116 1117 1118 <tr class="api apilevel-" > 1119 1120 1121 <td><code> 1122 1123 1124 1125 1126 1127 boolean</code> 1128 </td> 1129 1130 <td width="100%"> 1131 <code> 1132 <a href="/reference/android/support/test/uiautomator/UiObject.html#isEnabled()">isEnabled</a>() 1133 </code> 1134 1135 <p>Checks if the UI element's <code>enabled</code> property is currently true. 1136 1137 1138</p> 1139 1140 </td> 1141 </tr> 1142 1143 1144 1145 <tr class="api apilevel-" > 1146 1147 1148 <td><code> 1149 1150 1151 1152 1153 1154 boolean</code> 1155 </td> 1156 1157 <td width="100%"> 1158 <code> 1159 <a href="/reference/android/support/test/uiautomator/UiObject.html#isFocusable()">isFocusable</a>() 1160 </code> 1161 1162 <p>Check if the UI element's <code>focusable</code> property is currently true. 1163 1164 1165</p> 1166 1167 </td> 1168 </tr> 1169 1170 1171 1172 <tr class="api apilevel-" > 1173 1174 1175 <td><code> 1176 1177 1178 1179 1180 1181 boolean</code> 1182 </td> 1183 1184 <td width="100%"> 1185 <code> 1186 <a href="/reference/android/support/test/uiautomator/UiObject.html#isFocused()">isFocused</a>() 1187 </code> 1188 1189 <p>Check if the UI element's <code>focused</code> property is currently true 1190 1191 1192</p> 1193 1194 </td> 1195 </tr> 1196 1197 1198 1199 <tr class="api apilevel-" > 1200 1201 1202 <td><code> 1203 1204 1205 1206 1207 1208 boolean</code> 1209 </td> 1210 1211 <td width="100%"> 1212 <code> 1213 <a href="/reference/android/support/test/uiautomator/UiObject.html#isLongClickable()">isLongClickable</a>() 1214 </code> 1215 1216 <p>Check if the view's <code>long-clickable</code> property is currently true 1217 1218 1219</p> 1220 1221 </td> 1222 </tr> 1223 1224 1225 1226 <tr class="api apilevel-" > 1227 1228 1229 <td><code> 1230 1231 1232 1233 1234 1235 boolean</code> 1236 </td> 1237 1238 <td width="100%"> 1239 <code> 1240 <a href="/reference/android/support/test/uiautomator/UiObject.html#isScrollable()">isScrollable</a>() 1241 </code> 1242 1243 <p>Check if the view's <code>scrollable</code> property is currently true 1244 1245 1246</p> 1247 1248 </td> 1249 </tr> 1250 1251 1252 1253 <tr class="api apilevel-" > 1254 1255 1256 <td><code> 1257 1258 1259 1260 1261 1262 boolean</code> 1263 </td> 1264 1265 <td width="100%"> 1266 <code> 1267 <a href="/reference/android/support/test/uiautomator/UiObject.html#isSelected()">isSelected</a>() 1268 </code> 1269 1270 <p>Checks if the UI element's <code>selected</code> property is currently true. 1271 1272 1273</p> 1274 1275 </td> 1276 </tr> 1277 1278 1279 1280 <tr class="api apilevel-" > 1281 1282 1283 <td><code> 1284 1285 1286 1287 1288 1289 boolean</code> 1290 </td> 1291 1292 <td width="100%"> 1293 <code> 1294 <a href="/reference/android/support/test/uiautomator/UiObject.html#longClick()">longClick</a>() 1295 </code> 1296 1297 <p>Long clicks the center of the visible bounds of the UI element 1298 1299 1300</p> 1301 1302 </td> 1303 </tr> 1304 1305 1306 1307 <tr class="api apilevel-" > 1308 1309 1310 <td><code> 1311 1312 1313 1314 1315 1316 boolean</code> 1317 </td> 1318 1319 <td width="100%"> 1320 <code> 1321 <a href="/reference/android/support/test/uiautomator/UiObject.html#longClickBottomRight()">longClickBottomRight</a>() 1322 </code> 1323 1324 <p>Long clicks bottom and right corner of the UI element 1325 1326 1327</p> 1328 1329 </td> 1330 </tr> 1331 1332 1333 1334 <tr class="api apilevel-" > 1335 1336 1337 <td><code> 1338 1339 1340 1341 1342 1343 boolean</code> 1344 </td> 1345 1346 <td width="100%"> 1347 <code> 1348 <a href="/reference/android/support/test/uiautomator/UiObject.html#longClickTopLeft()">longClickTopLeft</a>() 1349 </code> 1350 1351 <p>Long clicks on the top and left corner of the UI element 1352 1353 1354</p> 1355 1356 </td> 1357 </tr> 1358 1359 1360 1361 <tr class="api apilevel-" > 1362 1363 1364 <td><code> 1365 1366 1367 1368 1369 1370 boolean</code> 1371 </td> 1372 1373 <td width="100%"> 1374 <code> 1375 <a href="/reference/android/support/test/uiautomator/UiObject.html#performMultiPointerGesture(android.view.MotionEvent.PointerCoords[]...)">performMultiPointerGesture</a>(PointerCoords... touches) 1376 </code> 1377 1378 <p>Performs a multi-touch gesture. 1379 1380 1381</p> 1382 1383 </td> 1384 </tr> 1385 1386 1387 1388 <tr class="api apilevel-" > 1389 1390 1391 <td><code> 1392 1393 1394 1395 1396 1397 boolean</code> 1398 </td> 1399 1400 <td width="100%"> 1401 <code> 1402 <a href="/reference/android/support/test/uiautomator/UiObject.html#performTwoPointerGesture(android.graphics.Point, android.graphics.Point, android.graphics.Point, android.graphics.Point, int)">performTwoPointerGesture</a>(Point startPoint1, Point startPoint2, Point endPoint1, Point endPoint2, int steps) 1403 </code> 1404 1405 <p>Generates a two-pointer gesture with arbitrary starting and ending points. 1406 1407 1408</p> 1409 1410 </td> 1411 </tr> 1412 1413 1414 1415 <tr class="api apilevel-" > 1416 1417 1418 <td><code> 1419 1420 1421 1422 1423 1424 boolean</code> 1425 </td> 1426 1427 <td width="100%"> 1428 <code> 1429 <a href="/reference/android/support/test/uiautomator/UiObject.html#pinchIn(int, int)">pinchIn</a>(int percent, int steps) 1430 </code> 1431 1432 <p>Performs a two-pointer gesture, where each pointer moves diagonally 1433 toward the other, from the edges to the center of this UiObject . 1434 1435 1436</p> 1437 1438 </td> 1439 </tr> 1440 1441 1442 1443 <tr class="api apilevel-" > 1444 1445 1446 <td><code> 1447 1448 1449 1450 1451 1452 boolean</code> 1453 </td> 1454 1455 <td width="100%"> 1456 <code> 1457 <a href="/reference/android/support/test/uiautomator/UiObject.html#pinchOut(int, int)">pinchOut</a>(int percent, int steps) 1458 </code> 1459 1460 <p>Performs a two-pointer gesture, where each pointer moves diagonally 1461 opposite across the other, from the center out towards the edges of the 1462 this UiObject. 1463 1464 1465</p> 1466 1467 </td> 1468 </tr> 1469 1470 1471 1472 <tr class="api apilevel-" > 1473 1474 1475 <td><code> 1476 1477 1478 1479 1480 1481 boolean</code> 1482 </td> 1483 1484 <td width="100%"> 1485 <code> 1486 <a href="/reference/android/support/test/uiautomator/UiObject.html#setText(java.lang.String)">setText</a>(String text) 1487 </code> 1488 1489 <p>Sets the text in an editable field, after clearing the field's content. 1490 1491 1492</p> 1493 1494 </td> 1495 </tr> 1496 1497 1498 1499 <tr class="api apilevel-" > 1500 1501 1502 <td><code> 1503 1504 1505 1506 1507 1508 boolean</code> 1509 </td> 1510 1511 <td width="100%"> 1512 <code> 1513 <a href="/reference/android/support/test/uiautomator/UiObject.html#swipeDown(int)">swipeDown</a>(int steps) 1514 </code> 1515 1516 <p>Performs the swipe down action on the UiObject. 1517 1518 1519</p> 1520 1521 </td> 1522 </tr> 1523 1524 1525 1526 <tr class="api apilevel-" > 1527 1528 1529 <td><code> 1530 1531 1532 1533 1534 1535 boolean</code> 1536 </td> 1537 1538 <td width="100%"> 1539 <code> 1540 <a href="/reference/android/support/test/uiautomator/UiObject.html#swipeLeft(int)">swipeLeft</a>(int steps) 1541 </code> 1542 1543 <p>Performs the swipe left action on the UiObject. 1544 1545 1546</p> 1547 1548 </td> 1549 </tr> 1550 1551 1552 1553 <tr class="api apilevel-" > 1554 1555 1556 <td><code> 1557 1558 1559 1560 1561 1562 boolean</code> 1563 </td> 1564 1565 <td width="100%"> 1566 <code> 1567 <a href="/reference/android/support/test/uiautomator/UiObject.html#swipeRight(int)">swipeRight</a>(int steps) 1568 </code> 1569 1570 <p>Performs the swipe right action on the UiObject. 1571 1572 1573</p> 1574 1575 </td> 1576 </tr> 1577 1578 1579 1580 <tr class="api apilevel-" > 1581 1582 1583 <td><code> 1584 1585 1586 1587 1588 1589 boolean</code> 1590 </td> 1591 1592 <td width="100%"> 1593 <code> 1594 <a href="/reference/android/support/test/uiautomator/UiObject.html#swipeUp(int)">swipeUp</a>(int steps) 1595 </code> 1596 1597 <p>Performs the swipe up action on the UiObject. 1598 1599 1600</p> 1601 1602 </td> 1603 </tr> 1604 1605 1606 1607 <tr class="api apilevel-" > 1608 1609 1610 <td><code> 1611 1612 1613 1614 1615 1616 boolean</code> 1617 </td> 1618 1619 <td width="100%"> 1620 <code> 1621 <a href="/reference/android/support/test/uiautomator/UiObject.html#waitForExists(long)">waitForExists</a>(long timeout) 1622 </code> 1623 1624 <p>Waits a specified length of time for a view to become visible. 1625 1626 1627</p> 1628 1629 </td> 1630 </tr> 1631 1632 1633 1634 <tr class="api apilevel-" > 1635 1636 1637 <td><code> 1638 1639 1640 1641 1642 1643 boolean</code> 1644 </td> 1645 1646 <td width="100%"> 1647 <code> 1648 <a href="/reference/android/support/test/uiautomator/UiObject.html#waitUntilGone(long)">waitUntilGone</a>(long timeout) 1649 </code> 1650 1651 <p>Waits a specified length of time for a view to become undetectable. 1652 1653 1654</p> 1655 1656 </td> 1657 </tr> 1658 1659 1660 1661</table> 1662 1663 1664 1665 1666<!-- ========== METHOD SUMMARY =========== --> 1667<table id="promethods" class="reponsive methods"> 1668<tr><th colspan="2"><h3>Protected methods</h3></th></tr> 1669 1670 1671 1672 1673 <tr class="api apilevel-" > 1674 1675 1676 <td><code> 1677 1678 1679 1680 1681 1682 AccessibilityNodeInfo</code> 1683 </td> 1684 1685 <td width="100%"> 1686 <code> 1687 <a href="/reference/android/support/test/uiautomator/UiObject.html#findAccessibilityNodeInfo(long)">findAccessibilityNodeInfo</a>(long timeout) 1688 </code> 1689 1690 <p>Finds a matching UI element in the accessibility hierarchy, by 1691 using the selector for this UiObject. 1692 1693 1694</p> 1695 1696 </td> 1697 </tr> 1698 1699 1700 1701</table> 1702 1703 1704 1705 1706 1707<!-- ========== METHOD SUMMARY =========== --> 1708<table id="inhmethods" class="methods inhtable"> 1709<tr><th><h3>Inherited methods</h3></th></tr> 1710 1711 1712<tr class="api apilevel-" > 1713<td colspan="2"> 1714 1715 <a href="#" onclick="return toggleInherited(this, null)" id="inherited-methods-java.lang.Object" class="jd-expando-trigger closed" 1716 ><img height="34" id="inherited-methods-java.lang.Object-trigger" 1717 src="/assets/images/styles/disclosure_down.png" 1718 class="jd-expando-trigger-img" /></a>From 1719class 1720<code> 1721 1722 java.lang.Object 1723 1724</code> 1725<div id="inherited-methods-java.lang.Object"> 1726 <div id="inherited-methods-java.lang.Object-list" 1727 class="jd-inheritedlinks"> 1728 </div> 1729 <div id="inherited-methods-java.lang.Object-summary" style="display: none;"> 1730 <table class="jd-sumtable-expando responsive"> 1731 1732 1733 1734 1735 <tr class="api apilevel-" > 1736 1737 1738 <td><code> 1739 1740 1741 1742 1743 1744 Object</code> 1745 </td> 1746 1747 <td width="100%"> 1748 <code> 1749 clone() 1750 </code> 1751 1752 </td> 1753 </tr> 1754 1755 1756 1757 <tr class="api apilevel-" > 1758 1759 1760 <td><code> 1761 1762 1763 1764 1765 1766 boolean</code> 1767 </td> 1768 1769 <td width="100%"> 1770 <code> 1771 equals(Object arg0) 1772 </code> 1773 1774 </td> 1775 </tr> 1776 1777 1778 1779 <tr class="api apilevel-" > 1780 1781 1782 <td><code> 1783 1784 1785 1786 1787 1788 void</code> 1789 </td> 1790 1791 <td width="100%"> 1792 <code> 1793 finalize() 1794 </code> 1795 1796 </td> 1797 </tr> 1798 1799 1800 1801 <tr class="api apilevel-" > 1802 1803 1804 <td><code> 1805 1806 1807 1808 final 1809 1810 Class<?></code> 1811 </td> 1812 1813 <td width="100%"> 1814 <code> 1815 getClass() 1816 </code> 1817 1818 </td> 1819 </tr> 1820 1821 1822 1823 <tr class="api apilevel-" > 1824 1825 1826 <td><code> 1827 1828 1829 1830 1831 1832 int</code> 1833 </td> 1834 1835 <td width="100%"> 1836 <code> 1837 hashCode() 1838 </code> 1839 1840 </td> 1841 </tr> 1842 1843 1844 1845 <tr class="api apilevel-" > 1846 1847 1848 <td><code> 1849 1850 1851 1852 final 1853 1854 void</code> 1855 </td> 1856 1857 <td width="100%"> 1858 <code> 1859 notify() 1860 </code> 1861 1862 </td> 1863 </tr> 1864 1865 1866 1867 <tr class="api apilevel-" > 1868 1869 1870 <td><code> 1871 1872 1873 1874 final 1875 1876 void</code> 1877 </td> 1878 1879 <td width="100%"> 1880 <code> 1881 notifyAll() 1882 </code> 1883 1884 </td> 1885 </tr> 1886 1887 1888 1889 <tr class="api apilevel-" > 1890 1891 1892 <td><code> 1893 1894 1895 1896 1897 1898 String</code> 1899 </td> 1900 1901 <td width="100%"> 1902 <code> 1903 toString() 1904 </code> 1905 1906 </td> 1907 </tr> 1908 1909 1910 1911 <tr class="api apilevel-" > 1912 1913 1914 <td><code> 1915 1916 1917 1918 final 1919 1920 void</code> 1921 </td> 1922 1923 <td width="100%"> 1924 <code> 1925 wait(long arg0, int arg1) 1926 </code> 1927 1928 </td> 1929 </tr> 1930 1931 1932 1933 <tr class="api apilevel-" > 1934 1935 1936 <td><code> 1937 1938 1939 1940 final 1941 1942 void</code> 1943 </td> 1944 1945 <td width="100%"> 1946 <code> 1947 wait(long arg0) 1948 </code> 1949 1950 </td> 1951 </tr> 1952 1953 1954 1955 <tr class="api apilevel-" > 1956 1957 1958 <td><code> 1959 1960 1961 1962 final 1963 1964 void</code> 1965 </td> 1966 1967 <td width="100%"> 1968 <code> 1969 wait() 1970 </code> 1971 1972 </td> 1973 </tr> 1974 1975 1976 1977 </table> 1978 </div> 1979</div> 1980</td></tr> 1981 1982 1983</table> 1984 1985 1986 1987<!-- XML Attributes --> 1988 1989 1990<!-- Enum Values --> 1991 1992 1993<!-- Constants --> 1994 1995 1996<!-- ========= ENUM CONSTANTS DETAIL ======== --> 1997<h2 class="api-section">Constants</h2> 1998 1999 2000 2001 2002<A NAME="FINGER_TOUCH_HALF_WIDTH"></A> 2003 2004<div class="api apilevel-"> 2005 <h3 class="api-name">FINGER_TOUCH_HALF_WIDTH</h3> 2006 <div class="api-level"> 2007 2008 2009 2010 2011 </div> 2012<pre class="api-signature no-pretty-print"> 2013int FINGER_TOUCH_HALF_WIDTH</pre> 2014 2015 2016 2017 2018 <p></p> 2019 2020 2021 <p>Constant Value: 2022 2023 20 2024 (0x00000014) 2025 2026 2027</div> 2028 2029 2030 2031<A NAME="SWIPE_MARGIN_LIMIT"></A> 2032 2033<div class="api apilevel-"> 2034 <h3 class="api-name">SWIPE_MARGIN_LIMIT</h3> 2035 <div class="api-level"> 2036 2037 2038 2039 2040 </div> 2041<pre class="api-signature no-pretty-print"> 2042int SWIPE_MARGIN_LIMIT</pre> 2043 2044 2045 2046 2047 <p></p> 2048 2049 2050 <p>Constant Value: 2051 2052 5 2053 (0x00000005) 2054 2055 2056</div> 2057 2058 2059 2060<A NAME="WAIT_FOR_EVENT_TMEOUT"></A> 2061 2062<div class="api apilevel-"> 2063 <h3 class="api-name">WAIT_FOR_EVENT_TMEOUT</h3> 2064 <div class="api-level"> 2065 2066 2067 2068 2069 </div> 2070<pre class="api-signature no-pretty-print"> 2071long WAIT_FOR_EVENT_TMEOUT</pre> 2072 2073 2074 2075 <p> 2076 <p class="caution"><strong> 2077 This constant is deprecated.</strong><br/> 2078 use <code><a href="/reference/android/support/test/uiautomator/Configurator.html#setScrollAcknowledgmentTimeout(long)">setScrollAcknowledgmentTimeout(long)</a></code> 2079 2080 </p> 2081 <p></p> 2082 2083 2084 <p>Constant Value: 2085 2086 3000 2087 (0x0000000000000bb8) 2088 2089 2090</div> 2091 2092 2093 2094<A NAME="WAIT_FOR_SELECTOR_POLL"></A> 2095 2096<div class="api apilevel-"> 2097 <h3 class="api-name">WAIT_FOR_SELECTOR_POLL</h3> 2098 <div class="api-level"> 2099 2100 2101 2102 2103 </div> 2104<pre class="api-signature no-pretty-print"> 2105long WAIT_FOR_SELECTOR_POLL</pre> 2106 2107 2108 2109 2110 <p></p> 2111 2112 2113 <p>Constant Value: 2114 2115 1000 2116 (0x00000000000003e8) 2117 2118 2119</div> 2120 2121 2122 2123<A NAME="WAIT_FOR_SELECTOR_TIMEOUT"></A> 2124 2125<div class="api apilevel-"> 2126 <h3 class="api-name">WAIT_FOR_SELECTOR_TIMEOUT</h3> 2127 <div class="api-level"> 2128 2129 2130 2131 2132 </div> 2133<pre class="api-signature no-pretty-print"> 2134long WAIT_FOR_SELECTOR_TIMEOUT</pre> 2135 2136 2137 2138 <p> 2139 <p class="caution"><strong> 2140 This constant is deprecated.</strong><br/> 2141 use <code><a href="/reference/android/support/test/uiautomator/Configurator.html#setWaitForSelectorTimeout(long)">setWaitForSelectorTimeout(long)</a></code> 2142 2143 </p> 2144 <p></p> 2145 2146 2147 <p>Constant Value: 2148 2149 10000 2150 (0x0000000000002710) 2151 2152 2153</div> 2154 2155 2156 2157<A NAME="WAIT_FOR_WINDOW_TMEOUT"></A> 2158 2159<div class="api apilevel-"> 2160 <h3 class="api-name">WAIT_FOR_WINDOW_TMEOUT</h3> 2161 <div class="api-level"> 2162 2163 2164 2165 2166 </div> 2167<pre class="api-signature no-pretty-print"> 2168long WAIT_FOR_WINDOW_TMEOUT</pre> 2169 2170 2171 2172 2173 <p></p> 2174 2175 2176 <p>Constant Value: 2177 2178 5500 2179 (0x000000000000157c) 2180 2181 2182</div> 2183 2184 2185 2186 2187<!-- Fields --> 2188 2189 2190<!-- Public ctors --> 2191 2192 2193<!-- ========= CONSTRUCTOR DETAIL ======== --> 2194<h2 class="api-section">Public constructors</h2> 2195 2196 2197 2198<A NAME="UiObject(android.support.test.uiautomator.UiSelector)"></A> 2199 2200<div class="api apilevel-"> 2201 <h3 class="api-name">UiObject</h3> 2202 <div class="api-level"> 2203 <div></div> 2204 2205 2206 2207 </div> 2208<pre class="api-signature no-pretty-print"> 2209UiObject (<a href="/reference/android/support/test/uiautomator/UiSelector.html">UiSelector</a> selector)</pre> 2210 2211 2212 2213 <p> 2214 <p class="caution"><strong> 2215 This constructor is deprecated.</strong><br/> 2216 Use <code><a href="/reference/android/support/test/uiautomator/UiDevice.html#findObject(android.support.test.uiautomator.UiSelector)">findObject(UiSelector)</a></code> instead. This version hides 2217 UiObject's dependency on UiDevice and is prone to misuse. 2218 </p> 2219 <p>Constructs a UiObject to represent a view that matches the specified 2220 selector criteria.</p> 2221 2222 2223</div> 2224 2225 2226 2227 2228 2229<!-- ========= CONSTRUCTOR DETAIL ======== --> 2230<!-- Protected ctors --> 2231 2232 2233 2234<!-- ========= METHOD DETAIL ======== --> 2235<!-- Public methdos --> 2236 2237<h2 class="api-section">Public methods</h2> 2238 2239 2240 2241<A NAME="clearTextField()"></A> 2242 2243<div class="api apilevel-"> 2244 <h3 class="api-name">clearTextField</h3> 2245 <div class="api-level"> 2246 <div></div> 2247 2248 2249 2250 </div> 2251<pre class="api-signature no-pretty-print"> 2252void clearTextField ()</pre> 2253 2254 2255 2256 2257 <p>Clears the existing text contents in an editable field. 2258 2259 The <code><a href="/reference/android/support/test/uiautomator/UiSelector.html">UiSelector</a></code> of this object must reference a UI element that is editable. 2260 2261 When you call this method, the method sets focus on the editable field, selects all of its 2262 existing content, and clears it by sending a DELETE key press</p> 2263 2264 <table class="responsive"> 2265 <tr><th colspan=2>Throws</th></tr> 2266 <tr> 2267 <td><code></code></td> 2268 <td width="100%">UiObjectNotFoundException</td> 2269 </tr> 2270 <tr> 2271 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 2272 <td width="100%"></td> 2273 </tr> 2274 </table> 2275 2276 2277</div> 2278 2279 2280<A NAME="click()"></A> 2281 2282<div class="api apilevel-"> 2283 <h3 class="api-name">click</h3> 2284 <div class="api-level"> 2285 <div></div> 2286 2287 2288 2289 </div> 2290<pre class="api-signature no-pretty-print"> 2291boolean click ()</pre> 2292 2293 2294 2295 2296 <p>Performs a click at the center of the visible bounds of the UI element represented 2297 by this UiObject.</p> 2298 2299 <table class="responsive"> 2300 <tr><th colspan=2>Returns</th></tr> 2301 <tr> 2302 <td><code>boolean</code></td> 2303 <td width="100%">true id successful else false</td> 2304 </tr> 2305 </table> 2306 <table class="responsive"> 2307 <tr><th colspan=2>Throws</th></tr> 2308 <tr> 2309 <td><code></code></td> 2310 <td width="100%">UiObjectNotFoundException</td> 2311 </tr> 2312 <tr> 2313 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 2314 <td width="100%"></td> 2315 </tr> 2316 </table> 2317 2318 2319</div> 2320 2321 2322<A NAME="clickAndWaitForNewWindow()"></A> 2323 2324<div class="api apilevel-"> 2325 <h3 class="api-name">clickAndWaitForNewWindow</h3> 2326 <div class="api-level"> 2327 <div></div> 2328 2329 2330 2331 </div> 2332<pre class="api-signature no-pretty-print"> 2333boolean clickAndWaitForNewWindow ()</pre> 2334 2335 2336 2337 2338 <p>Waits for window transitions that would typically take longer than the 2339 usual default timeouts. 2340 See <code><a href="/reference/android/support/test/uiautomator/UiObject.html#clickAndWaitForNewWindow(long)">clickAndWaitForNewWindow(long)</a></code></p> 2341 2342 <table class="responsive"> 2343 <tr><th colspan=2>Returns</th></tr> 2344 <tr> 2345 <td><code>boolean</code></td> 2346 <td width="100%">true if the event was triggered, else false</td> 2347 </tr> 2348 </table> 2349 <table class="responsive"> 2350 <tr><th colspan=2>Throws</th></tr> 2351 <tr> 2352 <td><code></code></td> 2353 <td width="100%">UiObjectNotFoundException</td> 2354 </tr> 2355 <tr> 2356 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 2357 <td width="100%"></td> 2358 </tr> 2359 </table> 2360 2361 2362</div> 2363 2364 2365<A NAME="clickAndWaitForNewWindow(long)"></A> 2366 2367<div class="api apilevel-"> 2368 <h3 class="api-name">clickAndWaitForNewWindow</h3> 2369 <div class="api-level"> 2370 <div></div> 2371 2372 2373 2374 </div> 2375<pre class="api-signature no-pretty-print"> 2376boolean clickAndWaitForNewWindow (long timeout)</pre> 2377 2378 2379 2380 2381 <p>Performs a click at the center of the visible bounds of the UI element represented 2382 by this UiObject and waits for window transitions. 2383 2384 This method differ from <code><a href="/reference/android/support/test/uiautomator/UiObject.html#click()">click()</a></code> only in that this method waits for a 2385 a new window transition as a result of the click. Some examples of a window transition: 2386 <li>launching a new activity</li> 2387 <li>bringing up a pop-up menu</li> 2388 <li>bringing up a dialog</li></p> 2389 2390 <table class="responsive"> 2391 <tr><th colspan=2>Parameters</th></tr> 2392 <tr> 2393 <td><code>timeout</code></td> 2394 <td width="100%"> 2395 <code>long</code>: 2396 timeout before giving up on waiting for a new window</td> 2397 </tr> 2398 </table> 2399 <table class="responsive"> 2400 <tr><th colspan=2>Returns</th></tr> 2401 <tr> 2402 <td><code>boolean</code></td> 2403 <td width="100%">true if the event was triggered, else false</td> 2404 </tr> 2405 </table> 2406 <table class="responsive"> 2407 <tr><th colspan=2>Throws</th></tr> 2408 <tr> 2409 <td><code></code></td> 2410 <td width="100%">UiObjectNotFoundException</td> 2411 </tr> 2412 <tr> 2413 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 2414 <td width="100%"></td> 2415 </tr> 2416 </table> 2417 2418 2419</div> 2420 2421 2422<A NAME="clickBottomRight()"></A> 2423 2424<div class="api apilevel-"> 2425 <h3 class="api-name">clickBottomRight</h3> 2426 <div class="api-level"> 2427 <div></div> 2428 2429 2430 2431 </div> 2432<pre class="api-signature no-pretty-print"> 2433boolean clickBottomRight ()</pre> 2434 2435 2436 2437 2438 <p>Clicks the bottom and right corner of the UI element</p> 2439 2440 <table class="responsive"> 2441 <tr><th colspan=2>Returns</th></tr> 2442 <tr> 2443 <td><code>boolean</code></td> 2444 <td width="100%">true on success</td> 2445 </tr> 2446 </table> 2447 <table class="responsive"> 2448 <tr><th colspan=2>Throws</th></tr> 2449 <tr> 2450 <td><code></code></td> 2451 <td width="100%">UiObjectNotFoundException</td> 2452 </tr> 2453 <tr> 2454 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 2455 <td width="100%"></td> 2456 </tr> 2457 </table> 2458 2459 2460</div> 2461 2462 2463<A NAME="clickTopLeft()"></A> 2464 2465<div class="api apilevel-"> 2466 <h3 class="api-name">clickTopLeft</h3> 2467 <div class="api-level"> 2468 <div></div> 2469 2470 2471 2472 </div> 2473<pre class="api-signature no-pretty-print"> 2474boolean clickTopLeft ()</pre> 2475 2476 2477 2478 2479 <p>Clicks the top and left corner of the UI element</p> 2480 2481 <table class="responsive"> 2482 <tr><th colspan=2>Returns</th></tr> 2483 <tr> 2484 <td><code>boolean</code></td> 2485 <td width="100%">true on success</td> 2486 </tr> 2487 </table> 2488 <table class="responsive"> 2489 <tr><th colspan=2>Throws</th></tr> 2490 <tr> 2491 <td><code></code></td> 2492 <td width="100%">UiObjectNotFoundException</td> 2493 </tr> 2494 <tr> 2495 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 2496 <td width="100%"></td> 2497 </tr> 2498 </table> 2499 2500 2501</div> 2502 2503 2504<A NAME="dragTo(android.support.test.uiautomator.UiObject, int)"></A> 2505 2506<div class="api apilevel-"> 2507 <h3 class="api-name">dragTo</h3> 2508 <div class="api-level"> 2509 <div></div> 2510 2511 2512 2513 </div> 2514<pre class="api-signature no-pretty-print"> 2515boolean dragTo (<a href="/reference/android/support/test/uiautomator/UiObject.html">UiObject</a> destObj, 2516 int steps)</pre> 2517 2518 2519 2520 2521 <p>Drags this object to a destination UiObject. 2522 The number of steps specified in your input parameter can influence the 2523 drag speed, and varying speeds may impact the results. Consider 2524 evaluating different speeds when using this method in your tests.</p> 2525 2526 <table class="responsive"> 2527 <tr><th colspan=2>Parameters</th></tr> 2528 <tr> 2529 <td><code>destObj</code></td> 2530 <td width="100%"> 2531 <code>UiObject</code>: 2532 the destination UiObject.</td> 2533 </tr> 2534 <tr> 2535 <td><code>steps</code></td> 2536 <td width="100%"> 2537 <code>int</code>: 2538 usually 40 steps. You can increase or decrease the steps to change the speed.</td> 2539 </tr> 2540 </table> 2541 <table class="responsive"> 2542 <tr><th colspan=2>Returns</th></tr> 2543 <tr> 2544 <td><code>boolean</code></td> 2545 <td width="100%">true if successful</td> 2546 </tr> 2547 </table> 2548 <table class="responsive"> 2549 <tr><th colspan=2>Throws</th></tr> 2550 <tr> 2551 <td><code></code></td> 2552 <td width="100%">UiObjectNotFoundException</td> 2553 </tr> 2554 <tr> 2555 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 2556 <td width="100%"></td> 2557 </tr> 2558 </table> 2559 2560 2561</div> 2562 2563 2564<A NAME="dragTo(int, int, int)"></A> 2565 2566<div class="api apilevel-"> 2567 <h3 class="api-name">dragTo</h3> 2568 <div class="api-level"> 2569 <div></div> 2570 2571 2572 2573 </div> 2574<pre class="api-signature no-pretty-print"> 2575boolean dragTo (int destX, 2576 int destY, 2577 int steps)</pre> 2578 2579 2580 2581 2582 <p>Drags this object to arbitrary coordinates. 2583 The number of steps specified in your input parameter can influence the 2584 drag speed, and varying speeds may impact the results. Consider 2585 evaluating different speeds when using this method in your tests.</p> 2586 2587 <table class="responsive"> 2588 <tr><th colspan=2>Parameters</th></tr> 2589 <tr> 2590 <td><code>destX</code></td> 2591 <td width="100%"> 2592 <code>int</code>: 2593 the X-axis coordinate.</td> 2594 </tr> 2595 <tr> 2596 <td><code>destY</code></td> 2597 <td width="100%"> 2598 <code>int</code>: 2599 the Y-axis coordinate.</td> 2600 </tr> 2601 <tr> 2602 <td><code>steps</code></td> 2603 <td width="100%"> 2604 <code>int</code>: 2605 usually 40 steps. You can increase or decrease the steps to change the speed.</td> 2606 </tr> 2607 </table> 2608 <table class="responsive"> 2609 <tr><th colspan=2>Returns</th></tr> 2610 <tr> 2611 <td><code>boolean</code></td> 2612 <td width="100%">true if successful</td> 2613 </tr> 2614 </table> 2615 <table class="responsive"> 2616 <tr><th colspan=2>Throws</th></tr> 2617 <tr> 2618 <td><code></code></td> 2619 <td width="100%">UiObjectNotFoundException</td> 2620 </tr> 2621 <tr> 2622 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 2623 <td width="100%"></td> 2624 </tr> 2625 </table> 2626 2627 2628</div> 2629 2630 2631<A NAME="exists()"></A> 2632 2633<div class="api apilevel-"> 2634 <h3 class="api-name">exists</h3> 2635 <div class="api-level"> 2636 <div></div> 2637 2638 2639 2640 </div> 2641<pre class="api-signature no-pretty-print"> 2642boolean exists ()</pre> 2643 2644 2645 2646 2647 <p>Check if view exists. 2648 2649 This methods performs a <code><a href="/reference/android/support/test/uiautomator/UiObject.html#waitForExists(long)">waitForExists(long)</a></code> with zero timeout. This 2650 basically returns immediately whether the view represented by this UiObject 2651 exists or not. If you need to wait longer for this view, then see 2652 <code><a href="/reference/android/support/test/uiautomator/UiObject.html#waitForExists(long)">waitForExists(long)</a></code>.</p> 2653 2654 <table class="responsive"> 2655 <tr><th colspan=2>Returns</th></tr> 2656 <tr> 2657 <td><code>boolean</code></td> 2658 <td width="100%">true if the view represented by this UiObject does exist</td> 2659 </tr> 2660 </table> 2661 2662</div> 2663 2664 2665<A NAME="getBounds()"></A> 2666 2667<div class="api apilevel-"> 2668 <h3 class="api-name">getBounds</h3> 2669 <div class="api-level"> 2670 <div></div> 2671 2672 2673 2674 </div> 2675<pre class="api-signature no-pretty-print"> 2676Rect getBounds ()</pre> 2677 2678 2679 2680 2681 <p>Returns the view's <code>bounds</code> property. See <code><a href="/reference/android/support/test/uiautomator/UiObject.html#getVisibleBounds()">getVisibleBounds()</a></code></p> 2682 2683 <table class="responsive"> 2684 <tr><th colspan=2>Returns</th></tr> 2685 <tr> 2686 <td><code>Rect</code></td> 2687 <td width="100%">Rect</td> 2688 </tr> 2689 </table> 2690 <table class="responsive"> 2691 <tr><th colspan=2>Throws</th></tr> 2692 <tr> 2693 <td><code></code></td> 2694 <td width="100%">UiObjectNotFoundException</td> 2695 </tr> 2696 <tr> 2697 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 2698 <td width="100%"></td> 2699 </tr> 2700 </table> 2701 2702 2703</div> 2704 2705 2706<A NAME="getChild(android.support.test.uiautomator.UiSelector)"></A> 2707 2708<div class="api apilevel-"> 2709 <h3 class="api-name">getChild</h3> 2710 <div class="api-level"> 2711 <div></div> 2712 2713 2714 2715 </div> 2716<pre class="api-signature no-pretty-print"> 2717<a href="/reference/android/support/test/uiautomator/UiObject.html">UiObject</a> getChild (<a href="/reference/android/support/test/uiautomator/UiSelector.html">UiSelector</a> selector)</pre> 2718 2719 2720 2721 2722 <p>Creates a new UiObject for a child view that is under the present UiObject.</p> 2723 2724 <table class="responsive"> 2725 <tr><th colspan=2>Parameters</th></tr> 2726 <tr> 2727 <td><code>selector</code></td> 2728 <td width="100%"> 2729 <code>UiSelector</code>: 2730 for child view to match</td> 2731 </tr> 2732 </table> 2733 <table class="responsive"> 2734 <tr><th colspan=2>Returns</th></tr> 2735 <tr> 2736 <td><code><a href="/reference/android/support/test/uiautomator/UiObject.html">UiObject</a></code></td> 2737 <td width="100%">a new UiObject representing the child view</td> 2738 </tr> 2739 </table> 2740 <table class="responsive"> 2741 <tr><th colspan=2>Throws</th></tr> 2742 <tr> 2743 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 2744 <td width="100%"></td> 2745 </tr> 2746 </table> 2747 2748 2749</div> 2750 2751 2752<A NAME="getChildCount()"></A> 2753 2754<div class="api apilevel-"> 2755 <h3 class="api-name">getChildCount</h3> 2756 <div class="api-level"> 2757 <div></div> 2758 2759 2760 2761 </div> 2762<pre class="api-signature no-pretty-print"> 2763int getChildCount ()</pre> 2764 2765 2766 2767 2768 <p>Counts the child views immediately under the present UiObject.</p> 2769 2770 <table class="responsive"> 2771 <tr><th colspan=2>Returns</th></tr> 2772 <tr> 2773 <td><code>int</code></td> 2774 <td width="100%">the count of child views.</td> 2775 </tr> 2776 </table> 2777 <table class="responsive"> 2778 <tr><th colspan=2>Throws</th></tr> 2779 <tr> 2780 <td><code></code></td> 2781 <td width="100%">UiObjectNotFoundException</td> 2782 </tr> 2783 <tr> 2784 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 2785 <td width="100%"></td> 2786 </tr> 2787 </table> 2788 2789 2790</div> 2791 2792 2793<A NAME="getClassName()"></A> 2794 2795<div class="api apilevel-"> 2796 <h3 class="api-name">getClassName</h3> 2797 <div class="api-level"> 2798 <div></div> 2799 2800 2801 2802 </div> 2803<pre class="api-signature no-pretty-print"> 2804String getClassName ()</pre> 2805 2806 2807 2808 2809 <p>Retrieves the <code>className</code> property of the UI element.</p> 2810 2811 <table class="responsive"> 2812 <tr><th colspan=2>Returns</th></tr> 2813 <tr> 2814 <td><code>String</code></td> 2815 <td width="100%">class name of the current node represented by this UiObject</td> 2816 </tr> 2817 </table> 2818 <table class="responsive"> 2819 <tr><th colspan=2>Throws</th></tr> 2820 <tr> 2821 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 2822 <td width="100%">if no match was found</td> 2823 </tr> 2824 </table> 2825 2826 2827</div> 2828 2829 2830<A NAME="getContentDescription()"></A> 2831 2832<div class="api apilevel-"> 2833 <h3 class="api-name">getContentDescription</h3> 2834 <div class="api-level"> 2835 <div></div> 2836 2837 2838 2839 </div> 2840<pre class="api-signature no-pretty-print"> 2841String getContentDescription ()</pre> 2842 2843 2844 2845 2846 <p>Reads the <code>content_desc</code> property of the UI element</p> 2847 2848 <table class="responsive"> 2849 <tr><th colspan=2>Returns</th></tr> 2850 <tr> 2851 <td><code>String</code></td> 2852 <td width="100%">value of node attribute "content_desc"</td> 2853 </tr> 2854 </table> 2855 <table class="responsive"> 2856 <tr><th colspan=2>Throws</th></tr> 2857 <tr> 2858 <td><code></code></td> 2859 <td width="100%">UiObjectNotFoundException</td> 2860 </tr> 2861 <tr> 2862 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 2863 <td width="100%"></td> 2864 </tr> 2865 </table> 2866 2867 2868</div> 2869 2870 2871<A NAME="getFromParent(android.support.test.uiautomator.UiSelector)"></A> 2872 2873<div class="api apilevel-"> 2874 <h3 class="api-name">getFromParent</h3> 2875 <div class="api-level"> 2876 <div></div> 2877 2878 2879 2880 </div> 2881<pre class="api-signature no-pretty-print"> 2882<a href="/reference/android/support/test/uiautomator/UiObject.html">UiObject</a> getFromParent (<a href="/reference/android/support/test/uiautomator/UiSelector.html">UiSelector</a> selector)</pre> 2883 2884 2885 2886 2887 <p>Creates a new UiObject for a sibling view or a child of the sibling view, 2888 relative to the present UiObject.</p> 2889 2890 <table class="responsive"> 2891 <tr><th colspan=2>Parameters</th></tr> 2892 <tr> 2893 <td><code>selector</code></td> 2894 <td width="100%"> 2895 <code>UiSelector</code>: 2896 for a sibling view or children of the sibling view</td> 2897 </tr> 2898 </table> 2899 <table class="responsive"> 2900 <tr><th colspan=2>Returns</th></tr> 2901 <tr> 2902 <td><code><a href="/reference/android/support/test/uiautomator/UiObject.html">UiObject</a></code></td> 2903 <td width="100%">a new UiObject representing the matched view</td> 2904 </tr> 2905 </table> 2906 <table class="responsive"> 2907 <tr><th colspan=2>Throws</th></tr> 2908 <tr> 2909 <td><code></code></td> 2910 <td width="100%">UiObjectNotFoundException</td> 2911 </tr> 2912 <tr> 2913 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 2914 <td width="100%"></td> 2915 </tr> 2916 </table> 2917 2918 2919</div> 2920 2921 2922<A NAME="getPackageName()"></A> 2923 2924<div class="api apilevel-"> 2925 <h3 class="api-name">getPackageName</h3> 2926 <div class="api-level"> 2927 <div></div> 2928 2929 2930 2931 </div> 2932<pre class="api-signature no-pretty-print"> 2933String getPackageName ()</pre> 2934 2935 2936 2937 2938 <p>Reads the view's <code>package</code> property</p> 2939 2940 <table class="responsive"> 2941 <tr><th colspan=2>Returns</th></tr> 2942 <tr> 2943 <td><code>String</code></td> 2944 <td width="100%">true if it is else false</td> 2945 </tr> 2946 </table> 2947 <table class="responsive"> 2948 <tr><th colspan=2>Throws</th></tr> 2949 <tr> 2950 <td><code></code></td> 2951 <td width="100%">UiObjectNotFoundException</td> 2952 </tr> 2953 <tr> 2954 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 2955 <td width="100%"></td> 2956 </tr> 2957 </table> 2958 2959 2960</div> 2961 2962 2963<A NAME="getSelector()"></A> 2964 2965<div class="api apilevel-"> 2966 <h3 class="api-name">getSelector</h3> 2967 <div class="api-level"> 2968 <div></div> 2969 2970 2971 2972 </div> 2973<pre class="api-signature no-pretty-print"> 2974<a href="/reference/android/support/test/uiautomator/UiSelector.html">UiSelector</a> getSelector ()</pre> 2975 2976 2977 2978 2979 <p>Debugging helper. A test can dump the properties of a selector as a string 2980 to its logs if needed. <code>getSelector().toString();</code></p> 2981 2982 <table class="responsive"> 2983 <tr><th colspan=2>Returns</th></tr> 2984 <tr> 2985 <td><code><a href="/reference/android/support/test/uiautomator/UiSelector.html">UiSelector</a></code></td> 2986 <td width="100%"><code><a href="/reference/android/support/test/uiautomator/UiSelector.html">UiSelector</a></code></td> 2987 </tr> 2988 </table> 2989 2990</div> 2991 2992 2993<A NAME="getText()"></A> 2994 2995<div class="api apilevel-"> 2996 <h3 class="api-name">getText</h3> 2997 <div class="api-level"> 2998 <div></div> 2999 3000 3001 3002 </div> 3003<pre class="api-signature no-pretty-print"> 3004String getText ()</pre> 3005 3006 3007 3008 3009 <p>Reads the <code>text</code> property of the UI element</p> 3010 3011 <table class="responsive"> 3012 <tr><th colspan=2>Returns</th></tr> 3013 <tr> 3014 <td><code>String</code></td> 3015 <td width="100%">text value of the current node represented by this UiObject</td> 3016 </tr> 3017 </table> 3018 <table class="responsive"> 3019 <tr><th colspan=2>Throws</th></tr> 3020 <tr> 3021 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 3022 <td width="100%">if no match could be found</td> 3023 </tr> 3024 </table> 3025 3026 3027</div> 3028 3029 3030<A NAME="getVisibleBounds()"></A> 3031 3032<div class="api apilevel-"> 3033 <h3 class="api-name">getVisibleBounds</h3> 3034 <div class="api-level"> 3035 <div></div> 3036 3037 3038 3039 </div> 3040<pre class="api-signature no-pretty-print"> 3041Rect getVisibleBounds ()</pre> 3042 3043 3044 3045 3046 <p>Returns the visible bounds of the view. 3047 3048 If a portion of the view is visible, only the bounds of the visible portion are 3049 reported.</p> 3050 3051 <table class="responsive"> 3052 <tr><th colspan=2>Returns</th></tr> 3053 <tr> 3054 <td><code>Rect</code></td> 3055 <td width="100%">Rect</td> 3056 </tr> 3057 </table> 3058 <table class="responsive"> 3059 <tr><th colspan=2>Throws</th></tr> 3060 <tr> 3061 <td><code></code></td> 3062 <td width="100%">UiObjectNotFoundException</td> 3063 </tr> 3064 <tr> 3065 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 3066 <td width="100%"></td> 3067 </tr> 3068 </table> 3069 3070 <div> 3071 <p><b>See also:</b></p> 3072 <ul class="nolist"><li><code><a href="/reference/android/support/test/uiautomator/UiObject.html#getBounds()">getBounds()</a></code></li> 3073 </ul> 3074 </div> 3075 3076</div> 3077 3078 3079<A NAME="isCheckable()"></A> 3080 3081<div class="api apilevel-"> 3082 <h3 class="api-name">isCheckable</h3> 3083 <div class="api-level"> 3084 <div></div> 3085 3086 3087 3088 </div> 3089<pre class="api-signature no-pretty-print"> 3090boolean isCheckable ()</pre> 3091 3092 3093 3094 3095 <p>Checks if the UI element's <code>checkable</code> property is currently true.</p> 3096 3097 <table class="responsive"> 3098 <tr><th colspan=2>Returns</th></tr> 3099 <tr> 3100 <td><code>boolean</code></td> 3101 <td width="100%">true if it is else false</td> 3102 </tr> 3103 </table> 3104 <table class="responsive"> 3105 <tr><th colspan=2>Throws</th></tr> 3106 <tr> 3107 <td><code></code></td> 3108 <td width="100%">UiObjectNotFoundException</td> 3109 </tr> 3110 <tr> 3111 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 3112 <td width="100%"></td> 3113 </tr> 3114 </table> 3115 3116 3117</div> 3118 3119 3120<A NAME="isChecked()"></A> 3121 3122<div class="api apilevel-"> 3123 <h3 class="api-name">isChecked</h3> 3124 <div class="api-level"> 3125 <div></div> 3126 3127 3128 3129 </div> 3130<pre class="api-signature no-pretty-print"> 3131boolean isChecked ()</pre> 3132 3133 3134 3135 3136 <p>Check if the UI element's <code>checked</code> property is currently true</p> 3137 3138 <table class="responsive"> 3139 <tr><th colspan=2>Returns</th></tr> 3140 <tr> 3141 <td><code>boolean</code></td> 3142 <td width="100%">true if it is else false</td> 3143 </tr> 3144 </table> 3145 <table class="responsive"> 3146 <tr><th colspan=2>Throws</th></tr> 3147 <tr> 3148 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 3149 <td width="100%"></td> 3150 </tr> 3151 </table> 3152 3153 3154</div> 3155 3156 3157<A NAME="isClickable()"></A> 3158 3159<div class="api apilevel-"> 3160 <h3 class="api-name">isClickable</h3> 3161 <div class="api-level"> 3162 <div></div> 3163 3164 3165 3166 </div> 3167<pre class="api-signature no-pretty-print"> 3168boolean isClickable ()</pre> 3169 3170 3171 3172 3173 <p>Checks if the UI element's <code>clickable</code> property is currently true.</p> 3174 3175 <table class="responsive"> 3176 <tr><th colspan=2>Returns</th></tr> 3177 <tr> 3178 <td><code>boolean</code></td> 3179 <td width="100%">true if it is else false</td> 3180 </tr> 3181 </table> 3182 <table class="responsive"> 3183 <tr><th colspan=2>Throws</th></tr> 3184 <tr> 3185 <td><code></code></td> 3186 <td width="100%">UiObjectNotFoundException</td> 3187 </tr> 3188 <tr> 3189 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 3190 <td width="100%"></td> 3191 </tr> 3192 </table> 3193 3194 3195</div> 3196 3197 3198<A NAME="isEnabled()"></A> 3199 3200<div class="api apilevel-"> 3201 <h3 class="api-name">isEnabled</h3> 3202 <div class="api-level"> 3203 <div></div> 3204 3205 3206 3207 </div> 3208<pre class="api-signature no-pretty-print"> 3209boolean isEnabled ()</pre> 3210 3211 3212 3213 3214 <p>Checks if the UI element's <code>enabled</code> property is currently true.</p> 3215 3216 <table class="responsive"> 3217 <tr><th colspan=2>Returns</th></tr> 3218 <tr> 3219 <td><code>boolean</code></td> 3220 <td width="100%">true if it is else false</td> 3221 </tr> 3222 </table> 3223 <table class="responsive"> 3224 <tr><th colspan=2>Throws</th></tr> 3225 <tr> 3226 <td><code></code></td> 3227 <td width="100%">UiObjectNotFoundException</td> 3228 </tr> 3229 <tr> 3230 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 3231 <td width="100%"></td> 3232 </tr> 3233 </table> 3234 3235 3236</div> 3237 3238 3239<A NAME="isFocusable()"></A> 3240 3241<div class="api apilevel-"> 3242 <h3 class="api-name">isFocusable</h3> 3243 <div class="api-level"> 3244 <div></div> 3245 3246 3247 3248 </div> 3249<pre class="api-signature no-pretty-print"> 3250boolean isFocusable ()</pre> 3251 3252 3253 3254 3255 <p>Check if the UI element's <code>focusable</code> property is currently true.</p> 3256 3257 <table class="responsive"> 3258 <tr><th colspan=2>Returns</th></tr> 3259 <tr> 3260 <td><code>boolean</code></td> 3261 <td width="100%">true if it is else false</td> 3262 </tr> 3263 </table> 3264 <table class="responsive"> 3265 <tr><th colspan=2>Throws</th></tr> 3266 <tr> 3267 <td><code></code></td> 3268 <td width="100%">UiObjectNotFoundException</td> 3269 </tr> 3270 <tr> 3271 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 3272 <td width="100%"></td> 3273 </tr> 3274 </table> 3275 3276 3277</div> 3278 3279 3280<A NAME="isFocused()"></A> 3281 3282<div class="api apilevel-"> 3283 <h3 class="api-name">isFocused</h3> 3284 <div class="api-level"> 3285 <div></div> 3286 3287 3288 3289 </div> 3290<pre class="api-signature no-pretty-print"> 3291boolean isFocused ()</pre> 3292 3293 3294 3295 3296 <p>Check if the UI element's <code>focused</code> property is currently true</p> 3297 3298 <table class="responsive"> 3299 <tr><th colspan=2>Returns</th></tr> 3300 <tr> 3301 <td><code>boolean</code></td> 3302 <td width="100%">true if it is else false</td> 3303 </tr> 3304 </table> 3305 <table class="responsive"> 3306 <tr><th colspan=2>Throws</th></tr> 3307 <tr> 3308 <td><code></code></td> 3309 <td width="100%">UiObjectNotFoundException</td> 3310 </tr> 3311 <tr> 3312 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 3313 <td width="100%"></td> 3314 </tr> 3315 </table> 3316 3317 3318</div> 3319 3320 3321<A NAME="isLongClickable()"></A> 3322 3323<div class="api apilevel-"> 3324 <h3 class="api-name">isLongClickable</h3> 3325 <div class="api-level"> 3326 <div></div> 3327 3328 3329 3330 </div> 3331<pre class="api-signature no-pretty-print"> 3332boolean isLongClickable ()</pre> 3333 3334 3335 3336 3337 <p>Check if the view's <code>long-clickable</code> property is currently true</p> 3338 3339 <table class="responsive"> 3340 <tr><th colspan=2>Returns</th></tr> 3341 <tr> 3342 <td><code>boolean</code></td> 3343 <td width="100%">true if it is else false</td> 3344 </tr> 3345 </table> 3346 <table class="responsive"> 3347 <tr><th colspan=2>Throws</th></tr> 3348 <tr> 3349 <td><code></code></td> 3350 <td width="100%">UiObjectNotFoundException</td> 3351 </tr> 3352 <tr> 3353 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 3354 <td width="100%"></td> 3355 </tr> 3356 </table> 3357 3358 3359</div> 3360 3361 3362<A NAME="isScrollable()"></A> 3363 3364<div class="api apilevel-"> 3365 <h3 class="api-name">isScrollable</h3> 3366 <div class="api-level"> 3367 <div></div> 3368 3369 3370 3371 </div> 3372<pre class="api-signature no-pretty-print"> 3373boolean isScrollable ()</pre> 3374 3375 3376 3377 3378 <p>Check if the view's <code>scrollable</code> property is currently true</p> 3379 3380 <table class="responsive"> 3381 <tr><th colspan=2>Returns</th></tr> 3382 <tr> 3383 <td><code>boolean</code></td> 3384 <td width="100%">true if it is else false</td> 3385 </tr> 3386 </table> 3387 <table class="responsive"> 3388 <tr><th colspan=2>Throws</th></tr> 3389 <tr> 3390 <td><code></code></td> 3391 <td width="100%">UiObjectNotFoundException</td> 3392 </tr> 3393 <tr> 3394 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 3395 <td width="100%"></td> 3396 </tr> 3397 </table> 3398 3399 3400</div> 3401 3402 3403<A NAME="isSelected()"></A> 3404 3405<div class="api apilevel-"> 3406 <h3 class="api-name">isSelected</h3> 3407 <div class="api-level"> 3408 <div></div> 3409 3410 3411 3412 </div> 3413<pre class="api-signature no-pretty-print"> 3414boolean isSelected ()</pre> 3415 3416 3417 3418 3419 <p>Checks if the UI element's <code>selected</code> property is currently true.</p> 3420 3421 <table class="responsive"> 3422 <tr><th colspan=2>Returns</th></tr> 3423 <tr> 3424 <td><code>boolean</code></td> 3425 <td width="100%">true if it is else false</td> 3426 </tr> 3427 </table> 3428 <table class="responsive"> 3429 <tr><th colspan=2>Throws</th></tr> 3430 <tr> 3431 <td><code></code></td> 3432 <td width="100%">UiObjectNotFoundException</td> 3433 </tr> 3434 <tr> 3435 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 3436 <td width="100%"></td> 3437 </tr> 3438 </table> 3439 3440 3441</div> 3442 3443 3444<A NAME="longClick()"></A> 3445 3446<div class="api apilevel-"> 3447 <h3 class="api-name">longClick</h3> 3448 <div class="api-level"> 3449 <div></div> 3450 3451 3452 3453 </div> 3454<pre class="api-signature no-pretty-print"> 3455boolean longClick ()</pre> 3456 3457 3458 3459 3460 <p>Long clicks the center of the visible bounds of the UI element</p> 3461 3462 <table class="responsive"> 3463 <tr><th colspan=2>Returns</th></tr> 3464 <tr> 3465 <td><code>boolean</code></td> 3466 <td width="100%">true if operation was successful</td> 3467 </tr> 3468 </table> 3469 <table class="responsive"> 3470 <tr><th colspan=2>Throws</th></tr> 3471 <tr> 3472 <td><code></code></td> 3473 <td width="100%">UiObjectNotFoundException</td> 3474 </tr> 3475 <tr> 3476 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 3477 <td width="100%"></td> 3478 </tr> 3479 </table> 3480 3481 3482</div> 3483 3484 3485<A NAME="longClickBottomRight()"></A> 3486 3487<div class="api apilevel-"> 3488 <h3 class="api-name">longClickBottomRight</h3> 3489 <div class="api-level"> 3490 <div></div> 3491 3492 3493 3494 </div> 3495<pre class="api-signature no-pretty-print"> 3496boolean longClickBottomRight ()</pre> 3497 3498 3499 3500 3501 <p>Long clicks bottom and right corner of the UI element</p> 3502 3503 <table class="responsive"> 3504 <tr><th colspan=2>Returns</th></tr> 3505 <tr> 3506 <td><code>boolean</code></td> 3507 <td width="100%">true if operation was successful</td> 3508 </tr> 3509 </table> 3510 <table class="responsive"> 3511 <tr><th colspan=2>Throws</th></tr> 3512 <tr> 3513 <td><code></code></td> 3514 <td width="100%">UiObjectNotFoundException</td> 3515 </tr> 3516 <tr> 3517 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 3518 <td width="100%"></td> 3519 </tr> 3520 </table> 3521 3522 3523</div> 3524 3525 3526<A NAME="longClickTopLeft()"></A> 3527 3528<div class="api apilevel-"> 3529 <h3 class="api-name">longClickTopLeft</h3> 3530 <div class="api-level"> 3531 <div></div> 3532 3533 3534 3535 </div> 3536<pre class="api-signature no-pretty-print"> 3537boolean longClickTopLeft ()</pre> 3538 3539 3540 3541 3542 <p>Long clicks on the top and left corner of the UI element</p> 3543 3544 <table class="responsive"> 3545 <tr><th colspan=2>Returns</th></tr> 3546 <tr> 3547 <td><code>boolean</code></td> 3548 <td width="100%">true if operation was successful</td> 3549 </tr> 3550 </table> 3551 <table class="responsive"> 3552 <tr><th colspan=2>Throws</th></tr> 3553 <tr> 3554 <td><code></code></td> 3555 <td width="100%">UiObjectNotFoundException</td> 3556 </tr> 3557 <tr> 3558 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 3559 <td width="100%"></td> 3560 </tr> 3561 </table> 3562 3563 3564</div> 3565 3566 3567<A NAME="performMultiPointerGesture(android.view.MotionEvent.PointerCoords[]...)"></A> 3568 3569<div class="api apilevel-"> 3570 <h3 class="api-name">performMultiPointerGesture</h3> 3571 <div class="api-level"> 3572 <div></div> 3573 3574 3575 3576 </div> 3577<pre class="api-signature no-pretty-print"> 3578boolean performMultiPointerGesture (PointerCoords... touches)</pre> 3579 3580 3581 3582 3583 <p>Performs a multi-touch gesture. You must specify touch coordinates for 3584 at least 2 pointers. Each pointer must have all of its touch steps 3585 defined in an array of <code><a href="/reference/android/view/MotionEvent.PointerCoords.html">MotionEvent.PointerCoords</a></code>. You can use this method to 3586 specify complex gestures, like circles and irregular shapes, where each 3587 pointer may take a different path. 3588 3589 To create a single point on a pointer's touch path: 3590 <code> 3591 PointerCoords p = new PointerCoords(); 3592 p.x = stepX; 3593 p.y = stepY; 3594 p.pressure = 1; 3595 p.size = 1; 3596 </code></p> 3597 3598 <table class="responsive"> 3599 <tr><th colspan=2>Parameters</th></tr> 3600 <tr> 3601 <td><code>touches</code></td> 3602 <td width="100%"> 3603 <code>PointerCoords</code>: 3604 represents the pointers' paths. Each <code><a href="/reference/android/view/MotionEvent.PointerCoords.html">MotionEvent.PointerCoords</a></code> 3605 array represents a different pointer. Each <code><a href="/reference/android/view/MotionEvent.PointerCoords.html">MotionEvent.PointerCoords</a></code> in an 3606 array element represents a touch point on a pointer's path.</td> 3607 </tr> 3608 </table> 3609 <table class="responsive"> 3610 <tr><th colspan=2>Returns</th></tr> 3611 <tr> 3612 <td><code>boolean</code></td> 3613 <td width="100%"><code>true</code> if all touch events for this gesture are injected successfully, 3614 <code>false</code> otherwise</td> 3615 </tr> 3616 </table> 3617 3618</div> 3619 3620 3621<A NAME="performTwoPointerGesture(android.graphics.Point, android.graphics.Point, android.graphics.Point, android.graphics.Point, int)"></A> 3622 3623<div class="api apilevel-"> 3624 <h3 class="api-name">performTwoPointerGesture</h3> 3625 <div class="api-level"> 3626 <div></div> 3627 3628 3629 3630 </div> 3631<pre class="api-signature no-pretty-print"> 3632boolean performTwoPointerGesture (Point startPoint1, 3633 Point startPoint2, 3634 Point endPoint1, 3635 Point endPoint2, 3636 int steps)</pre> 3637 3638 3639 3640 3641 <p>Generates a two-pointer gesture with arbitrary starting and ending points.</p> 3642 3643 <table class="responsive"> 3644 <tr><th colspan=2>Parameters</th></tr> 3645 <tr> 3646 <td><code>startPoint1</code></td> 3647 <td width="100%"> 3648 <code>Point</code>: 3649 start point of pointer 1</td> 3650 </tr> 3651 <tr> 3652 <td><code>startPoint2</code></td> 3653 <td width="100%"> 3654 <code>Point</code>: 3655 start point of pointer 2</td> 3656 </tr> 3657 <tr> 3658 <td><code>endPoint1</code></td> 3659 <td width="100%"> 3660 <code>Point</code>: 3661 end point of pointer 1</td> 3662 </tr> 3663 <tr> 3664 <td><code>endPoint2</code></td> 3665 <td width="100%"> 3666 <code>Point</code>: 3667 end point of pointer 2</td> 3668 </tr> 3669 <tr> 3670 <td><code>steps</code></td> 3671 <td width="100%"> 3672 <code>int</code>: 3673 the number of steps for the gesture. Steps are injected 3674 about 5 milliseconds apart, so 100 steps may take around 0.5 seconds to complete.</td> 3675 </tr> 3676 </table> 3677 <table class="responsive"> 3678 <tr><th colspan=2>Returns</th></tr> 3679 <tr> 3680 <td><code>boolean</code></td> 3681 <td width="100%"><code>true</code> if all touch events for this gesture are injected successfully, 3682 <code>false</code> otherwise</td> 3683 </tr> 3684 </table> 3685 3686</div> 3687 3688 3689<A NAME="pinchIn(int, int)"></A> 3690 3691<div class="api apilevel-"> 3692 <h3 class="api-name">pinchIn</h3> 3693 <div class="api-level"> 3694 <div></div> 3695 3696 3697 3698 </div> 3699<pre class="api-signature no-pretty-print"> 3700boolean pinchIn (int percent, 3701 int steps)</pre> 3702 3703 3704 3705 3706 <p>Performs a two-pointer gesture, where each pointer moves diagonally 3707 toward the other, from the edges to the center of this UiObject .</p> 3708 3709 <table class="responsive"> 3710 <tr><th colspan=2>Parameters</th></tr> 3711 <tr> 3712 <td><code>percent</code></td> 3713 <td width="100%"> 3714 <code>int</code>: 3715 percentage of the object's diagonal length for the pinch gesture</td> 3716 </tr> 3717 <tr> 3718 <td><code>steps</code></td> 3719 <td width="100%"> 3720 <code>int</code>: 3721 the number of steps for the gesture. Steps are injected 3722 about 5 milliseconds apart, so 100 steps may take around 0.5 seconds to complete.</td> 3723 </tr> 3724 </table> 3725 <table class="responsive"> 3726 <tr><th colspan=2>Returns</th></tr> 3727 <tr> 3728 <td><code>boolean</code></td> 3729 <td width="100%"><code>true</code> if all touch events for this gesture are injected successfully, 3730 <code>false</code> otherwise</td> 3731 </tr> 3732 </table> 3733 <table class="responsive"> 3734 <tr><th colspan=2>Throws</th></tr> 3735 <tr> 3736 <td><code></code></td> 3737 <td width="100%">UiObjectNotFoundException</td> 3738 </tr> 3739 <tr> 3740 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 3741 <td width="100%"></td> 3742 </tr> 3743 </table> 3744 3745 3746</div> 3747 3748 3749<A NAME="pinchOut(int, int)"></A> 3750 3751<div class="api apilevel-"> 3752 <h3 class="api-name">pinchOut</h3> 3753 <div class="api-level"> 3754 <div></div> 3755 3756 3757 3758 </div> 3759<pre class="api-signature no-pretty-print"> 3760boolean pinchOut (int percent, 3761 int steps)</pre> 3762 3763 3764 3765 3766 <p>Performs a two-pointer gesture, where each pointer moves diagonally 3767 opposite across the other, from the center out towards the edges of the 3768 this UiObject.</p> 3769 3770 <table class="responsive"> 3771 <tr><th colspan=2>Parameters</th></tr> 3772 <tr> 3773 <td><code>percent</code></td> 3774 <td width="100%"> 3775 <code>int</code>: 3776 percentage of the object's diagonal length for the pinch gesture</td> 3777 </tr> 3778 <tr> 3779 <td><code>steps</code></td> 3780 <td width="100%"> 3781 <code>int</code>: 3782 the number of steps for the gesture. Steps are injected 3783 about 5 milliseconds apart, so 100 steps may take around 0.5 seconds to complete.</td> 3784 </tr> 3785 </table> 3786 <table class="responsive"> 3787 <tr><th colspan=2>Returns</th></tr> 3788 <tr> 3789 <td><code>boolean</code></td> 3790 <td width="100%"><code>true</code> if all touch events for this gesture are injected successfully, 3791 <code>false</code> otherwise</td> 3792 </tr> 3793 </table> 3794 <table class="responsive"> 3795 <tr><th colspan=2>Throws</th></tr> 3796 <tr> 3797 <td><code></code></td> 3798 <td width="100%">UiObjectNotFoundException</td> 3799 </tr> 3800 <tr> 3801 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 3802 <td width="100%"></td> 3803 </tr> 3804 </table> 3805 3806 3807</div> 3808 3809 3810<A NAME="setText(java.lang.String)"></A> 3811 3812<div class="api apilevel-"> 3813 <h3 class="api-name">setText</h3> 3814 <div class="api-level"> 3815 <div></div> 3816 3817 3818 3819 </div> 3820<pre class="api-signature no-pretty-print"> 3821boolean setText (String text)</pre> 3822 3823 3824 3825 3826 <p>Sets the text in an editable field, after clearing the field's content. 3827 3828 <p> 3829 The <code><a href="/reference/android/support/test/uiautomator/UiSelector.html">UiSelector</a></code> selector of this object must reference a UI element that is editable. 3830 3831 <p> 3832 When you call this method, the method sets focus on the editable field, clears its existing 3833 content, then injects your specified text into the field. 3834 3835 <p> 3836 If you want to capture the original contents of the field, call <code><a href="/reference/android/support/test/uiautomator/UiObject.html#getText()">getText()</a></code> first. 3837 You can then modify the text and use this method to update the field. 3838 3839 <p><strong>Improvements: </strong> 3840 Post API Level 19 (KitKat release), the underlying implementation is updated to a dedicated 3841 set text accessibility action, and it also now supports Unicode.</p> 3842 3843 <table class="responsive"> 3844 <tr><th colspan=2>Parameters</th></tr> 3845 <tr> 3846 <td><code>text</code></td> 3847 <td width="100%"> 3848 <code>String</code>: 3849 string to set</td> 3850 </tr> 3851 </table> 3852 <table class="responsive"> 3853 <tr><th colspan=2>Returns</th></tr> 3854 <tr> 3855 <td><code>boolean</code></td> 3856 <td width="100%">true if operation is successful</td> 3857 </tr> 3858 </table> 3859 <table class="responsive"> 3860 <tr><th colspan=2>Throws</th></tr> 3861 <tr> 3862 <td><code></code></td> 3863 <td width="100%">UiObjectNotFoundException</td> 3864 </tr> 3865 <tr> 3866 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 3867 <td width="100%"></td> 3868 </tr> 3869 </table> 3870 3871 3872</div> 3873 3874 3875<A NAME="swipeDown(int)"></A> 3876 3877<div class="api apilevel-"> 3878 <h3 class="api-name">swipeDown</h3> 3879 <div class="api-level"> 3880 <div></div> 3881 3882 3883 3884 </div> 3885<pre class="api-signature no-pretty-print"> 3886boolean swipeDown (int steps)</pre> 3887 3888 3889 3890 3891 <p>Performs the swipe down action on the UiObject. 3892 The swipe gesture can be performed over any surface. The targeted 3893 UI element does not need to be scrollable. 3894 See also: 3895 <ul> 3896 <li><code><a href="/reference/android/support/test/uiautomator/UiScrollable.html#scrollToBeginning(int)">scrollToBeginning(int)</a></code></li> 3897 <li><code><a href="/reference/android/support/test/uiautomator/UiScrollable.html#scrollToEnd(int)">scrollToEnd(int)</a></code></li> 3898 <li><code><a href="/reference/android/support/test/uiautomator/UiScrollable.html#scrollBackward()">scrollBackward()</a></code></li> 3899 <li><code><a href="/reference/android/support/test/uiautomator/UiScrollable.html#scrollForward()">scrollForward()</a></code></li> 3900 </ul></p> 3901 3902 <table class="responsive"> 3903 <tr><th colspan=2>Parameters</th></tr> 3904 <tr> 3905 <td><code>steps</code></td> 3906 <td width="100%"> 3907 <code>int</code>: 3908 indicates the number of injected move steps into the system. Steps are 3909 injected about 5ms apart. So a 100 steps may take about 1/2 second to complete.</td> 3910 </tr> 3911 </table> 3912 <table class="responsive"> 3913 <tr><th colspan=2>Returns</th></tr> 3914 <tr> 3915 <td><code>boolean</code></td> 3916 <td width="100%">true if successful</td> 3917 </tr> 3918 </table> 3919 <table class="responsive"> 3920 <tr><th colspan=2>Throws</th></tr> 3921 <tr> 3922 <td><code></code></td> 3923 <td width="100%">UiObjectNotFoundException</td> 3924 </tr> 3925 <tr> 3926 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 3927 <td width="100%"></td> 3928 </tr> 3929 </table> 3930 3931 3932</div> 3933 3934 3935<A NAME="swipeLeft(int)"></A> 3936 3937<div class="api apilevel-"> 3938 <h3 class="api-name">swipeLeft</h3> 3939 <div class="api-level"> 3940 <div></div> 3941 3942 3943 3944 </div> 3945<pre class="api-signature no-pretty-print"> 3946boolean swipeLeft (int steps)</pre> 3947 3948 3949 3950 3951 <p>Performs the swipe left action on the UiObject. 3952 The swipe gesture can be performed over any surface. The targeted 3953 UI element does not need to be scrollable. 3954 See also: 3955 <ul> 3956 <li><code><a href="/reference/android/support/test/uiautomator/UiScrollable.html#scrollToBeginning(int)">scrollToBeginning(int)</a></code></li> 3957 <li><code><a href="/reference/android/support/test/uiautomator/UiScrollable.html#scrollToEnd(int)">scrollToEnd(int)</a></code></li> 3958 <li><code><a href="/reference/android/support/test/uiautomator/UiScrollable.html#scrollBackward()">scrollBackward()</a></code></li> 3959 <li><code><a href="/reference/android/support/test/uiautomator/UiScrollable.html#scrollForward()">scrollForward()</a></code></li> 3960 </ul></p> 3961 3962 <table class="responsive"> 3963 <tr><th colspan=2>Parameters</th></tr> 3964 <tr> 3965 <td><code>steps</code></td> 3966 <td width="100%"> 3967 <code>int</code>: 3968 indicates the number of injected move steps into the system. Steps are 3969 injected about 5ms apart. So a 100 steps may take about 1/2 second to complete.</td> 3970 </tr> 3971 </table> 3972 <table class="responsive"> 3973 <tr><th colspan=2>Returns</th></tr> 3974 <tr> 3975 <td><code>boolean</code></td> 3976 <td width="100%">true if successful</td> 3977 </tr> 3978 </table> 3979 <table class="responsive"> 3980 <tr><th colspan=2>Throws</th></tr> 3981 <tr> 3982 <td><code></code></td> 3983 <td width="100%">UiObjectNotFoundException</td> 3984 </tr> 3985 <tr> 3986 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 3987 <td width="100%"></td> 3988 </tr> 3989 </table> 3990 3991 3992</div> 3993 3994 3995<A NAME="swipeRight(int)"></A> 3996 3997<div class="api apilevel-"> 3998 <h3 class="api-name">swipeRight</h3> 3999 <div class="api-level"> 4000 <div></div> 4001 4002 4003 4004 </div> 4005<pre class="api-signature no-pretty-print"> 4006boolean swipeRight (int steps)</pre> 4007 4008 4009 4010 4011 <p>Performs the swipe right action on the UiObject. 4012 The swipe gesture can be performed over any surface. The targeted 4013 UI element does not need to be scrollable. 4014 See also: 4015 <ul> 4016 <li><code><a href="/reference/android/support/test/uiautomator/UiScrollable.html#scrollToBeginning(int)">scrollToBeginning(int)</a></code></li> 4017 <li><code><a href="/reference/android/support/test/uiautomator/UiScrollable.html#scrollToEnd(int)">scrollToEnd(int)</a></code></li> 4018 <li><code><a href="/reference/android/support/test/uiautomator/UiScrollable.html#scrollBackward()">scrollBackward()</a></code></li> 4019 <li><code><a href="/reference/android/support/test/uiautomator/UiScrollable.html#scrollForward()">scrollForward()</a></code></li> 4020 </ul></p> 4021 4022 <table class="responsive"> 4023 <tr><th colspan=2>Parameters</th></tr> 4024 <tr> 4025 <td><code>steps</code></td> 4026 <td width="100%"> 4027 <code>int</code>: 4028 indicates the number of injected move steps into the system. Steps are 4029 injected about 5ms apart. So a 100 steps may take about 1/2 second to complete.</td> 4030 </tr> 4031 </table> 4032 <table class="responsive"> 4033 <tr><th colspan=2>Returns</th></tr> 4034 <tr> 4035 <td><code>boolean</code></td> 4036 <td width="100%">true if successful</td> 4037 </tr> 4038 </table> 4039 <table class="responsive"> 4040 <tr><th colspan=2>Throws</th></tr> 4041 <tr> 4042 <td><code></code></td> 4043 <td width="100%">UiObjectNotFoundException</td> 4044 </tr> 4045 <tr> 4046 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 4047 <td width="100%"></td> 4048 </tr> 4049 </table> 4050 4051 4052</div> 4053 4054 4055<A NAME="swipeUp(int)"></A> 4056 4057<div class="api apilevel-"> 4058 <h3 class="api-name">swipeUp</h3> 4059 <div class="api-level"> 4060 <div></div> 4061 4062 4063 4064 </div> 4065<pre class="api-signature no-pretty-print"> 4066boolean swipeUp (int steps)</pre> 4067 4068 4069 4070 4071 <p>Performs the swipe up action on the UiObject. 4072 See also: 4073 <ul> 4074 <li><code><a href="/reference/android/support/test/uiautomator/UiScrollable.html#scrollToBeginning(int)">scrollToBeginning(int)</a></code></li> 4075 <li><code><a href="/reference/android/support/test/uiautomator/UiScrollable.html#scrollToEnd(int)">scrollToEnd(int)</a></code></li> 4076 <li><code><a href="/reference/android/support/test/uiautomator/UiScrollable.html#scrollBackward()">scrollBackward()</a></code></li> 4077 <li><code><a href="/reference/android/support/test/uiautomator/UiScrollable.html#scrollForward()">scrollForward()</a></code></li> 4078 </ul></p> 4079 4080 <table class="responsive"> 4081 <tr><th colspan=2>Parameters</th></tr> 4082 <tr> 4083 <td><code>steps</code></td> 4084 <td width="100%"> 4085 <code>int</code>: 4086 indicates the number of injected move steps into the system. Steps are 4087 injected about 5ms apart. So a 100 steps may take about 1/2 second to complete.</td> 4088 </tr> 4089 </table> 4090 <table class="responsive"> 4091 <tr><th colspan=2>Returns</th></tr> 4092 <tr> 4093 <td><code>boolean</code></td> 4094 <td width="100%">true of successful</td> 4095 </tr> 4096 </table> 4097 <table class="responsive"> 4098 <tr><th colspan=2>Throws</th></tr> 4099 <tr> 4100 <td><code></code></td> 4101 <td width="100%">UiObjectNotFoundException</td> 4102 </tr> 4103 <tr> 4104 <td><code><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></code></td> 4105 <td width="100%"></td> 4106 </tr> 4107 </table> 4108 4109 4110</div> 4111 4112 4113<A NAME="waitForExists(long)"></A> 4114 4115<div class="api apilevel-"> 4116 <h3 class="api-name">waitForExists</h3> 4117 <div class="api-level"> 4118 <div></div> 4119 4120 4121 4122 </div> 4123<pre class="api-signature no-pretty-print"> 4124boolean waitForExists (long timeout)</pre> 4125 4126 4127 4128 4129 <p>Waits a specified length of time for a view to become visible. 4130 4131 This method waits until the view becomes visible on the display, or 4132 until the timeout has elapsed. You can use this method in situations where 4133 the content that you want to select is not immediately displayed.</p> 4134 4135 <table class="responsive"> 4136 <tr><th colspan=2>Parameters</th></tr> 4137 <tr> 4138 <td><code>timeout</code></td> 4139 <td width="100%"> 4140 <code>long</code>: 4141 the amount of time to wait (in milliseconds)</td> 4142 </tr> 4143 </table> 4144 <table class="responsive"> 4145 <tr><th colspan=2>Returns</th></tr> 4146 <tr> 4147 <td><code>boolean</code></td> 4148 <td width="100%">true if the view is displayed, else false if timeout elapsed while waiting</td> 4149 </tr> 4150 </table> 4151 4152</div> 4153 4154 4155<A NAME="waitUntilGone(long)"></A> 4156 4157<div class="api apilevel-"> 4158 <h3 class="api-name">waitUntilGone</h3> 4159 <div class="api-level"> 4160 <div></div> 4161 4162 4163 4164 </div> 4165<pre class="api-signature no-pretty-print"> 4166boolean waitUntilGone (long timeout)</pre> 4167 4168 4169 4170 4171 <p>Waits a specified length of time for a view to become undetectable. 4172 4173 This method waits until a view is no longer matchable, or until the 4174 timeout has elapsed. 4175 4176 A view becomes undetectable when the <code><a href="/reference/android/support/test/uiautomator/UiSelector.html">UiSelector</a></code> of the object is 4177 unable to find a match because the element has either changed its state or is no 4178 longer displayed. 4179 4180 You can use this method when attempting to wait for some long operation 4181 to compete, such as downloading a large file or connecting to a remote server.</p> 4182 4183 <table class="responsive"> 4184 <tr><th colspan=2>Parameters</th></tr> 4185 <tr> 4186 <td><code>timeout</code></td> 4187 <td width="100%"> 4188 <code>long</code>: 4189 time to wait (in milliseconds)</td> 4190 </tr> 4191 </table> 4192 <table class="responsive"> 4193 <tr><th colspan=2>Returns</th></tr> 4194 <tr> 4195 <td><code>boolean</code></td> 4196 <td width="100%">true if the element is gone before timeout elapsed, else false if timeout elapsed 4197 but a matching element is still found.</td> 4198 </tr> 4199 </table> 4200 4201</div> 4202 4203 4204 4205 4206 4207<!-- ========= METHOD DETAIL ======== --> 4208 4209<h2 class="api-section">Protected methods</h2> 4210 4211 4212 4213<A NAME="findAccessibilityNodeInfo(long)"></A> 4214 4215<div class="api apilevel-"> 4216 <h3 class="api-name">findAccessibilityNodeInfo</h3> 4217 <div class="api-level"> 4218 <div></div> 4219 4220 4221 4222 </div> 4223<pre class="api-signature no-pretty-print"> 4224AccessibilityNodeInfo findAccessibilityNodeInfo (long timeout)</pre> 4225 4226 4227 4228 4229 <p>Finds a matching UI element in the accessibility hierarchy, by 4230 using the selector for this UiObject.</p> 4231 4232 <table class="responsive"> 4233 <tr><th colspan=2>Parameters</th></tr> 4234 <tr> 4235 <td><code>timeout</code></td> 4236 <td width="100%"> 4237 <code>long</code>: 4238 in milliseconds</td> 4239 </tr> 4240 </table> 4241 <table class="responsive"> 4242 <tr><th colspan=2>Returns</th></tr> 4243 <tr> 4244 <td><code>AccessibilityNodeInfo</code></td> 4245 <td width="100%">AccessibilityNodeInfo if found else null</td> 4246 </tr> 4247 </table> 4248 4249</div> 4250 4251 4252 4253 4254 4255<!-- ========= END OF CLASS DATA ========= --> 4256 4257</div><!-- end jd-content --> 4258 4259 4260 4261<div class="data-reference-resources-wrapper"> 4262 4263 <ul data-reference-resources> 4264 4265 4266 <li><h2>Interfaces</h2> 4267 <ul> 4268 <li class="api apilevel-"><a href="/reference/android/support/test/uiautomator/IAutomationSupport.html">IAutomationSupport</a></li> 4269 <li class="api apilevel-"><a href="/reference/android/support/test/uiautomator/UiWatcher.html">UiWatcher</a></li> 4270 </ul> 4271 </li> 4272 4273 <li><h2>Classes</h2> 4274 <ul> 4275 <li class="api apilevel-"><a href="/reference/android/support/test/uiautomator/By.html">By</a></li> 4276 <li class="api apilevel-"><a href="/reference/android/support/test/uiautomator/BySelector.html">BySelector</a></li> 4277 <li class="api apilevel-"><a href="/reference/android/support/test/uiautomator/Configurator.html">Configurator</a></li> 4278 <li class="api apilevel-"><a href="/reference/android/support/test/uiautomator/EventCondition.html">EventCondition</a></li> 4279 <li class="api apilevel-"><a href="/reference/android/support/test/uiautomator/SearchCondition.html">SearchCondition</a></li> 4280 <li class="api apilevel-"><a href="/reference/android/support/test/uiautomator/UiAutomatorInstrumentationTestRunner.html">UiAutomatorInstrumentationTestRunner</a></li> 4281 <li class="api apilevel-"><a href="/reference/android/support/test/uiautomator/UiAutomatorTestCase.html">UiAutomatorTestCase</a></li> 4282 <li class="api apilevel-"><a href="/reference/android/support/test/uiautomator/UiCollection.html">UiCollection</a></li> 4283 <li class="api apilevel-"><a href="/reference/android/support/test/uiautomator/UiDevice.html">UiDevice</a></li> 4284 <li class="selected api apilevel-"><a href="/reference/android/support/test/uiautomator/UiObject.html">UiObject</a></li> 4285 <li class="api apilevel-"><a href="/reference/android/support/test/uiautomator/UiObject2.html">UiObject2</a></li> 4286 <li class="api apilevel-"><a href="/reference/android/support/test/uiautomator/UiObject2Condition.html">UiObject2Condition</a></li> 4287 <li class="api apilevel-"><a href="/reference/android/support/test/uiautomator/UiScrollable.html">UiScrollable</a></li> 4288 <li class="api apilevel-"><a href="/reference/android/support/test/uiautomator/UiSelector.html">UiSelector</a></li> 4289 <li class="api apilevel-"><a href="/reference/android/support/test/uiautomator/Until.html">Until</a></li> 4290 </ul> 4291 </li> 4292 4293 <li><h2>Enums</h2> 4294 <ul> 4295 <li class="api apilevel-"><a href="/reference/android/support/test/uiautomator/Direction.html">Direction</a></li> 4296 </ul> 4297 </li> 4298 4299 <li><h2>Exceptions</h2> 4300 <ul> 4301 <li class="api apilevel-"><a href="/reference/android/support/test/uiautomator/StaleObjectException.html">StaleObjectException</a></li> 4302 <li class="api apilevel-"><a href="/reference/android/support/test/uiautomator/UiObjectNotFoundException.html">UiObjectNotFoundException</a></li> 4303 </ul> 4304 </li> 4305 4306 </ul> 4307 4308</div> 4309 4310 4311 4312</body> 4313</html> 4314