1page.title=UiObject 2parent.title=uiautomator 3parent.link=index.html 4@jd:body 5<style> 6 h4.jd-details-title {background-color: #DEE8F1;} 7</style> 8<p>A UiObject is a representation of a user interface (UI) element. It is not in any way directly bound to a 9 UI element as an object reference. A UiObject holds information to help it 10 locate a matching UI element at runtime based on the <code><a href="UiSelector.html">UiSelector</a></code> properties specified in 11 its constructor. Since a UiObject is a representative for a UI element, it can 12 be reused for different views with matching UI elements. 13</p> 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31<div class="jd-descr"> 32 33 34<h2>Summary</h2> 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58<!-- ======== CONSTRUCTOR SUMMARY ======== --> 59<table id="pubctors" class="jd-sumtable"><tr><th colspan="12">Public Constructors</th></tr> 60 61 62 63 64 <tr class="api" > 65 <td class="jd-typecol"> 66 67 68 69 70 71 72 </td> 73 <td class="jd-linkcol" width="100%"> 74 <span class="sympad"><a href="#UiObject(com.android.uiautomator.core.UiSelector)">UiObject</a></span>(<a href="UiSelector.html">UiSelector</a> selector) 75 76 <div class="jd-descrdiv">Constructs a UiObject to represent a specific UI element matched by the specified 77 <code><a href="UiSelector.html">UiSelector</a></code> selector properties.</div> 78 79 </td></tr> 80 81 82 83</table> 84 85 86 87 88 89 90<!-- ========== METHOD SUMMARY =========== --> 91<table id="pubmethods" class="jd-sumtable"><tr><th colspan="12">Public Methods</th></tr> 92 93 94 95 96 <tr class="api" > 97 <td class="jd-typecol"> 98 99 100 101 102 103 void 104 </td> 105 <td class="jd-linkcol" width="100%"> 106 <span class="sympad"><a href="#clearTextField()">clearTextField</a></span>() 107 108 <div class="jd-descrdiv">Clears the existing text contents in an editable field.</div> 109 110 </td></tr> 111 112 113 114 <tr class="api" > 115 <td class="jd-typecol"> 116 117 118 119 120 121 boolean 122 </td> 123 <td class="jd-linkcol" width="100%"> 124 <span class="sympad"><a href="#click()">click</a></span>() 125 126 <div class="jd-descrdiv">Performs a click at the center of the visible bounds of the UI element represented 127 by this UiObject.</div> 128 129 </td></tr> 130 131 132 133 <tr class="api" > 134 <td class="jd-typecol"> 135 136 137 138 139 140 boolean 141 </td> 142 <td class="jd-linkcol" width="100%"> 143 <span class="sympad"><a href="#clickAndWaitForNewWindow(long)">clickAndWaitForNewWindow</a></span>(long timeout) 144 145 <div class="jd-descrdiv">Performs a click at the center of the visible bounds of the UI element represented 146 by this UiObject and waits for window transitions.</div> 147 148 </td></tr> 149 150 151 152 <tr class="api" > 153 <td class="jd-typecol"> 154 155 156 157 158 159 boolean 160 </td> 161 <td class="jd-linkcol" width="100%"> 162 <span class="sympad"><a href="#clickAndWaitForNewWindow()">clickAndWaitForNewWindow</a></span>() 163 164 <div class="jd-descrdiv">See <code><a href="#clickAndWaitForNewWindow(long)">clickAndWaitForNewWindow(long)</a></code> 165 This method is intended to reliably wait for window transitions that would typically take 166 longer than the usual default timeouts.</div> 167 168 </td></tr> 169 170 171 172 <tr class="api" > 173 <td class="jd-typecol"> 174 175 176 177 178 179 boolean 180 </td> 181 <td class="jd-linkcol" width="100%"> 182 <span class="sympad"><a href="#clickBottomRight()">clickBottomRight</a></span>() 183 184 <div class="jd-descrdiv">Clicks the bottom and right corner of the UI element</div> 185 186 </td></tr> 187 188 189 190 <tr class="api" > 191 <td class="jd-typecol"> 192 193 194 195 196 197 boolean 198 </td> 199 <td class="jd-linkcol" width="100%"> 200 <span class="sympad"><a href="#clickTopLeft()">clickTopLeft</a></span>() 201 202 <div class="jd-descrdiv">Clicks the top and left corner of the UI element</div> 203 204 </td></tr> 205 206 207 208 <tr class="api" > 209 <td class="jd-typecol"> 210 211 212 213 214 215 boolean 216 </td> 217 <td class="jd-linkcol" width="100%"> 218 <span class="sympad"><a href="#exists()">exists</a></span>() 219 220 <div class="jd-descrdiv">Check if UI element exists.</div> 221 222 </td></tr> 223 224 225 226 <tr class="api" > 227 <td class="jd-typecol"> 228 229 230 231 232 233 Rect 234 </td> 235 <td class="jd-linkcol" width="100%"> 236 <span class="sympad"><a href="#getBounds()">getBounds</a></span>() 237 238 <div class="jd-descrdiv">Returns the UI element's <code>bounds</code> property.</div> 239 240 </td></tr> 241 242 243 244 <tr class="api" > 245 <td class="jd-typecol"> 246 247 248 249 250 251 <a href="UiObject.html">UiObject</a> 252 </td> 253 <td class="jd-linkcol" width="100%"> 254 <span class="sympad"><a href="#getChild(com.android.uiautomator.core.UiSelector)">getChild</a></span>(<a href="UiSelector.html">UiSelector</a> selector) 255 256 <div class="jd-descrdiv">Creates a new UiObject representing a child UI element of the element currently represented 257 by this UiObject.</div> 258 259 </td></tr> 260 261 262 263 <tr class="api" > 264 <td class="jd-typecol"> 265 266 267 268 269 270 int 271 </td> 272 <td class="jd-linkcol" width="100%"> 273 <span class="sympad"><a href="#getChildCount()">getChildCount</a></span>() 274 275 <div class="jd-descrdiv">Counts the child UI elements immediately under the UI element currently represented by 276 this UiObject.</div> 277 278 </td></tr> 279 280 281 282 <tr class="api" > 283 <td class="jd-typecol"> 284 285 286 287 288 289 String 290 </td> 291 <td class="jd-linkcol" width="100%"> 292 <span class="sympad"><a href="#getContentDescription()">getContentDescription</a></span>() 293 294 <div class="jd-descrdiv">Reads the <code>content_desc</code> property of the UI element</div> 295 296 </td></tr> 297 298 299 300 <tr class="api" > 301 <td class="jd-typecol"> 302 303 304 305 306 307 <a href="UiObject.html">UiObject</a> 308 </td> 309 <td class="jd-linkcol" width="100%"> 310 <span class="sympad"><a href="#getFromParent(com.android.uiautomator.core.UiSelector)">getFromParent</a></span>(<a href="UiSelector.html">UiSelector</a> selector) 311 312 <div class="jd-descrdiv">Creates a new UiObject representing a child UI element from the parent element currently 313 represented by this object.</div> 314 315 </td></tr> 316 317 318 319 <tr class="api" > 320 <td class="jd-typecol"> 321 322 323 324 325 326 String 327 </td> 328 <td class="jd-linkcol" width="100%"> 329 <span class="sympad"><a href="#getPackageName()">getPackageName</a></span>() 330 331 <div class="jd-descrdiv">Reads the UI element's <code>package</code> property</div> 332 333 </td></tr> 334 335 336 337 <tr class="api" > 338 <td class="jd-typecol"> 339 340 341 final 342 343 344 <a href="UiSelector.html">UiSelector</a> 345 </td> 346 <td class="jd-linkcol" width="100%"> 347 <span class="sympad"><a href="#getSelector()">getSelector</a></span>() 348 349 <div class="jd-descrdiv">Debugging helper.</div> 350 351 </td></tr> 352 353 354 355 <tr class="api" > 356 <td class="jd-typecol"> 357 358 359 360 361 362 String 363 </td> 364 <td class="jd-linkcol" width="100%"> 365 <span class="sympad"><a href="#getText()">getText</a></span>() 366 367 <div class="jd-descrdiv">Reads the <code>text</code> property of the UI element</div> 368 369 </td></tr> 370 371 372 373 <tr class="api" > 374 <td class="jd-typecol"> 375 376 377 378 379 380 Rect 381 </td> 382 <td class="jd-linkcol" width="100%"> 383 <span class="sympad"><a href="#getVisibleBounds()">getVisibleBounds</a></span>() 384 385 <div class="jd-descrdiv">Returns the visible bounds of the UI element.</div> 386 387 </td></tr> 388 389 390 391 <tr class="api" > 392 <td class="jd-typecol"> 393 394 395 396 397 398 boolean 399 </td> 400 <td class="jd-linkcol" width="100%"> 401 <span class="sympad"><a href="#isCheckable()">isCheckable</a></span>() 402 403 <div class="jd-descrdiv">Check if the UI element's <code>checkable</code> property is currently true</div> 404 405 </td></tr> 406 407 408 409 <tr class="api" > 410 <td class="jd-typecol"> 411 412 413 414 415 416 boolean 417 </td> 418 <td class="jd-linkcol" width="100%"> 419 <span class="sympad"><a href="#isChecked()">isChecked</a></span>() 420 421 <div class="jd-descrdiv">Check if the UI element's <code>checked</code> property is currently true</div> 422 423 </td></tr> 424 425 426 427 <tr class="api" > 428 <td class="jd-typecol"> 429 430 431 432 433 434 boolean 435 </td> 436 <td class="jd-linkcol" width="100%"> 437 <span class="sympad"><a href="#isClickable()">isClickable</a></span>() 438 439 <div class="jd-descrdiv">Check if the UI element's <code>clickable</code> property is currently true</div> 440 441 </td></tr> 442 443 444 445 <tr class="api" > 446 <td class="jd-typecol"> 447 448 449 450 451 452 boolean 453 </td> 454 <td class="jd-linkcol" width="100%"> 455 <span class="sympad"><a href="#isEnabled()">isEnabled</a></span>() 456 457 <div class="jd-descrdiv">Check if the UI element's <code>enabled</code> property is currently true</div> 458 459 </td></tr> 460 461 462 463 <tr class="api" > 464 <td class="jd-typecol"> 465 466 467 468 469 470 boolean 471 </td> 472 <td class="jd-linkcol" width="100%"> 473 <span class="sympad"><a href="#isFocusable()">isFocusable</a></span>() 474 475 <div class="jd-descrdiv">Check if the UI element's <code>focusable</code> property is currently true</div> 476 477 </td></tr> 478 479 480 481 <tr class="api" > 482 <td class="jd-typecol"> 483 484 485 486 487 488 boolean 489 </td> 490 <td class="jd-linkcol" width="100%"> 491 <span class="sympad"><a href="#isFocused()">isFocused</a></span>() 492 493 <div class="jd-descrdiv">Check if the UI element's <code>focused</code> property is currently true</div> 494 495 </td></tr> 496 497 498 499 <tr class="api" > 500 <td class="jd-typecol"> 501 502 503 504 505 506 boolean 507 </td> 508 <td class="jd-linkcol" width="100%"> 509 <span class="sympad"><a href="#isLongClickable()">isLongClickable</a></span>() 510 511 <div class="jd-descrdiv">Check if the UI element's <code>long-clickable</code> property is currently true</div> 512 513 </td></tr> 514 515 516 517 <tr class="api" > 518 <td class="jd-typecol"> 519 520 521 522 523 524 boolean 525 </td> 526 <td class="jd-linkcol" width="100%"> 527 <span class="sympad"><a href="#isScrollable()">isScrollable</a></span>() 528 529 <div class="jd-descrdiv">Check if the UI element's <code>scrollable</code> property is currently true</div> 530 531 </td></tr> 532 533 534 535 <tr class="api" > 536 <td class="jd-typecol"> 537 538 539 540 541 542 boolean 543 </td> 544 <td class="jd-linkcol" width="100%"> 545 <span class="sympad"><a href="#isSelected()">isSelected</a></span>() 546 547 <div class="jd-descrdiv">Check if the UI element's <code>selected</code> property is currently true</div> 548 549 </td></tr> 550 551 552 553 <tr class="api" > 554 <td class="jd-typecol"> 555 556 557 558 559 560 boolean 561 </td> 562 <td class="jd-linkcol" width="100%"> 563 <span class="sympad"><a href="#longClick()">longClick</a></span>() 564 565 <div class="jd-descrdiv">Long clicks the center of the visible bounds of the UI element</div> 566 567 </td></tr> 568 569 570 571 <tr class="api" > 572 <td class="jd-typecol"> 573 574 575 576 577 578 boolean 579 </td> 580 <td class="jd-linkcol" width="100%"> 581 <span class="sympad"><a href="#longClickBottomRight()">longClickBottomRight</a></span>() 582 583 <div class="jd-descrdiv">Long clicks bottom and right corner of the UI element</div> 584 585 </td></tr> 586 587 588 589 <tr class="api" > 590 <td class="jd-typecol"> 591 592 593 594 595 596 boolean 597 </td> 598 <td class="jd-linkcol" width="100%"> 599 <span class="sympad"><a href="#longClickTopLeft()">longClickTopLeft</a></span>() 600 601 <div class="jd-descrdiv">Long clicks on the top and left corner of the UI element</div> 602 603 </td></tr> 604 605 606 607 <tr class="api" > 608 <td class="jd-typecol"> 609 610 611 612 613 614 boolean 615 </td> 616 <td class="jd-linkcol" width="100%"> 617 <span class="sympad"><a href="#setText(java.lang.String)">setText</a></span>(String text) 618 619 <div class="jd-descrdiv">Sets the text in an editable field, after clearing the field's content.</div> 620 621 </td></tr> 622 623 624 625 <tr class="api" > 626 <td class="jd-typecol"> 627 628 629 630 631 632 boolean 633 </td> 634 <td class="jd-linkcol" width="100%"> 635 <span class="sympad"><a href="#swipeDown(int)">swipeDown</a></span>(int steps) 636 637 <div class="jd-descrdiv">Perform the action on the UI element that is represented by this object, Also see 638 #scrollToBeginning(int), #scrollToEnd(int), #scrollBackward(), 639 #scrollForward().</div> 640 641 </td></tr> 642 643 644 645 <tr class="api" > 646 <td class="jd-typecol"> 647 648 649 650 651 652 boolean 653 </td> 654 <td class="jd-linkcol" width="100%"> 655 <span class="sympad"><a href="#swipeLeft(int)">swipeLeft</a></span>(int steps) 656 657 <div class="jd-descrdiv">Perform the action on the UI element that is represented by this object.</div> 658 659 </td></tr> 660 661 662 663 <tr class="api" > 664 <td class="jd-typecol"> 665 666 667 668 669 670 boolean 671 </td> 672 <td class="jd-linkcol" width="100%"> 673 <span class="sympad"><a href="#swipeRight(int)">swipeRight</a></span>(int steps) 674 675 <div class="jd-descrdiv">Perform the action on the UI element that is represented by this object.</div> 676 677 </td></tr> 678 679 680 681 <tr class="api" > 682 <td class="jd-typecol"> 683 684 685 686 687 688 boolean 689 </td> 690 <td class="jd-linkcol" width="100%"> 691 <span class="sympad"><a href="#swipeUp(int)">swipeUp</a></span>(int steps) 692 693 <div class="jd-descrdiv">Perform the action on the UI element that is represented by this UiObject.</div> 694 695 </td></tr> 696 697 698 699 <tr class="api" > 700 <td class="jd-typecol"> 701 702 703 704 705 706 boolean 707 </td> 708 <td class="jd-linkcol" width="100%"> 709 <span class="sympad"><a href="#waitForExists(long)">waitForExists</a></span>(long timeout) 710 711 <div class="jd-descrdiv">Waits a specified length of time for a UI element to become visible.</div> 712 713 </td></tr> 714 715 716 717 <tr class="api" > 718 <td class="jd-typecol"> 719 720 721 722 723 724 boolean 725 </td> 726 <td class="jd-linkcol" width="100%"> 727 <span class="sympad"><a href="#waitUntilGone(long)">waitUntilGone</a></span>(long timeout) 728 729 <div class="jd-descrdiv">Waits a specified length of time for a UI element to become undetectable.</div> 730 731 </td></tr> 732 733 734 735</table> 736 737 738 739 740 741 742 743<!-- ========== METHOD SUMMARY =========== --> 744<table id="inhmethods" class="jd-sumtable"><tr><th> 745 <a href="#" class="toggle-all" onclick="return toggleAllInherited(this, null)">[Expand]</a> 746 <div style="clear:left;">Inherited Methods</div></th></tr> 747 748 749<tr class="api apilevel-" > 750<td colspan="12"> 751 <a href="#" onclick="return toggleInherited(this, null)" id="inherited-methods-java.lang.Object" class="jd-expando-trigger closed" 752 ><img id="inherited-methods-java.lang.Object-trigger" 753 src="../../../../../assets/images/triangle-closed.png" 754 class="jd-expando-trigger-img" /></a> 755From class 756 757 java.lang.Object 758 759<div id="inherited-methods-java.lang.Object"> 760 <div id="inherited-methods-java.lang.Object-list" 761 class="jd-inheritedlinks"> 762 </div> 763 <div id="inherited-methods-java.lang.Object-summary" style="display: none;"> 764 <table class="jd-sumtable-expando"> 765 766 767 768 769 <tr class="api" > 770 <td class="jd-typecol"> 771 772 773 774 775 776 boolean 777 </td> 778 <td class="jd-linkcol" width="100%"> 779 <span class="sympad">equals</span>(Object arg0) 780 781 </td></tr> 782 783 784 785 <tr class="api" > 786 <td class="jd-typecol"> 787 788 789 final 790 791 792 Class<?> 793 </td> 794 <td class="jd-linkcol" width="100%"> 795 <span class="sympad">getClass</span>() 796 797 </td></tr> 798 799 800 801 <tr class="api" > 802 <td class="jd-typecol"> 803 804 805 806 807 808 int 809 </td> 810 <td class="jd-linkcol" width="100%"> 811 <span class="sympad">hashCode</span>() 812 813 </td></tr> 814 815 816 817 <tr class="api" > 818 <td class="jd-typecol"> 819 820 821 final 822 823 824 void 825 </td> 826 <td class="jd-linkcol" width="100%"> 827 <span class="sympad">notify</span>() 828 829 </td></tr> 830 831 832 833 <tr class="api" > 834 <td class="jd-typecol"> 835 836 837 final 838 839 840 void 841 </td> 842 <td class="jd-linkcol" width="100%"> 843 <span class="sympad">notifyAll</span>() 844 845 </td></tr> 846 847 848 849 <tr class="api" > 850 <td class="jd-typecol"> 851 852 853 854 855 856 String 857 </td> 858 <td class="jd-linkcol" width="100%"> 859 <span class="sympad">toString</span>() 860 861 </td></tr> 862 863 864 865 <tr class="api" > 866 <td class="jd-typecol"> 867 868 869 final 870 871 872 void 873 </td> 874 <td class="jd-linkcol" width="100%"> 875 <span class="sympad">wait</span>() 876 877 </td></tr> 878 879 880 881 <tr class="api" > 882 <td class="jd-typecol"> 883 884 885 final 886 887 888 void 889 </td> 890 <td class="jd-linkcol" width="100%"> 891 <span class="sympad">wait</span>(long arg0, int arg1) 892 893 </td></tr> 894 895 896 897 <tr class="api" > 898 <td class="jd-typecol"> 899 900 901 final 902 903 904 void 905 </td> 906 <td class="jd-linkcol" width="100%"> 907 <span class="sympad">wait</span>(long arg0) 908 909 </td></tr> 910 911 912</table> 913 </div> 914</div> 915</td></tr> 916 917 918</table> 919 920 921</div><!-- jd-descr (summary) --> 922 923<!-- Details --> 924 925 926 927 928 929 930 931 932<!-- XML Attributes --> 933 934 935<!-- Enum Values --> 936 937 938<!-- Constants --> 939 940 941<!-- Fields --> 942 943 944<!-- Public ctors --> 945 946 947<!-- ========= CONSTRUCTOR DETAIL ======== --> 948<h2>Public Constructors</h2> 949 950 951 952<a id="UiObject(com.android.uiautomator.core.UiSelector)"></a> 953 954<div class="jd-details api "> 955 <h4 class="jd-details-title"> 956 <span class="normal"> 957 public 958 959 960 961 962 963 </span> 964 <span class="sympad">UiObject</span> 965 <span class="normal">(<a href="UiSelector.html">UiSelector</a> selector)</span> 966 </h4> 967 <div class="api-level"> 968 <div> 969 970</div> 971 972 973 974 </div> 975 <div class="jd-details-descr"> 976 977 <div class="jd-tagdata jd-tagdescr"><p>Constructs a UiObject to represent a specific UI element matched by the specified 978 <code><a href="UiSelector.html">UiSelector</a></code> selector properties.</p></div> 979 980 </div> 981</div> 982 983 984 985 986 987<!-- ========= CONSTRUCTOR DETAIL ======== --> 988<!-- Protected ctors --> 989 990 991 992<!-- ========= METHOD DETAIL ======== --> 993<!-- Public methdos --> 994 995<h2>Public Methods</h2> 996 997 998 999<a id="clearTextField()"></a> 1000 1001<div class="jd-details api "> 1002 <h4 class="jd-details-title"> 1003 <span class="normal"> 1004 public 1005 1006 1007 1008 1009 void 1010 </span> 1011 <span class="sympad">clearTextField</span> 1012 <span class="normal">()</span> 1013 </h4> 1014 <div class="api-level"> 1015 <div> 1016 1017</div> 1018 1019 1020 1021 </div> 1022 <div class="jd-details-descr"> 1023 1024 <div class="jd-tagdata jd-tagdescr"><p>Clears the existing text contents in an editable field. 1025 1026 The <code><a href="UiSelector.html">UiSelector</a></code> of this object must reference a UI element that is editable. 1027 1028 When you call this method, the method first sets focus at the start edge of the field. 1029 The method then simulates a long-press to select the existing text, and deletes the 1030 selected text. 1031 1032 If a "Select-All" option is displayed, the method will automatically attempt to use it 1033 to ensure full text selection. 1034 1035 Note that it is possible that not all the text in the field is selected; for example, 1036 if the text contains separators such as spaces, slashes, at symbol etc. 1037 Also, not all editable fields support the long-press functionality.</p></div> 1038 <div class="jd-tagdata"> 1039 <h5 class="jd-tagtitle">Throws</h5> 1040 <table class="jd-tagtable"> 1041 <tr> 1042 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 1043 <td></td> 1044 </tr> 1045 </table> 1046 </div> 1047 1048 </div> 1049</div> 1050 1051 1052<a id="click()"></a> 1053 1054<div class="jd-details api "> 1055 <h4 class="jd-details-title"> 1056 <span class="normal"> 1057 public 1058 1059 1060 1061 1062 boolean 1063 </span> 1064 <span class="sympad">click</span> 1065 <span class="normal">()</span> 1066 </h4> 1067 <div class="api-level"> 1068 <div> 1069 1070</div> 1071 1072 1073 1074 </div> 1075 <div class="jd-details-descr"> 1076 1077 <div class="jd-tagdata jd-tagdescr"><p>Performs a click at the center of the visible bounds of the UI element represented 1078 by this UiObject.</p></div> 1079 <div class="jd-tagdata"> 1080 <h5 class="jd-tagtitle">Returns</h5> 1081 <ul class="nolist"><li>true id successful else false</li></ul> 1082 </div> 1083 <div class="jd-tagdata"> 1084 <h5 class="jd-tagtitle">Throws</h5> 1085 <table class="jd-tagtable"> 1086 <tr> 1087 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 1088 <td></td> 1089 </tr> 1090 </table> 1091 </div> 1092 1093 </div> 1094</div> 1095 1096 1097<a id="clickAndWaitForNewWindow(long)"></a> 1098 1099<div class="jd-details api "> 1100 <h4 class="jd-details-title"> 1101 <span class="normal"> 1102 public 1103 1104 1105 1106 1107 boolean 1108 </span> 1109 <span class="sympad">clickAndWaitForNewWindow</span> 1110 <span class="normal">(long timeout)</span> 1111 </h4> 1112 <div class="api-level"> 1113 <div> 1114 1115</div> 1116 1117 1118 1119 </div> 1120 <div class="jd-details-descr"> 1121 1122 <div class="jd-tagdata jd-tagdescr"><p>Performs a click at the center of the visible bounds of the UI element represented 1123 by this UiObject and waits for window transitions. 1124 1125 This method differ from <code><a href="#click()">click()</a></code> only in that this method waits for a 1126 a new window transition as a result of the click. Some examples of a window transition: 1127 <li>launching a new activity</li> 1128 <li>bringing up a pop-up menu</li> 1129 <li>bringing up a dialog</li></p></div> 1130 <div class="jd-tagdata"> 1131 <h5 class="jd-tagtitle">Parameters</h5> 1132 <table class="jd-tagtable"> 1133 <tr> 1134 <th>timeout</th> 1135 <td>timeout before giving up on waiting for a new window</td> 1136 </tr> 1137 </table> 1138 </div> 1139 <div class="jd-tagdata"> 1140 <h5 class="jd-tagtitle">Returns</h5> 1141 <ul class="nolist"><li>true if the event was triggered, else false</li></ul> 1142 </div> 1143 <div class="jd-tagdata"> 1144 <h5 class="jd-tagtitle">Throws</h5> 1145 <table class="jd-tagtable"> 1146 <tr> 1147 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 1148 <td></td> 1149 </tr> 1150 </table> 1151 </div> 1152 1153 </div> 1154</div> 1155 1156 1157<a id="clickAndWaitForNewWindow()"></a> 1158 1159<div class="jd-details api "> 1160 <h4 class="jd-details-title"> 1161 <span class="normal"> 1162 public 1163 1164 1165 1166 1167 boolean 1168 </span> 1169 <span class="sympad">clickAndWaitForNewWindow</span> 1170 <span class="normal">()</span> 1171 </h4> 1172 <div class="api-level"> 1173 <div> 1174 1175</div> 1176 1177 1178 1179 </div> 1180 <div class="jd-details-descr"> 1181 1182 <div class="jd-tagdata jd-tagdescr"><p>See <code><a href="#clickAndWaitForNewWindow(long)">clickAndWaitForNewWindow(long)</a></code> 1183 This method is intended to reliably wait for window transitions that would typically take 1184 longer than the usual default timeouts.</p></div> 1185 <div class="jd-tagdata"> 1186 <h5 class="jd-tagtitle">Returns</h5> 1187 <ul class="nolist"><li>true if the event was triggered, else false</li></ul> 1188 </div> 1189 <div class="jd-tagdata"> 1190 <h5 class="jd-tagtitle">Throws</h5> 1191 <table class="jd-tagtable"> 1192 <tr> 1193 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 1194 <td></td> 1195 </tr> 1196 </table> 1197 </div> 1198 1199 </div> 1200</div> 1201 1202 1203<a id="clickBottomRight()"></a> 1204 1205<div class="jd-details api "> 1206 <h4 class="jd-details-title"> 1207 <span class="normal"> 1208 public 1209 1210 1211 1212 1213 boolean 1214 </span> 1215 <span class="sympad">clickBottomRight</span> 1216 <span class="normal">()</span> 1217 </h4> 1218 <div class="api-level"> 1219 <div> 1220 1221</div> 1222 1223 1224 1225 </div> 1226 <div class="jd-details-descr"> 1227 1228 <div class="jd-tagdata jd-tagdescr"><p>Clicks the bottom and right corner of the UI element</p></div> 1229 <div class="jd-tagdata"> 1230 <h5 class="jd-tagtitle">Returns</h5> 1231 <ul class="nolist"><li>true on success</li></ul> 1232 </div> 1233 <div class="jd-tagdata"> 1234 <h5 class="jd-tagtitle">Throws</h5> 1235 <table class="jd-tagtable"> 1236 <tr> 1237 <th>Exception</td> 1238 <td></td> 1239 </tr> 1240 <tr> 1241 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 1242 <td></td> 1243 </tr> 1244 </table> 1245 </div> 1246 1247 </div> 1248</div> 1249 1250 1251<a id="clickTopLeft()"></a> 1252 1253<div class="jd-details api "> 1254 <h4 class="jd-details-title"> 1255 <span class="normal"> 1256 public 1257 1258 1259 1260 1261 boolean 1262 </span> 1263 <span class="sympad">clickTopLeft</span> 1264 <span class="normal">()</span> 1265 </h4> 1266 <div class="api-level"> 1267 <div> 1268 1269</div> 1270 1271 1272 1273 </div> 1274 <div class="jd-details-descr"> 1275 1276 <div class="jd-tagdata jd-tagdescr"><p>Clicks the top and left corner of the UI element</p></div> 1277 <div class="jd-tagdata"> 1278 <h5 class="jd-tagtitle">Returns</h5> 1279 <ul class="nolist"><li>true on success</li></ul> 1280 </div> 1281 <div class="jd-tagdata"> 1282 <h5 class="jd-tagtitle">Throws</h5> 1283 <table class="jd-tagtable"> 1284 <tr> 1285 <th>Exception</td> 1286 <td></td> 1287 </tr> 1288 <tr> 1289 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 1290 <td></td> 1291 </tr> 1292 </table> 1293 </div> 1294 1295 </div> 1296</div> 1297 1298 1299<a id="exists()"></a> 1300 1301<div class="jd-details api "> 1302 <h4 class="jd-details-title"> 1303 <span class="normal"> 1304 public 1305 1306 1307 1308 1309 boolean 1310 </span> 1311 <span class="sympad">exists</span> 1312 <span class="normal">()</span> 1313 </h4> 1314 <div class="api-level"> 1315 <div> 1316 1317</div> 1318 1319 1320 1321 </div> 1322 <div class="jd-details-descr"> 1323 1324 <div class="jd-tagdata jd-tagdescr"><p>Check if UI element exists. 1325 1326 This methods performs a <code><a href="#waitForExists(long)">waitForExists(long)</a></code> with zero timeout. This 1327 basically returns immediately whether the UI element represented by this UiObject 1328 exists or not. If you need to wait longer for this UI element, then see 1329 <code><a href="#waitForExists(long)">waitForExists(long)</a></code>.</p></div> 1330 <div class="jd-tagdata"> 1331 <h5 class="jd-tagtitle">Returns</h5> 1332 <ul class="nolist"><li>true if the UI element represented by this UiObject does exist 1333</li></ul> 1334 </div> 1335 1336 </div> 1337</div> 1338 1339 1340<a id="getBounds()"></a> 1341 1342<div class="jd-details api "> 1343 <h4 class="jd-details-title"> 1344 <span class="normal"> 1345 public 1346 1347 1348 1349 1350 Rect 1351 </span> 1352 <span class="sympad">getBounds</span> 1353 <span class="normal">()</span> 1354 </h4> 1355 <div class="api-level"> 1356 <div> 1357 1358</div> 1359 1360 1361 1362 </div> 1363 <div class="jd-details-descr"> 1364 1365 <div class="jd-tagdata jd-tagdescr"><p>Returns the UI element's <code>bounds</code> property. See <code><a href="#getVisibleBounds()">getVisibleBounds()</a></code></p></div> 1366 <div class="jd-tagdata"> 1367 <h5 class="jd-tagtitle">Returns</h5> 1368 <ul class="nolist"><li>Rect</li></ul> 1369 </div> 1370 <div class="jd-tagdata"> 1371 <h5 class="jd-tagtitle">Throws</h5> 1372 <table class="jd-tagtable"> 1373 <tr> 1374 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 1375 <td></td> 1376 </tr> 1377 </table> 1378 </div> 1379 </div> 1380</div> 1381 1382 1383<a id="getChild(com.android.uiautomator.core.UiSelector)"></a> 1384 1385<div class="jd-details api "> 1386 <h4 class="jd-details-title"> 1387 <span class="normal"> 1388 public 1389 1390 1391 1392 1393 <a href="UiObject.html">UiObject</a> 1394 </span> 1395 <span class="sympad">getChild</span> 1396 <span class="normal">(<a href="UiSelector.html">UiSelector</a> selector)</span> 1397 </h4> 1398 <div class="api-level"> 1399 <div> 1400 1401</div> 1402 1403 1404 1405 </div> 1406 <div class="jd-details-descr"> 1407 1408 <div class="jd-tagdata jd-tagdescr"><p>Creates a new UiObject representing a child UI element of the element currently represented 1409 by this UiObject.</p></div> 1410 <div class="jd-tagdata"> 1411 <h5 class="jd-tagtitle">Parameters</h5> 1412 <table class="jd-tagtable"> 1413 <tr> 1414 <th>selector</th> 1415 <td>for UI element to match</td> 1416 </tr> 1417 </table> 1418 </div> 1419 <div class="jd-tagdata"> 1420 <h5 class="jd-tagtitle">Returns</h5> 1421 <ul class="nolist"><li>a new UiObject representing the matched UI element 1422</li></ul> 1423 </div> 1424 <div class="jd-tagdata"> 1425 <h5 class="jd-tagtitle">Throws</h5> 1426 <table class="jd-tagtable"> 1427 <tr> 1428 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 1429 <td></td> 1430 </tr> 1431 </table> 1432 </div> 1433 1434 </div> 1435</div> 1436 1437 1438<a id="getChildCount()"></a> 1439 1440<div class="jd-details api "> 1441 <h4 class="jd-details-title"> 1442 <span class="normal"> 1443 public 1444 1445 1446 1447 1448 int 1449 </span> 1450 <span class="sympad">getChildCount</span> 1451 <span class="normal">()</span> 1452 </h4> 1453 <div class="api-level"> 1454 <div> 1455 1456</div> 1457 1458 1459 1460 </div> 1461 <div class="jd-details-descr"> 1462 1463 <div class="jd-tagdata jd-tagdescr"><p>Counts the child UI elements immediately under the UI element currently represented by 1464 this UiObject.</p></div> 1465 <div class="jd-tagdata"> 1466 <h5 class="jd-tagtitle">Returns</h5> 1467 <ul class="nolist"><li>the count of child UI elements.</li></ul> 1468 </div> 1469 <div class="jd-tagdata"> 1470 <h5 class="jd-tagtitle">Throws</h5> 1471 <table class="jd-tagtable"> 1472 <tr> 1473 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 1474 <td></td> 1475 </tr> 1476 </table> 1477 </div> 1478 1479 </div> 1480</div> 1481 1482 1483<a id="getContentDescription()"></a> 1484 1485<div class="jd-details api "> 1486 <h4 class="jd-details-title"> 1487 <span class="normal"> 1488 public 1489 1490 1491 1492 1493 String 1494 </span> 1495 <span class="sympad">getContentDescription</span> 1496 <span class="normal">()</span> 1497 </h4> 1498 <div class="api-level"> 1499 <div> 1500 1501</div> 1502 1503 1504 1505 </div> 1506 <div class="jd-details-descr"> 1507 1508 <div class="jd-tagdata jd-tagdescr"><p>Reads the <code>content_desc</code> property of the UI element</p></div> 1509 <div class="jd-tagdata"> 1510 <h5 class="jd-tagtitle">Returns</h5> 1511 <ul class="nolist"><li>value of node attribute "content_desc"</li></ul> 1512 </div> 1513 <div class="jd-tagdata"> 1514 <h5 class="jd-tagtitle">Throws</h5> 1515 <table class="jd-tagtable"> 1516 <tr> 1517 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 1518 <td></td> 1519 </tr> 1520 </table> 1521 </div> 1522 1523 </div> 1524</div> 1525 1526 1527<a id="getFromParent(com.android.uiautomator.core.UiSelector)"></a> 1528 1529<div class="jd-details api "> 1530 <h4 class="jd-details-title"> 1531 <span class="normal"> 1532 public 1533 1534 1535 1536 1537 <a href="UiObject.html">UiObject</a> 1538 </span> 1539 <span class="sympad">getFromParent</span> 1540 <span class="normal">(<a href="UiSelector.html">UiSelector</a> selector)</span> 1541 </h4> 1542 <div class="api-level"> 1543 <div> 1544 1545</div> 1546 1547 1548 1549 </div> 1550 <div class="jd-details-descr"> 1551 1552 <div class="jd-tagdata jd-tagdescr"><p>Creates a new UiObject representing a child UI element from the parent element currently 1553 represented by this object. Essentially this is starting the search from the parent 1554 element and can also be used to find sibling UI elements to the one currently represented 1555 by this UiObject.</p></div> 1556 <div class="jd-tagdata"> 1557 <h5 class="jd-tagtitle">Parameters</h5> 1558 <table class="jd-tagtable"> 1559 <tr> 1560 <th>selector</th> 1561 <td>for the UI element to match</td> 1562 </tr> 1563 </table> 1564 </div> 1565 <div class="jd-tagdata"> 1566 <h5 class="jd-tagtitle">Returns</h5> 1567 <ul class="nolist"><li>a new UiObject representing the matched UI element</li></ul> 1568 </div> 1569 <div class="jd-tagdata"> 1570 <h5 class="jd-tagtitle">Throws</h5> 1571 <table class="jd-tagtable"> 1572 <tr> 1573 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 1574 <td></td> 1575 </tr> 1576 </table> 1577 </div> 1578 1579 </div> 1580</div> 1581 1582 1583<a id="getPackageName()"></a> 1584 1585<div class="jd-details api "> 1586 <h4 class="jd-details-title"> 1587 <span class="normal"> 1588 public 1589 1590 1591 1592 1593 String 1594 </span> 1595 <span class="sympad">getPackageName</span> 1596 <span class="normal">()</span> 1597 </h4> 1598 <div class="api-level"> 1599 <div> 1600 1601</div> 1602 1603 1604 1605 </div> 1606 <div class="jd-details-descr"> 1607 1608 <div class="jd-tagdata jd-tagdescr"><p>Reads the UI element's <code>package</code> property</p></div> 1609 <div class="jd-tagdata"> 1610 <h5 class="jd-tagtitle">Returns</h5> 1611 <ul class="nolist"><li>true if it is else false</li></ul> 1612 </div> 1613 <div class="jd-tagdata"> 1614 <h5 class="jd-tagtitle">Throws</h5> 1615 <table class="jd-tagtable"> 1616 <tr> 1617 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 1618 <td></td> 1619 </tr> 1620 </table> 1621 </div> 1622 1623 </div> 1624</div> 1625 1626 1627<a id="getSelector()"></a> 1628 1629<div class="jd-details api "> 1630 <h4 class="jd-details-title"> 1631 <span class="normal"> 1632 public 1633 1634 final 1635 1636 1637 <a href="UiSelector.html">UiSelector</a> 1638 </span> 1639 <span class="sympad">getSelector</span> 1640 <span class="normal">()</span> 1641 </h4> 1642 <div class="api-level"> 1643 <div> 1644 1645</div> 1646 1647 1648 1649 </div> 1650 <div class="jd-details-descr"> 1651 1652 <div class="jd-tagdata jd-tagdescr"><p>Debugging helper. A test can dump the properties of a selector as a string 1653 to its logs if needed. <code>getSelector().toString();</code></p></div> 1654 <div class="jd-tagdata"> 1655 <h5 class="jd-tagtitle">Returns</h5> 1656 <ul class="nolist"><li><code><a href="UiSelector.html">UiSelector</a></code> 1657</li></ul> 1658 </div> 1659 1660 </div> 1661</div> 1662 1663 1664<a id="getText()"></a> 1665 1666<div class="jd-details api "> 1667 <h4 class="jd-details-title"> 1668 <span class="normal"> 1669 public 1670 1671 1672 1673 1674 String 1675 </span> 1676 <span class="sympad">getText</span> 1677 <span class="normal">()</span> 1678 </h4> 1679 <div class="api-level"> 1680 <div> 1681 1682</div> 1683 1684 1685 1686 </div> 1687 <div class="jd-details-descr"> 1688 1689 <div class="jd-tagdata jd-tagdescr"><p>Reads the <code>text</code> property of the UI element</p></div> 1690 <div class="jd-tagdata"> 1691 <h5 class="jd-tagtitle">Returns</h5> 1692 <ul class="nolist"><li>text value of the current node represented by this UiObject</li></ul> 1693 </div> 1694 <div class="jd-tagdata"> 1695 <h5 class="jd-tagtitle">Throws</h5> 1696 <table class="jd-tagtable"> 1697 <tr> 1698 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 1699 <td>if no match could be found 1700</td> 1701 </tr> 1702 </table> 1703 </div> 1704 1705 </div> 1706</div> 1707 1708 1709<a id="getVisibleBounds()"></a> 1710 1711<div class="jd-details api "> 1712 <h4 class="jd-details-title"> 1713 <span class="normal"> 1714 public 1715 1716 1717 1718 1719 Rect 1720 </span> 1721 <span class="sympad">getVisibleBounds</span> 1722 <span class="normal">()</span> 1723 </h4> 1724 <div class="api-level"> 1725 <div> 1726 1727</div> 1728 1729 1730 1731 </div> 1732 <div class="jd-details-descr"> 1733 1734 <div class="jd-tagdata jd-tagdescr"><p>Returns the visible bounds of the UI element. 1735 1736 If a portion of the UI element is visible, only the bounds of the visible portion are 1737 reported.</p></div> 1738 <div class="jd-tagdata"> 1739 <h5 class="jd-tagtitle">Returns</h5> 1740 <ul class="nolist"><li>Rect</li></ul> 1741 </div> 1742 <div class="jd-tagdata"> 1743 <h5 class="jd-tagtitle">Throws</h5> 1744 <table class="jd-tagtable"> 1745 <tr> 1746 <th></td> 1747 <td>UiObjectNotFoundException</td> 1748 </tr> 1749 <tr> 1750 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 1751 <td></td> 1752 </tr> 1753 </table> 1754 </div> 1755 <div class="jd-tagdata"> 1756 <h5 class="jd-tagtitle">Since</h5> 1757 <ul class="nolist"><li>Android API Level 17</li></ul> 1758</div> 1759 </div> 1760</div> 1761 1762 1763<a id="isCheckable()"></a> 1764 1765<div class="jd-details api "> 1766 <h4 class="jd-details-title"> 1767 <span class="normal"> 1768 public 1769 1770 1771 1772 1773 boolean 1774 </span> 1775 <span class="sympad">isCheckable</span> 1776 <span class="normal">()</span> 1777 </h4> 1778 <div class="api-level"> 1779 <div> 1780 1781</div> 1782 1783 1784 1785 </div> 1786 <div class="jd-details-descr"> 1787 1788 <div class="jd-tagdata jd-tagdescr"><p>Check if the UI element's <code>checkable</code> property is currently true</p></div> 1789 <div class="jd-tagdata"> 1790 <h5 class="jd-tagtitle">Returns</h5> 1791 <ul class="nolist"><li>true if it is else false</li></ul> 1792 </div> 1793 <div class="jd-tagdata"> 1794 <h5 class="jd-tagtitle">Throws</h5> 1795 <table class="jd-tagtable"> 1796 <tr> 1797 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 1798 <td></td> 1799 </tr> 1800 </table> 1801 </div> 1802 1803 </div> 1804</div> 1805 1806 1807<a id="isChecked()"></a> 1808 1809<div class="jd-details api "> 1810 <h4 class="jd-details-title"> 1811 <span class="normal"> 1812 public 1813 1814 1815 1816 1817 boolean 1818 </span> 1819 <span class="sympad">isChecked</span> 1820 <span class="normal">()</span> 1821 </h4> 1822 <div class="api-level"> 1823 <div> 1824 1825</div> 1826 1827 1828 1829 </div> 1830 <div class="jd-details-descr"> 1831 1832 <div class="jd-tagdata jd-tagdescr"><p>Check if the UI element's <code>checked</code> property is currently true</p></div> 1833 <div class="jd-tagdata"> 1834 <h5 class="jd-tagtitle">Returns</h5> 1835 <ul class="nolist"><li>true if it is else false 1836</li></ul> 1837 </div> 1838 <div class="jd-tagdata"> 1839 <h5 class="jd-tagtitle">Throws</h5> 1840 <table class="jd-tagtable"> 1841 <tr> 1842 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 1843 <td></td> 1844 </tr> 1845 </table> 1846 </div> 1847 1848 </div> 1849</div> 1850 1851 1852<a id="isClickable()"></a> 1853 1854<div class="jd-details api "> 1855 <h4 class="jd-details-title"> 1856 <span class="normal"> 1857 public 1858 1859 1860 1861 1862 boolean 1863 </span> 1864 <span class="sympad">isClickable</span> 1865 <span class="normal">()</span> 1866 </h4> 1867 <div class="api-level"> 1868 <div> 1869 1870</div> 1871 1872 1873 1874 </div> 1875 <div class="jd-details-descr"> 1876 1877 <div class="jd-tagdata jd-tagdescr"><p>Check if the UI element's <code>clickable</code> property is currently true</p></div> 1878 <div class="jd-tagdata"> 1879 <h5 class="jd-tagtitle">Returns</h5> 1880 <ul class="nolist"><li>true if it is else false</li></ul> 1881 </div> 1882 <div class="jd-tagdata"> 1883 <h5 class="jd-tagtitle">Throws</h5> 1884 <table class="jd-tagtable"> 1885 <tr> 1886 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 1887 <td></td> 1888 </tr> 1889 </table> 1890 </div> 1891 1892 </div> 1893</div> 1894 1895 1896<a id="isEnabled()"></a> 1897 1898<div class="jd-details api "> 1899 <h4 class="jd-details-title"> 1900 <span class="normal"> 1901 public 1902 1903 1904 1905 1906 boolean 1907 </span> 1908 <span class="sympad">isEnabled</span> 1909 <span class="normal">()</span> 1910 </h4> 1911 <div class="api-level"> 1912 <div> 1913 1914</div> 1915 1916 1917 1918 </div> 1919 <div class="jd-details-descr"> 1920 1921 <div class="jd-tagdata jd-tagdescr"><p>Check if the UI element's <code>enabled</code> property is currently true</p></div> 1922 <div class="jd-tagdata"> 1923 <h5 class="jd-tagtitle">Returns</h5> 1924 <ul class="nolist"><li>true if it is else false</li></ul> 1925 </div> 1926 <div class="jd-tagdata"> 1927 <h5 class="jd-tagtitle">Throws</h5> 1928 <table class="jd-tagtable"> 1929 <tr> 1930 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 1931 <td></td> 1932 </tr> 1933 </table> 1934 </div> 1935 1936 </div> 1937</div> 1938 1939 1940<a id="isFocusable()"></a> 1941 1942<div class="jd-details api "> 1943 <h4 class="jd-details-title"> 1944 <span class="normal"> 1945 public 1946 1947 1948 1949 1950 boolean 1951 </span> 1952 <span class="sympad">isFocusable</span> 1953 <span class="normal">()</span> 1954 </h4> 1955 <div class="api-level"> 1956 <div> 1957 1958</div> 1959 1960 1961 1962 </div> 1963 <div class="jd-details-descr"> 1964 1965 <div class="jd-tagdata jd-tagdescr"><p>Check if the UI element's <code>focusable</code> property is currently true</p></div> 1966 <div class="jd-tagdata"> 1967 <h5 class="jd-tagtitle">Returns</h5> 1968 <ul class="nolist"><li>true if it is else false</li></ul> 1969 </div> 1970 <div class="jd-tagdata"> 1971 <h5 class="jd-tagtitle">Throws</h5> 1972 <table class="jd-tagtable"> 1973 <tr> 1974 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 1975 <td></td> 1976 </tr> 1977 </table> 1978 </div> 1979 1980 </div> 1981</div> 1982 1983 1984<a id="isFocused()"></a> 1985 1986<div class="jd-details api "> 1987 <h4 class="jd-details-title"> 1988 <span class="normal"> 1989 public 1990 1991 1992 1993 1994 boolean 1995 </span> 1996 <span class="sympad">isFocused</span> 1997 <span class="normal">()</span> 1998 </h4> 1999 <div class="api-level"> 2000 <div> 2001 2002</div> 2003 2004 2005 2006 </div> 2007 <div class="jd-details-descr"> 2008 2009 <div class="jd-tagdata jd-tagdescr"><p>Check if the UI element's <code>focused</code> property is currently true</p></div> 2010 <div class="jd-tagdata"> 2011 <h5 class="jd-tagtitle">Returns</h5> 2012 <ul class="nolist"><li>true if it is else false</li></ul> 2013 </div> 2014 <div class="jd-tagdata"> 2015 <h5 class="jd-tagtitle">Throws</h5> 2016 <table class="jd-tagtable"> 2017 <tr> 2018 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 2019 <td></td> 2020 </tr> 2021 </table> 2022 </div> 2023 2024 </div> 2025</div> 2026 2027 2028<a id="isLongClickable()"></a> 2029 2030<div class="jd-details api "> 2031 <h4 class="jd-details-title"> 2032 <span class="normal"> 2033 public 2034 2035 2036 2037 2038 boolean 2039 </span> 2040 <span class="sympad">isLongClickable</span> 2041 <span class="normal">()</span> 2042 </h4> 2043 <div class="api-level"> 2044 <div> 2045 2046</div> 2047 2048 2049 2050 </div> 2051 <div class="jd-details-descr"> 2052 2053 <div class="jd-tagdata jd-tagdescr"><p>Check if the UI element's <code>long-clickable</code> property is currently true</p></div> 2054 <div class="jd-tagdata"> 2055 <h5 class="jd-tagtitle">Returns</h5> 2056 <ul class="nolist"><li>true if it is else false</li></ul> 2057 </div> 2058 <div class="jd-tagdata"> 2059 <h5 class="jd-tagtitle">Throws</h5> 2060 <table class="jd-tagtable"> 2061 <tr> 2062 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 2063 <td></td> 2064 </tr> 2065 </table> 2066 </div> 2067 2068 </div> 2069</div> 2070 2071 2072<a id="isScrollable()"></a> 2073 2074<div class="jd-details api "> 2075 <h4 class="jd-details-title"> 2076 <span class="normal"> 2077 public 2078 2079 2080 2081 2082 boolean 2083 </span> 2084 <span class="sympad">isScrollable</span> 2085 <span class="normal">()</span> 2086 </h4> 2087 <div class="api-level"> 2088 <div> 2089 2090</div> 2091 2092 2093 2094 </div> 2095 <div class="jd-details-descr"> 2096 2097 <div class="jd-tagdata jd-tagdescr"><p>Check if the UI element's <code>scrollable</code> property is currently true</p></div> 2098 <div class="jd-tagdata"> 2099 <h5 class="jd-tagtitle">Returns</h5> 2100 <ul class="nolist"><li>true if it is else false</li></ul> 2101 </div> 2102 <div class="jd-tagdata"> 2103 <h5 class="jd-tagtitle">Throws</h5> 2104 <table class="jd-tagtable"> 2105 <tr> 2106 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 2107 <td></td> 2108 </tr> 2109 </table> 2110 </div> 2111 2112 </div> 2113</div> 2114 2115 2116<a id="isSelected()"></a> 2117 2118<div class="jd-details api "> 2119 <h4 class="jd-details-title"> 2120 <span class="normal"> 2121 public 2122 2123 2124 2125 2126 boolean 2127 </span> 2128 <span class="sympad">isSelected</span> 2129 <span class="normal">()</span> 2130 </h4> 2131 <div class="api-level"> 2132 <div> 2133 2134</div> 2135 2136 2137 2138 </div> 2139 <div class="jd-details-descr"> 2140 2141 <div class="jd-tagdata jd-tagdescr"><p>Check if the UI element's <code>selected</code> property is currently true</p></div> 2142 <div class="jd-tagdata"> 2143 <h5 class="jd-tagtitle">Returns</h5> 2144 <ul class="nolist"><li>true if it is else false</li></ul> 2145 </div> 2146 <div class="jd-tagdata"> 2147 <h5 class="jd-tagtitle">Throws</h5> 2148 <table class="jd-tagtable"> 2149 <tr> 2150 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 2151 <td></td> 2152 </tr> 2153 </table> 2154 </div> 2155 2156 </div> 2157</div> 2158 2159 2160<a id="longClick()"></a> 2161 2162<div class="jd-details api "> 2163 <h4 class="jd-details-title"> 2164 <span class="normal"> 2165 public 2166 2167 2168 2169 2170 boolean 2171 </span> 2172 <span class="sympad">longClick</span> 2173 <span class="normal">()</span> 2174 </h4> 2175 <div class="api-level"> 2176 <div> 2177 2178</div> 2179 2180 2181 2182 </div> 2183 <div class="jd-details-descr"> 2184 2185 <div class="jd-tagdata jd-tagdescr"><p>Long clicks the center of the visible bounds of the UI element</p></div> 2186 <div class="jd-tagdata"> 2187 <h5 class="jd-tagtitle">Returns</h5> 2188 <ul class="nolist"><li>true if operation was successful</li></ul> 2189 </div> 2190 <div class="jd-tagdata"> 2191 <h5 class="jd-tagtitle">Throws</h5> 2192 <table class="jd-tagtable"> 2193 <tr> 2194 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 2195 <td></td> 2196 </tr> 2197 </table> 2198 </div> 2199 2200 </div> 2201</div> 2202 2203 2204<a id="longClickBottomRight()"></a> 2205 2206<div class="jd-details api "> 2207 <h4 class="jd-details-title"> 2208 <span class="normal"> 2209 public 2210 2211 2212 2213 2214 boolean 2215 </span> 2216 <span class="sympad">longClickBottomRight</span> 2217 <span class="normal">()</span> 2218 </h4> 2219 <div class="api-level"> 2220 <div> 2221 2222</div> 2223 2224 2225 2226 </div> 2227 <div class="jd-details-descr"> 2228 2229 <div class="jd-tagdata jd-tagdescr"><p>Long clicks bottom and right corner of the UI element</p></div> 2230 <div class="jd-tagdata"> 2231 <h5 class="jd-tagtitle">Returns</h5> 2232 <ul class="nolist"><li>true if operation was successful</li></ul> 2233 </div> 2234 <div class="jd-tagdata"> 2235 <h5 class="jd-tagtitle">Throws</h5> 2236 <table class="jd-tagtable"> 2237 <tr> 2238 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 2239 <td></td> 2240 </tr> 2241 </table> 2242 </div> 2243 2244 </div> 2245</div> 2246 2247 2248<a id="longClickTopLeft()"></a> 2249 2250<div class="jd-details api "> 2251 <h4 class="jd-details-title"> 2252 <span class="normal"> 2253 public 2254 2255 2256 2257 2258 boolean 2259 </span> 2260 <span class="sympad">longClickTopLeft</span> 2261 <span class="normal">()</span> 2262 </h4> 2263 <div class="api-level"> 2264 <div> 2265 2266</div> 2267 2268 2269 2270 </div> 2271 <div class="jd-details-descr"> 2272 2273 <div class="jd-tagdata jd-tagdescr"><p>Long clicks on the top and left corner of the UI element</p></div> 2274 <div class="jd-tagdata"> 2275 <h5 class="jd-tagtitle">Returns</h5> 2276 <ul class="nolist"><li>true if operation was successful</li></ul> 2277 </div> 2278 <div class="jd-tagdata"> 2279 <h5 class="jd-tagtitle">Throws</h5> 2280 <table class="jd-tagtable"> 2281 <tr> 2282 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 2283 <td></td> 2284 </tr> 2285 </table> 2286 </div> 2287 2288 </div> 2289</div> 2290 2291 2292<a id="setText(java.lang.String)"></a> 2293 2294<div class="jd-details api "> 2295 <h4 class="jd-details-title"> 2296 <span class="normal"> 2297 public 2298 2299 2300 2301 2302 boolean 2303 </span> 2304 <span class="sympad">setText</span> 2305 <span class="normal">(String text)</span> 2306 </h4> 2307 <div class="api-level"> 2308 <div> 2309 2310</div> 2311 2312 2313 2314 </div> 2315 <div class="jd-details-descr"> 2316 2317 <div class="jd-tagdata jd-tagdescr"><p>Sets the text in an editable field, after clearing the field's content. 2318 2319 The <code><a href="UiSelector.html">UiSelector</a></code> selector of this object must reference a UI element that is editable. 2320 2321 When you call this method, the method first simulates a <code><a href="#click()">click()</a></code> on 2322 editable field to set focus. The method then clears the field's contents 2323 and injects your specified text into the field. 2324 2325 If you want to capture the original contents of the field, call <code><a href="#getText()">getText()</a></code> first. 2326 You can then modify the text and use this method to update the field.</p></div> 2327 <div class="jd-tagdata"> 2328 <h5 class="jd-tagtitle">Parameters</h5> 2329 <table class="jd-tagtable"> 2330 <tr> 2331 <th>text</th> 2332 <td>string to set</td> 2333 </tr> 2334 </table> 2335 </div> 2336 <div class="jd-tagdata"> 2337 <h5 class="jd-tagtitle">Returns</h5> 2338 <ul class="nolist"><li>true if operation is successful</li></ul> 2339 </div> 2340 <div class="jd-tagdata"> 2341 <h5 class="jd-tagtitle">Throws</h5> 2342 <table class="jd-tagtable"> 2343 <tr> 2344 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 2345 <td></td> 2346 </tr> 2347 </table> 2348 </div> 2349 2350 </div> 2351</div> 2352 2353 2354<a id="swipeDown(int)"></a> 2355 2356<div class="jd-details api "> 2357 <h4 class="jd-details-title"> 2358 <span class="normal"> 2359 public 2360 2361 2362 2363 2364 boolean 2365 </span> 2366 <span class="sympad">swipeDown</span> 2367 <span class="normal">(int steps)</span> 2368 </h4> 2369 <div class="api-level"> 2370 <div> 2371 2372</div> 2373 2374 2375 2376 </div> 2377 <div class="jd-details-descr"> 2378 2379 <div class="jd-tagdata jd-tagdescr"><p>Perform the action on the UI element that is represented by this object, Also see 2380 #scrollToBeginning(int), #scrollToEnd(int), #scrollBackward(), 2381 #scrollForward(). This method will perform the swipe gesture over any 2382 surface. The targeted UI element does not need to have the attribute 2383 <code>scrollable</code> set to <code>true</code> for this operation to be performed.</p></div> 2384 <div class="jd-tagdata"> 2385 <h5 class="jd-tagtitle">Parameters</h5> 2386 <table class="jd-tagtable"> 2387 <tr> 2388 <th>steps</th> 2389 <td>indicates the number of injected move steps into the system. Steps are 2390 injected about 5ms apart. So a 100 steps may take about 1/2 second to complete.</td> 2391 </tr> 2392 </table> 2393 </div> 2394 <div class="jd-tagdata"> 2395 <h5 class="jd-tagtitle">Returns</h5> 2396 <ul class="nolist"><li>true if successful</li></ul> 2397 </div> 2398 <div class="jd-tagdata"> 2399 <h5 class="jd-tagtitle">Throws</h5> 2400 <table class="jd-tagtable"> 2401 <tr> 2402 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 2403 <td></td> 2404 </tr> 2405 </table> 2406 </div> 2407 2408 </div> 2409</div> 2410 2411 2412<a id="swipeLeft(int)"></a> 2413 2414<div class="jd-details api "> 2415 <h4 class="jd-details-title"> 2416 <span class="normal"> 2417 public 2418 2419 2420 2421 2422 boolean 2423 </span> 2424 <span class="sympad">swipeLeft</span> 2425 <span class="normal">(int steps)</span> 2426 </h4> 2427 <div class="api-level"> 2428 <div> 2429 2430</div> 2431 2432 2433 2434 </div> 2435 <div class="jd-details-descr"> 2436 2437 <div class="jd-tagdata jd-tagdescr"><p>Perform the action on the UI element that is represented by this object. Also see 2438 #scrollToBeginning(int), #scrollToEnd(int), #scrollBackward(), 2439 #scrollForward(). This method will perform the swipe gesture over any 2440 surface. The targeted UI element does not need to have the attribute 2441 <code>scrollable</code> set to <code>true</code> for this operation to be performed.</p></div> 2442 <div class="jd-tagdata"> 2443 <h5 class="jd-tagtitle">Parameters</h5> 2444 <table class="jd-tagtable"> 2445 <tr> 2446 <th>steps</th> 2447 <td>indicates the number of injected move steps into the system. Steps are 2448 injected about 5ms apart. So a 100 steps may take about 1/2 second to complete.</td> 2449 </tr> 2450 </table> 2451 </div> 2452 <div class="jd-tagdata"> 2453 <h5 class="jd-tagtitle">Returns</h5> 2454 <ul class="nolist"><li>true if successful</li></ul> 2455 </div> 2456 <div class="jd-tagdata"> 2457 <h5 class="jd-tagtitle">Throws</h5> 2458 <table class="jd-tagtable"> 2459 <tr> 2460 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 2461 <td></td> 2462 </tr> 2463 </table> 2464 </div> 2465 2466 </div> 2467</div> 2468 2469 2470<a id="swipeRight(int)"></a> 2471 2472<div class="jd-details api "> 2473 <h4 class="jd-details-title"> 2474 <span class="normal"> 2475 public 2476 2477 2478 2479 2480 boolean 2481 </span> 2482 <span class="sympad">swipeRight</span> 2483 <span class="normal">(int steps)</span> 2484 </h4> 2485 <div class="api-level"> 2486 <div> 2487 2488</div> 2489 2490 2491 2492 </div> 2493 <div class="jd-details-descr"> 2494 2495 <div class="jd-tagdata jd-tagdescr"><p>Perform the action on the UI element that is represented by this object. Also see 2496 #scrollToBeginning(int), #scrollToEnd(int), #scrollBackward(), 2497 #scrollForward(). This method will perform the swipe gesture over any 2498 surface. The targeted UI element does not need to have the attribute 2499 <code>scrollable</code> set to <code>true</code> for this operation to be performed.</p></div> 2500 <div class="jd-tagdata"> 2501 <h5 class="jd-tagtitle">Parameters</h5> 2502 <table class="jd-tagtable"> 2503 <tr> 2504 <th>steps</th> 2505 <td>indicates the number of injected move steps into the system. Steps are 2506 injected about 5ms apart. So a 100 steps may take about 1/2 second to complete.</td> 2507 </tr> 2508 </table> 2509 </div> 2510 <div class="jd-tagdata"> 2511 <h5 class="jd-tagtitle">Returns</h5> 2512 <ul class="nolist"><li>true if successful</li></ul> 2513 </div> 2514 <div class="jd-tagdata"> 2515 <h5 class="jd-tagtitle">Throws</h5> 2516 <table class="jd-tagtable"> 2517 <tr> 2518 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 2519 <td></td> 2520 </tr> 2521 </table> 2522 </div> 2523 2524 </div> 2525</div> 2526 2527 2528<a id="swipeUp(int)"></a> 2529 2530<div class="jd-details api "> 2531 <h4 class="jd-details-title"> 2532 <span class="normal"> 2533 public 2534 2535 2536 2537 2538 boolean 2539 </span> 2540 <span class="sympad">swipeUp</span> 2541 <span class="normal">(int steps)</span> 2542 </h4> 2543 <div class="api-level"> 2544 <div> 2545 2546</div> 2547 2548 2549 2550 </div> 2551 <div class="jd-details-descr"> 2552 2553 <div class="jd-tagdata jd-tagdescr"><p>Perform the action on the UI element that is represented by this UiObject. Also see 2554 #scrollToBeginning(int), #scrollToEnd(int), #scrollBackward(), 2555 #scrollForward().</p></div> 2556 <div class="jd-tagdata"> 2557 <h5 class="jd-tagtitle">Parameters</h5> 2558 <table class="jd-tagtable"> 2559 <tr> 2560 <th>steps</th> 2561 <td>indicates the number of injected move steps into the system. Steps are 2562 injected about 5ms apart. So a 100 steps may take about 1/2 second to complete.</td> 2563 </tr> 2564 </table> 2565 </div> 2566 <div class="jd-tagdata"> 2567 <h5 class="jd-tagtitle">Returns</h5> 2568 <ul class="nolist"><li>true of successful</li></ul> 2569 </div> 2570 <div class="jd-tagdata"> 2571 <h5 class="jd-tagtitle">Throws</h5> 2572 <table class="jd-tagtable"> 2573 <tr> 2574 <th><a href="UiObjectNotFoundException.html">UiObjectNotFoundException</a></td> 2575 <td></td> 2576 </tr> 2577 </table> 2578 </div> 2579 2580 </div> 2581</div> 2582 2583 2584<a id="waitForExists(long)"></a> 2585 2586<div class="jd-details api "> 2587 <h4 class="jd-details-title"> 2588 <span class="normal"> 2589 public 2590 2591 2592 2593 2594 boolean 2595 </span> 2596 <span class="sympad">waitForExists</span> 2597 <span class="normal">(long timeout)</span> 2598 </h4> 2599 <div class="api-level"> 2600 <div> 2601 2602</div> 2603 2604 2605 2606 </div> 2607 <div class="jd-details-descr"> 2608 2609 <div class="jd-tagdata jd-tagdescr"><p>Waits a specified length of time for a UI element to become visible. 2610 2611 This method waits until the UI element becomes visible on the display, or 2612 until the timeout has elapsed. You can use this method in situations where 2613 the content that you want to select is not immediately displayed.</p></div> 2614 <div class="jd-tagdata"> 2615 <h5 class="jd-tagtitle">Parameters</h5> 2616 <table class="jd-tagtable"> 2617 <tr> 2618 <th>timeout</th> 2619 <td>the amount of time to wait (in milliseconds)</td> 2620 </tr> 2621 </table> 2622 </div> 2623 <div class="jd-tagdata"> 2624 <h5 class="jd-tagtitle">Returns</h5> 2625 <ul class="nolist"><li>true if the UI element is displayed, else false if timeout elapsed while waiting 2626</li></ul> 2627 </div> 2628 2629 </div> 2630</div> 2631 2632 2633<a id="waitUntilGone(long)"></a> 2634 2635<div class="jd-details api "> 2636 <h4 class="jd-details-title"> 2637 <span class="normal"> 2638 public 2639 2640 2641 2642 2643 boolean 2644 </span> 2645 <span class="sympad">waitUntilGone</span> 2646 <span class="normal">(long timeout)</span> 2647 </h4> 2648 <div class="api-level"> 2649 <div> 2650 2651</div> 2652 2653 2654 2655 </div> 2656 <div class="jd-details-descr"> 2657 2658 <div class="jd-tagdata jd-tagdescr"><p>Waits a specified length of time for a UI element to become undetectable. 2659 2660 This method waits until a UI element is no longer matchable, or until the 2661 timeout has elapsed. 2662 2663 A UI element becomes undetectable when the <code><a href="UiSelector.html">UiSelector</a></code> of the object is 2664 unable to find a match because the element has either changed its state or is no 2665 longer displayed. 2666 2667 You can use this method when attempting to wait for some long operation 2668 to compete, such as downloading a large file or connecting to a remote server.</p></div> 2669 <div class="jd-tagdata"> 2670 <h5 class="jd-tagtitle">Parameters</h5> 2671 <table class="jd-tagtable"> 2672 <tr> 2673 <th>timeout</th> 2674 <td>time to wait (in milliseconds)</td> 2675 </tr> 2676 </table> 2677 </div> 2678 <div class="jd-tagdata"> 2679 <h5 class="jd-tagtitle">Returns</h5> 2680 <ul class="nolist"><li>true if the element is gone before timeout elapsed, else false if timeout elapsed 2681 but a matching element is still found. 2682</li></ul> 2683 </div> 2684 2685 </div> 2686</div> 2687 2688