1/* 2 * Copyright (C) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License,Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing,software 10 * distributed under the License is distributed on an "ASIS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit TestKit 19 */ 20 21import { Callback } from './@ohos.base'; 22 23/** 24 * Enumerates the string value match pattern. 25 * 26 * @enum {number} 27 * @syscap SystemCapability.Test.UiTest 28 * @since 8 29 */ 30/** 31 * Enumerates the string value match pattern. 32 * 33 * @enum {number} 34 * @syscap SystemCapability.Test.UiTest 35 * @crossplatform 36 * @since 10 37 */ 38/** 39 * Enumerates the string value match pattern. 40 * 41 * @enum {number} 42 * @syscap SystemCapability.Test.UiTest 43 * @crossplatform 44 * @atomicservice 45 * @since 11 46 */ 47declare enum MatchPattern { 48 /** 49 * Equals to a string. 50 * 51 * @syscap SystemCapability.Test.UiTest 52 * @since 8 53 * @test 54 */ 55 /** 56 * Equals to a string. 57 * 58 * @syscap SystemCapability.Test.UiTest 59 * @crossplatform 60 * @since 10 61 * @test 62 */ 63 /** 64 * Equals to a string. 65 * 66 * @syscap SystemCapability.Test.UiTest 67 * @crossplatform 68 * @atomicservice 69 * @since 11 70 * @test 71 */ 72 EQUALS = 0, 73 /** 74 * Contains a substring. 75 * 76 * @syscap SystemCapability.Test.UiTest 77 * @since 8 78 * @test 79 */ 80 /** 81 * Contains a substring. 82 * 83 * @syscap SystemCapability.Test.UiTest 84 * @crossplatform 85 * @since 10 86 * @test 87 */ 88 /** 89 * Contains a substring. 90 * 91 * @syscap SystemCapability.Test.UiTest 92 * @crossplatform 93 * @atomicservice 94 * @since 11 95 * @test 96 */ 97 CONTAINS = 1, 98 /** 99 * StartsWith a substring. 100 * 101 * @syscap SystemCapability.Test.UiTest 102 * @since 8 103 * @test 104 */ 105 /** 106 * StartsWith a substring. 107 * 108 * @syscap SystemCapability.Test.UiTest 109 * @crossplatform 110 * @since 10 111 * @test 112 */ 113 /** 114 * StartsWith a substring. 115 * 116 * @syscap SystemCapability.Test.UiTest 117 * @crossplatform 118 * @atomicservice 119 * @since 11 120 * @test 121 */ 122 STARTS_WITH = 2, 123 /** 124 * EndsWith a substring. 125 * 126 * @syscap SystemCapability.Test.UiTest 127 * @since 8 128 * @test 129 */ 130 /** 131 * EndsWith a substring. 132 * 133 * @syscap SystemCapability.Test.UiTest 134 * @crossplatform 135 * @since 10 136 * @test 137 */ 138 /** 139 * EndsWith a substring. 140 * 141 * @syscap SystemCapability.Test.UiTest 142 * @crossplatform 143 * @atomicservice 144 * @since 11 145 * @test 146 */ 147 ENDS_WITH = 3 148} 149 150/** 151 * Describes the attribute requirements for the target UiComponents. 152 * 153 * @syscap SystemCapability.Test.UiTest 154 * @since 8 155 * @deprecated since 9 156 * @useinstead ohos.UiTest.On 157 */ 158declare class By { 159 /** 160 * Specifies the text for the target UiComponent. 161 * 162 * @param { string } txt The text value. 163 * @param { MatchPattern } pattern The {@link MatchPattern} of the text value,default to {@link MatchPattern.EQUALS} 164 * @returns { By } this {@link By} object. 165 * @syscap SystemCapability.Test.UiTest 166 * @since 8 167 * @deprecated since 9 168 * @useinstead ohos.UiTest.On#text 169 * @test 170 */ 171 text(txt: string, pattern?: MatchPattern): By; 172 173 /** 174 * Specifies the inspector key of the target UiComponent. 175 * 176 * @param { string } key The inspectorKey value. 177 * @returns { By } this {@link By} object. 178 * @syscap SystemCapability.Test.UiTest 179 * @since 8 180 * @deprecated since 9 181 * @useinstead ohos.UiTest.On#id 182 * @test 183 */ 184 key(key: string): By; 185 186 /** 187 * Specifies the id of the target UiComponent. 188 * 189 * @param { number } id The id value. 190 * @returns { By } this {@link By} object. 191 * @syscap SystemCapability.Test.UiTest 192 * @since 8 193 * @deprecated since 9 194 * @test 195 */ 196 id(id: number): By; 197 198 /** 199 * Specifies the type of the target UiComponent. 200 * 201 * @param { string } tp The type value. 202 * @returns { By } this {@link By} object. 203 * @syscap SystemCapability.Test.UiTest 204 * @since 8 205 * @deprecated since 9 206 * @useinstead ohos.UiTest.On#type 207 * @test 208 */ 209 type(tp: string): By; 210 211 /** 212 * Specifies the clickable status of the target UiComponent. 213 * 214 * @param { boolean } b The clickable status,default to true. 215 * @returns { By } this {@link By} object. 216 * @syscap SystemCapability.Test.UiTest 217 * @since 8 218 * @deprecated since 9 219 * @useinstead ohos.UiTest.On#clickable 220 * @test 221 */ 222 clickable(b?: boolean): By; 223 224 /** 225 * Specifies the scrollable status of the target UiComponent. 226 * 227 * @param { boolean } b The scrollable status,default to true. 228 * @returns { By } this {@link By} object. 229 * @syscap SystemCapability.Test.UiTest 230 * @since 8 231 * @deprecated since 9 232 * @useinstead ohos.UiTest.On#scrollable 233 * @test 234 */ 235 scrollable(b?: boolean): By; 236 237 /** 238 * Specifies the enabled status of the target UiComponent. 239 * 240 * @param { boolean } b The enabled status,default to true. 241 * @returns { By } this {@link By} object. 242 * @syscap SystemCapability.Test.UiTest 243 * @since 8 244 * @deprecated since 9 245 * @useinstead ohos.UiTest.On#enabled 246 * @test 247 */ 248 enabled(b?: boolean): By; 249 250 /** 251 * Specifies the focused status of the target UiComponent. 252 * 253 * @param { boolean } b The focused status,default to true. 254 * @returns { By } this {@link By} object. 255 * @syscap SystemCapability.Test.UiTest 256 * @since 8 257 * @deprecated since 9 258 * @useinstead ohos.UiTest.On#focused 259 * @test 260 */ 261 focused(b?: boolean): By; 262 263 /** 264 * Specifies the selected status of the target UiComponent. 265 * 266 * @param { boolean } b The selected status,default to true. 267 * @returns { By } this {@link By} object. 268 * @syscap SystemCapability.Test.UiTest 269 * @since 8 270 * @deprecated since 9 271 * @useinstead ohos.UiTest.On#selected 272 * @test 273 */ 274 selected(b?: boolean): By; 275 276 /** 277 * Requires the target UiComponent which is before another UiComponent that specified by the given {@link By} 278 * object,used to locate UiComponent relatively. 279 * 280 * @param { By } by Describes the attribute requirements of UiComponent which the target one is in front of. 281 * @returns { By } this {@link By} object. 282 * @syscap SystemCapability.Test.UiTest 283 * @since 8 284 * @deprecated since 9 285 * @useinstead ohos.UiTest.On#isBefore 286 * @test 287 */ 288 isBefore(by: By): By; 289 290 /** 291 * Requires the target UiComponent which is after another UiComponent that specified by the given {@link By} 292 * object,used to locate UiComponent relatively. 293 * 294 * @param { By } by Describes the attribute requirements of UiComponent which the target one is in back of. 295 * @returns { By } this {@link By} object. 296 * @syscap SystemCapability.Test.UiTest 297 * @since 8 298 * @deprecated since 9 299 * @useinstead ohos.UiTest.On#isAfter 300 * @test 301 */ 302 isAfter(by: By): By; 303} 304 305/** 306 * Represents a UiComponent of the ohos application,user can perform operations or query attributes on it. 307 * 308 * @syscap SystemCapability.Test.UiTest 309 * @since 8 310 * @deprecated since 9 311 * @useinstead ohos.uitest.Component 312 * @test 313 */ 314declare class UiComponent { 315 /** 316 * Click this {@link UiComponent}. 317 * 318 * @returns { Promise<void> } 319 * @syscap SystemCapability.Test.UiTest 320 * @since 8 321 * @deprecated since 9 322 * @useinstead ohos.UiTest.Component#click 323 * @test 324 */ 325 click(): Promise<void>; 326 327 /** 328 * Double click this {@link UiComponent}. 329 * 330 * @returns { Promise<void> } 331 * @syscap SystemCapability.Test.UiTest 332 * @since 8 333 * @deprecated since 9 334 * @useinstead ohos.UiTest.Component#doubleClick 335 * @test 336 */ 337 doubleClick(): Promise<void>; 338 339 /** 340 * Long click this {@link UiComponent}. 341 * 342 * @returns { Promise<void> } 343 * @syscap SystemCapability.Test.UiTest 344 * @since 8 345 * @deprecated since 9 346 * @useinstead ohos.UiTest.Component#longClick 347 * @test 348 */ 349 longClick(): Promise<void>; 350 351 /** 352 * Get the id attribute value. 353 * 354 * @returns { Promise<number> } the id value. 355 * @syscap SystemCapability.Test.UiTest 356 * @since 8 357 * @deprecated since 9 358 * @test 359 */ 360 getId(): Promise<number>; 361 362 /** 363 * Get the inspectorKey attribute value. 364 * 365 * @returns { Promise<string> } the inspectorKey value. 366 * @syscap SystemCapability.Test.UiTest 367 * @since 8 368 * @deprecated since 9 369 * @useinstead ohos.UiTest.Component#getId 370 * @test 371 */ 372 getKey(): Promise<string>; 373 374 /** 375 * Get the text attribute value. 376 * 377 * @returns { Promise<string> } the text value. 378 * @syscap SystemCapability.Test.UiTest 379 * @since 8 380 * @deprecated since 9 381 * @useinstead ohos.UiTest.Component#getText 382 * @test 383 */ 384 getText(): Promise<string>; 385 386 /** 387 * Get the type name. 388 * 389 * @returns { Promise<string> } the type name. 390 * @syscap SystemCapability.Test.UiTest 391 * @since 8 392 * @deprecated since 9 393 * @useinstead ohos.UiTest.Component#getType 394 * @test 395 */ 396 getType(): Promise<string>; 397 398 /** 399 * Get the clickable status of this {@link UiComponent}. 400 * 401 * @returns { Promise<boolean> } the clickable status. 402 * @syscap SystemCapability.Test.UiTest 403 * @since 8 404 * @deprecated since 9 405 * @useinstead ohos.UiTest.Component#isClickable 406 * @test 407 */ 408 isClickable(): Promise<boolean>; 409 410 /** 411 * Get the scrollable status of this {@link UiComponent}. 412 * 413 * @returns { Promise<boolean> } the scrollable status. 414 * @syscap SystemCapability.Test.UiTest 415 * @since 8 416 * @deprecated since 9 417 * @useinstead ohos.UiTest.Component#isScrollable 418 * @test 419 */ 420 isScrollable(): Promise<boolean>; 421 422 /** 423 * Get the enabled status of this {@link UiComponent}. 424 * 425 * @returns { Promise<boolean> } the enabled status. 426 * @syscap SystemCapability.Test.UiTest 427 * @since 8 428 * @deprecated since 9 429 * @useinstead ohos.UiTest.Component#isEnabled 430 * @test 431 */ 432 isEnabled(): Promise<boolean>; 433 434 /** 435 * Get the focused status of this {@link UiComponent}. 436 * 437 * @returns { Promise<boolean> } the focused status. 438 * @syscap SystemCapability.Test.UiTest 439 * @since 8 440 * @deprecated since 9 441 * @useinstead ohos.UiTest.Component#isFocused 442 * @test 443 */ 444 isFocused(): Promise<boolean>; 445 446 /** 447 * Get the selected status of this {@link UiComponent}. 448 * 449 * @returns { Promise<boolean> } the selected status. 450 * @syscap SystemCapability.Test.UiTest 451 * @since 8 452 * @deprecated since 9 453 * @useinstead ohos.UiTest.Component#isSelected 454 * @test 455 */ 456 isSelected(): Promise<boolean>; 457 458 /** 459 * Inject text to this {@link UiComponent},applicable to TextInput. 460 * 461 * @param { string } text The text to inject. 462 * @returns { Promise<void> } 463 * @syscap SystemCapability.Test.UiTest 464 * @since 8 465 * @deprecated since 9 466 * @useinstead ohos.UiTest.Component#inputText 467 * @test 468 */ 469 inputText(text: string): Promise<void>; 470 471 /** 472 * Scroll on this {@link UiComponent}to find matched {@link UiComponent},applicable to scrollable one. 473 * 474 * @param { By } by The attribute requirements of the target {@link UiComponent}. 475 * @returns { Promise<UiComponent> } the found result,or undefined if not found. 476 * @syscap SystemCapability.Test.UiTest 477 * @since 8 478 * @deprecated since 9 479 * @useinstead ohos.UiTest.Component#scrollSearch 480 * @test 481 */ 482 scrollSearch(by: By): Promise<UiComponent>; 483} 484 485/** 486 * The unified facade of UiTest framework,can be used to find {@link UiComponent},trigger keyEvents,perform 487 * coordinates-based UI actions,capture screen and so on. 488 * 489 * @syscap SystemCapability.Test.UiTest 490 * @since 8 491 * @deprecated since 9 492 * @useinstead ohos.uitest.Driver 493 * @test 494 */ 495declare class UiDriver { 496 /** 497 * Create an {@link UiDriver} object. 498 * 499 * @returns { UiDriver } the {@link UiDriver} object. 500 * @syscap SystemCapability.Test.UiTest 501 * @since 8 502 * @deprecated since 9 503 * @useinstead ohos.UiTest.Driver#create 504 * @test 505 */ 506 static create(): UiDriver; 507 508 /** 509 * Delay with specified duration. 510 * 511 * @param { number } duration The delay duration in milliseconds. 512 * @returns { Promise<void> } 513 * @syscap SystemCapability.Test.UiTest 514 * @since 8 515 * @deprecated since 9 516 * @useinstead ohos.UiTest.Driver#delayMs 517 * @test 518 */ 519 delayMs(duration: number): Promise<void>; 520 521 /** 522 * Find the first matched {@link UiComponent} on current UI. 523 * 524 * @param { By } by The attribute requirements of the target {@link UiComponent}. 525 * @returns { Promise<UiComponent> } the first matched {@link UiComponent} or undefined. 526 * @syscap SystemCapability.Test.UiTest 527 * @since 8 528 * @deprecated since 9 529 * @useinstead ohos.UiTest.Driver#findComponent 530 * @test 531 */ 532 findComponent(by: By): Promise<UiComponent>; 533 534 /** 535 * Find all the matched {@link UiComponent}s on current UI. 536 * 537 * @param { By } by The attribute requirements of the target {@link UiComponent}. 538 * @returns { Promise<Array<UiComponent>> } the matched {@link UiComponent}s list. 539 * @syscap SystemCapability.Test.UiTest 540 * @since 8 541 * @deprecated since 9 542 * @useinstead ohos.UiTest.Driver#findComponents 543 * @test 544 */ 545 findComponents(by: By): Promise<Array<UiComponent>>; 546 547 /** 548 * Assert the matched {@link UiComponent}s exists on current UI;if not,assertError will be raised. 549 * 550 * @param { By } by The attribute requirements of the target {@link UiComponent}. 551 * @returns { Promise<void> } 552 * @throws {BusinessError} 401 - if the input parameters are invalid. 553 * @throws {BusinessError} 17000002 - if the async function was not called with await. 554 * @throws {BusinessError} 17000003 - if the assertion failed. 555 * @syscap SystemCapability.Test.UiTest 556 * @since 8 557 * @deprecated since 9 558 * @useinstead ohos.UiTest.Driver#assertComponentExist 559 * @test 560 */ 561 assertComponentExist(by: By): Promise<void>; 562 563 /** 564 * Press the BACK key. 565 * 566 * @returns { Promise<void> } 567 * @syscap SystemCapability.Test.UiTest 568 * @since 8 569 * @deprecated since 9 570 * @useinstead ohos.UiTest.Driver#pressBack 571 * @test 572 */ 573 pressBack(): Promise<void>; 574 575 /** 576 * Press the specified key. 577 * 578 * @param { number } keyCode the target keyCode. 579 * @returns { Promise<void> } 580 * @syscap SystemCapability.Test.UiTest 581 * @since 8 582 * @deprecated since 9 583 * @useinstead ohos.UiTest.Driver#triggerKey 584 * @test 585 */ 586 triggerKey(keyCode: number): Promise<void>; 587 588 /** 589 * Click on the specified location on the screen. 590 * 591 * @param { number } x The x-coordinate. 592 * @param { number } y The y-coordinate. 593 * @returns { Promise<void> } 594 * @syscap SystemCapability.Test.UiTest 595 * @since 8 596 * @deprecated since 9 597 * @useinstead ohos.UiTest.Driver#click 598 * @test 599 */ 600 click(x: number, y: number): Promise<void>; 601 602 /** 603 * DoubleClick on the specified location on the screen. 604 * 605 * @param { number } x The x-coordinate. 606 * @param { number } y The y-coordinate. 607 * @returns { Promise<void> } 608 * @syscap SystemCapability.Test.UiTest 609 * @since 8 610 * @deprecated since 9 611 * @useinstead ohos.UiTest.Driver#doubleClick 612 * @test 613 */ 614 doubleClick(x: number, y: number): Promise<void>; 615 616 /** 617 * LongClick on the specified location on the screen. 618 * 619 * @param { number } x The x-coordinate. 620 * @param { number } y The y-coordinate. 621 * @returns { Promise<void> } 622 * @syscap SystemCapability.Test.UiTest 623 * @since 8 624 * @deprecated since 9 625 * @useinstead ohos.UiTest.Driver#longClick 626 * @test 627 */ 628 longClick(x: number, y: number): Promise<void>; 629 630 /** 631 * Swipe on the screen between the specified points. 632 * 633 * @param { number } startx The x-coordinate of the starting point. 634 * @param { number } starty The y-coordinate of the starting point. 635 * @param { number } endx The x-coordinate of the ending point. 636 * @param { number } endy The y-coordinate of the ending point. 637 * @returns { Promise<void> } 638 * @syscap SystemCapability.Test.UiTest 639 * @since 8 640 * @deprecated since 9 641 * @useinstead ohos.UiTest.Driver#swipe 642 * @test 643 */ 644 swipe(startx: number, starty: number, endx: number, endy: number): Promise<void>; 645 646 /** 647 * Capture current screen and save as picture which PNG format. 648 * 649 * @param { string } savePath the path where to store the picture. 650 * @returns { Promise<boolean> } true if screen-capturing and file-storing are completed successfully,false otherwise. 651 * @syscap SystemCapability.Test.UiTest 652 * @since 8 653 * @deprecated since 9 654 * @useinstead ohos.uitest.Driver#screenCap 655 * @test 656 */ 657 screenCap(savePath: string): Promise<boolean>; 658} 659 660/** 661 * Enumerates the window mode of the tested window. 662 * 663 * @enum { number } 664 * @syscap SystemCapability.Test.UiTest 665 * @since 9 666 */ 667/** 668 * Enumerates the window mode of the tested window. 669 * 670 * @enum { number } 671 * @syscap SystemCapability.Test.UiTest 672 * @atomicservice 673 * @since 11 674 */ 675declare enum WindowMode { 676 /** 677 * The test window is a full screen window. 678 * 679 * @syscap SystemCapability.Test.UiTest 680 * @since 9 681 * @test 682 */ 683 /** 684 * The test window is a full screen window. 685 * 686 * @syscap SystemCapability.Test.UiTest 687 * @atomicservice 688 * @since 11 689 * @test 690 */ 691 FULLSCREEN = 0, 692 /** 693 * The test window is the first window in the split screen state. 694 * 695 * @syscap SystemCapability.Test.UiTest 696 * @since 9 697 * @test 698 */ 699 /** 700 * The test window is the first window in the split screen state. 701 * 702 * @syscap SystemCapability.Test.UiTest 703 * @atomicservice 704 * @since 11 705 * @test 706 */ 707 PRIMARY = 1, 708 /** 709 * The test window is the second window in the split screen state. 710 * 711 * @syscap SystemCapability.Test.UiTest 712 * @since 9 713 * @test 714 */ 715 /** 716 * The test window is the second window in the split screen state. 717 * 718 * @syscap SystemCapability.Test.UiTest 719 * @atomicservice 720 * @since 11 721 * @test 722 */ 723 SECONDARY = 2, 724 /** 725 * The test window is a floating window. 726 * 727 * @syscap SystemCapability.Test.UiTest 728 * @since 9 729 * @test 730 */ 731 /** 732 * The test window is a floating window. 733 * 734 * @syscap SystemCapability.Test.UiTest 735 * @atomicservice 736 * @since 11 737 * @test 738 */ 739 FLOATING = 3 740} 741 742/** 743 * Enumerates the resize direction for the window. 744 * 745 * @enum { number } 746 * @syscap SystemCapability.Test.UiTest 747 * @since 9 748 */ 749/** 750 * Enumerates the resize direction for the window. 751 * 752 * @enum { number } 753 * @syscap SystemCapability.Test.UiTest 754 * @atomicservice 755 * @since 11 756 */ 757declare enum ResizeDirection { 758 /** 759 * Left. 760 * 761 * @syscap SystemCapability.Test.UiTest 762 * @since 9 763 * @test 764 */ 765 /** 766 * Left. 767 * 768 * @syscap SystemCapability.Test.UiTest 769 * @atomicservice 770 * @since 11 771 * @test 772 */ 773 LEFT = 0, 774 /** 775 * Right. 776 * 777 * @syscap SystemCapability.Test.UiTest 778 * @since 9 779 * @test 780 */ 781 /** 782 * Right. 783 * 784 * @syscap SystemCapability.Test.UiTest 785 * @atomicservice 786 * @since 11 787 * @test 788 */ 789 RIGHT = 1, 790 /** 791 * Up. 792 * 793 * @syscap SystemCapability.Test.UiTest 794 * @since 9 795 * @test 796 */ 797 /** 798 * Up. 799 * 800 * @syscap SystemCapability.Test.UiTest 801 * @atomicservice 802 * @since 11 803 * @test 804 */ 805 UP = 2, 806 /** 807 * Down. 808 * 809 * @syscap SystemCapability.Test.UiTest 810 * @since 9 811 * @test 812 */ 813 /** 814 * Down. 815 * 816 * @syscap SystemCapability.Test.UiTest 817 * @atomicservice 818 * @since 11 819 * @test 820 */ 821 DOWN = 3, 822 /** 823 * Upper left. 824 * 825 * @syscap SystemCapability.Test.UiTest 826 * @since 9 827 * @test 828 */ 829 /** 830 * Upper left. 831 * 832 * @syscap SystemCapability.Test.UiTest 833 * @atomicservice 834 * @since 11 835 * @test 836 */ 837 LEFT_UP = 4, 838 /** 839 * Lower left. 840 * 841 * @syscap SystemCapability.Test.UiTest 842 * @since 9 843 * @test 844 */ 845 /** 846 * Lower left. 847 * 848 * @syscap SystemCapability.Test.UiTest 849 * @atomicservice 850 * @since 11 851 * @test 852 */ 853 LEFT_DOWN = 5, 854 /** 855 * Upper right. 856 * 857 * @syscap SystemCapability.Test.UiTest 858 * @since 9 859 * @test 860 */ 861 /** 862 * Upper right. 863 * 864 * @syscap SystemCapability.Test.UiTest 865 * @atomicservice 866 * @since 11 867 * @test 868 */ 869 RIGHT_UP = 6, 870 /** 871 * Lower right. 872 * 873 * @syscap SystemCapability.Test.UiTest 874 * @since 9 875 * @test 876 */ 877 /** 878 * Lower right. 879 * 880 * @syscap SystemCapability.Test.UiTest 881 * @atomicservice 882 * @since 11 883 * @test 884 */ 885 RIGHT_DOWN = 7 886} 887 888/** 889 * Enumerates the rotation of the device display. 890 * 891 * @enum { number } 892 * @syscap SystemCapability.Test.UiTest 893 * @since 9 894 */ 895/** 896 * Enumerates the rotation of the device display. 897 * 898 * @enum { number } 899 * @syscap SystemCapability.Test.UiTest 900 * @atomicservice 901 * @since 11 902 */ 903declare enum DisplayRotation { 904 /** 905 * Device display does not rotate to display vertically. 906 * 907 * @syscap SystemCapability.Test.UiTest 908 * @since 9 909 * @test 910 */ 911 /** 912 * Device display does not rotate to display vertically. 913 * 914 * @syscap SystemCapability.Test.UiTest 915 * @atomicservice 916 * @since 11 917 * @test 918 */ 919 ROTATION_0 = 0, 920 /** 921 * Device display rotates 90 degrees clockwise to display horizontally. 922 * 923 * @syscap SystemCapability.Test.UiTest 924 * @since 9 925 * @test 926 */ 927 /** 928 * Device display rotates 90 degrees clockwise to display horizontally. 929 * 930 * @syscap SystemCapability.Test.UiTest 931 * @atomicservice 932 * @since 11 933 * @test 934 */ 935 ROTATION_90 = 1, 936 /** 937 * Device display rotates clockwise 180 degrees to display vertically in reverse. 938 * 939 * @syscap SystemCapability.Test.UiTest 940 * @since 9 941 * @test 942 */ 943 /** 944 * Device display rotates clockwise 180 degrees to display vertically in reverse. 945 * 946 * @syscap SystemCapability.Test.UiTest 947 * @atomicservice 948 * @since 11 949 * @test 950 */ 951 ROTATION_180 = 2, 952 /** 953 * Device display rotates 270 degrees clockwise to display horizontally in reverse. 954 * 955 * @syscap SystemCapability.Test.UiTest 956 * @since 9 957 * @test 958 */ 959 /** 960 * Device display rotates 270 degrees clockwise to display horizontally in reverse. 961 * 962 * @syscap SystemCapability.Test.UiTest 963 * @atomicservice 964 * @since 11 965 * @test 966 */ 967 ROTATION_270 = 3 968} 969 970/** 971 * Represents the point on the device screen. 972 * 973 * @typedef Point 974 * @syscap SystemCapability.Test.UiTest 975 * @since 9 976 */ 977/** 978 * Represents the point on the device screen. 979 * 980 * @typedef Point 981 * @syscap SystemCapability.Test.UiTest 982 * @crossplatform 983 * @since 10 984 */ 985/** 986 * Represents the point on the device screen. 987 * 988 * @typedef Point 989 * @syscap SystemCapability.Test.UiTest 990 * @crossplatform 991 * @atomicservice 992 * @since 11 993 */ 994declare interface Point { 995 /** 996 * The x-coordinate of the coordinate point. 997 * 998 * @type { number } 999 * @readonly 1000 * @syscap SystemCapability.Test.UiTest 1001 * @since 9 1002 */ 1003 /** 1004 * The x-coordinate of the coordinate point. 1005 * 1006 * @type { number } 1007 * @readonly 1008 * @syscap SystemCapability.Test.UiTest 1009 * @crossplatform 1010 * @since 10 1011 */ 1012 /** 1013 * The x-coordinate of the coordinate point. 1014 * 1015 * @type { number } 1016 * @readonly 1017 * @syscap SystemCapability.Test.UiTest 1018 * @crossplatform 1019 * @atomicservice 1020 * @since 11 1021 */ 1022 readonly x: number; 1023 /** 1024 * The y-coordinate of the coordinate point. 1025 * 1026 * @type { number } 1027 * @readonly 1028 * @syscap SystemCapability.Test.UiTest 1029 * @since 9 1030 */ 1031 /** 1032 * The y-coordinate of the coordinate point. 1033 * 1034 * @type { number } 1035 * @readonly 1036 * @syscap SystemCapability.Test.UiTest 1037 * @crossplatform 1038 * @since 10 1039 */ 1040 /** 1041 * The y-coordinate of the coordinate point. 1042 * 1043 * @type { number } 1044 * @readonly 1045 * @syscap SystemCapability.Test.UiTest 1046 * @crossplatform 1047 * @atomicservice 1048 * @since 11 1049 */ 1050 readonly y: number; 1051} 1052 1053/** 1054 * Represents the rectangle area on the device screen. 1055 * 1056 * @typedef Rect 1057 * @syscap SystemCapability.Test.UiTest 1058 * @since 9 1059 */ 1060/** 1061 * Represents the rectangle area on the device screen. 1062 * 1063 * @typedef Rect 1064 * @syscap SystemCapability.Test.UiTest 1065 * @atomicservice 1066 * @since 11 1067 */ 1068/** 1069 * Represents the rectangle area on the device screen. 1070 * 1071 * @typedef Rect 1072 * @syscap SystemCapability.Test.UiTest 1073 * @crossplatform 1074 * @atomicservice 1075 * @since 12 1076 */ 1077declare interface Rect { 1078 /** 1079 * The x-coordinate of the top left corner of the rectangle. 1080 * 1081 * @type { number } 1082 * @readonly 1083 * @syscap SystemCapability.Test.UiTest 1084 * @since 9 1085 */ 1086 /** 1087 * The x-coordinate of the top left corner of the rectangle. 1088 * 1089 * @type { number } 1090 * @readonly 1091 * @syscap SystemCapability.Test.UiTest 1092 * @atomicservice 1093 * @since 11 1094 */ 1095 /** 1096 * The x-coordinate of the top left corner of the rectangle. 1097 * 1098 * @type { number } 1099 * @readonly 1100 * @syscap SystemCapability.Test.UiTest 1101 * @crossplatform 1102 * @atomicservice 1103 * @since 12 1104 */ 1105 readonly left: number; 1106 /** 1107 * The y-coordinate of the top left corner of the rectangle. 1108 * 1109 * @type { number } 1110 * @readonly 1111 * @syscap SystemCapability.Test.UiTest 1112 * @since 9 1113 */ 1114 /** 1115 * The y-coordinate of the top left corner of the rectangle. 1116 * 1117 * @type { number } 1118 * @readonly 1119 * @syscap SystemCapability.Test.UiTest 1120 * @atomicservice 1121 * @since 11 1122 */ 1123 /** 1124 * The y-coordinate of the top left corner of the rectangle. 1125 * 1126 * @type { number } 1127 * @readonly 1128 * @syscap SystemCapability.Test.UiTest 1129 * @crossplatform 1130 * @atomicservice 1131 * @since 12 1132 */ 1133 readonly top: number; 1134 /** 1135 * The x-coordinate at the bottom right corner of the rectangle. 1136 * 1137 * @type { number } 1138 * @readonly 1139 * @syscap SystemCapability.Test.UiTest 1140 * @since 9 1141 */ 1142 /** 1143 * The x-coordinate at the bottom right corner of the rectangle. 1144 * 1145 * @type { number } 1146 * @readonly 1147 * @syscap SystemCapability.Test.UiTest 1148 * @atomicservice 1149 * @since 11 1150 */ 1151 /** 1152 * The x-coordinate at the bottom right corner of the rectangle. 1153 * 1154 * @type { number } 1155 * @readonly 1156 * @syscap SystemCapability.Test.UiTest 1157 * @crossplatform 1158 * @atomicservice 1159 * @since 12 1160 */ 1161 readonly right: number; 1162 /** 1163 * The y-coordinate at the bottom right corner of the rectangle. 1164 * 1165 * @type { number } 1166 * @readonly 1167 * @syscap SystemCapability.Test.UiTest 1168 * @since 9 1169 */ 1170 /** 1171 * The y-coordinate at the bottom right corner of the rectangle. 1172 * 1173 * @type { number } 1174 * @readonly 1175 * @syscap SystemCapability.Test.UiTest 1176 * @atomicservice 1177 * @since 11 1178 */ 1179 /** 1180 * The y-coordinate at the bottom right corner of the rectangle. 1181 * 1182 * @type { number } 1183 * @readonly 1184 * @syscap SystemCapability.Test.UiTest 1185 * @crossplatform 1186 * @atomicservice 1187 * @since 12 1188 */ 1189 readonly bottom: number; 1190} 1191 1192/** 1193 * Represents filer condition to get the window . 1194 * 1195 * @typedef WindowFilter 1196 * @syscap SystemCapability.Test.UiTest 1197 * @since 9 1198 */ 1199/** 1200 * Represents filer condition to get the window . 1201 * 1202 * @typedef WindowFilter 1203 * @syscap SystemCapability.Test.UiTest 1204 * @atomicservice 1205 * @since 11 1206 */ 1207declare interface WindowFilter { 1208 /** 1209 * The package name of the application which the window belongs to. 1210 * 1211 * @type { ?string } 1212 * @syscap SystemCapability.Test.UiTest 1213 * @since 9 1214 */ 1215 /** 1216 * The package name of the application which the window belongs to. 1217 * 1218 * @type { ?string } 1219 * @syscap SystemCapability.Test.UiTest 1220 * @atomicservice 1221 * @since 11 1222 */ 1223 bundleName?: string; 1224 1225 /** 1226 * The title of the window. 1227 * 1228 * @type { ?string } 1229 * @syscap SystemCapability.Test.UiTest 1230 * @since 9 1231 */ 1232 /** 1233 * The title of the window. 1234 * 1235 * @type { ?string } 1236 * @syscap SystemCapability.Test.UiTest 1237 * @atomicservice 1238 * @since 11 1239 */ 1240 title?: string; 1241 1242 /** 1243 * The focal state of the window. 1244 * 1245 * @type { ?boolean } 1246 * @syscap SystemCapability.Test.UiTest 1247 * @since 9 1248 */ 1249 /** 1250 * The focal state of the window. 1251 * 1252 * @type { ?boolean } 1253 * @syscap SystemCapability.Test.UiTest 1254 * @atomicservice 1255 * @since 11 1256 */ 1257 focused?: boolean; 1258 1259 /** 1260 * The active state of the window. 1261 * 1262 * @type { ?boolean } 1263 * @syscap SystemCapability.Test.UiTest 1264 * @since 9 1265 */ 1266 /** 1267 * The active state of the window. 1268 * 1269 * @type { ?boolean } 1270 * @syscap SystemCapability.Test.UiTest 1271 * @since 11 1272 * @deprecated since 11 1273 * @useinstead ohos.UiTest.WindowFilter#active 1274 */ 1275 actived?: boolean; 1276 1277 /** 1278 * The active state of the window. 1279 * 1280 * @type { ?boolean } 1281 * @syscap SystemCapability.Test.UiTest 1282 * @atomicservice 1283 * @since 11 1284 */ 1285 active?: boolean; 1286} 1287 1288/** 1289 * Represents the information of an UI element, can be a component or window. 1290 * 1291 * @typedef UIElementInfo 1292 * @syscap SystemCapability.Test.UiTest 1293 * @since 10 1294 * @test 1295 */ 1296/** 1297 * Represents the information of an UI element, can be a component or window. 1298 * 1299 * @typedef UIElementInfo 1300 * @syscap SystemCapability.Test.UiTest 1301 * @atomicservice 1302 * @since 11 1303 * @test 1304 */ 1305declare interface UIElementInfo { 1306 /** 1307 * The bundle name of the host application. 1308 * @type { string } 1309 * @readonly 1310 * @syscap SystemCapability.Test.UiTest 1311 * @since 10 1312 * @test 1313 */ 1314 /** 1315 * The bundle name of the host application. 1316 * @type { string } 1317 * @readonly 1318 * @syscap SystemCapability.Test.UiTest 1319 * @atomicservice 1320 * @since 11 1321 * @test 1322 */ 1323 readonly bundleName: string; 1324 /** 1325 * The component type, set it as 'window' if it's a window. 1326 * @type { string } 1327 * @readonly 1328 * @syscap SystemCapability.Test.UiTest 1329 * @since 10 1330 * @test 1331 */ 1332 /** 1333 * The component type, set it as 'window' if it's a window. 1334 * @type { string } 1335 * @readonly 1336 * @syscap SystemCapability.Test.UiTest 1337 * @atomicservice 1338 * @since 11 1339 * @test 1340 */ 1341 readonly type: string; 1342 /** 1343 * The text of component, set it as window's title if it's a window. 1344 * @type { string } 1345 * @readonly 1346 * @syscap SystemCapability.Test.UiTest 1347 * @since 10 1348 * @test 1349 */ 1350 /** 1351 * The text of component, set it as window's title if it's a window. 1352 * @type { string } 1353 * @readonly 1354 * @syscap SystemCapability.Test.UiTest 1355 * @atomicservice 1356 * @since 11 1357 * @test 1358 */ 1359 readonly text: string; 1360} 1361 1362/** 1363 * Observer to monitor UI events. 1364 * 1365 * @typedef UIEventObserver 1366 * @syscap SystemCapability.Test.UiTest 1367 * @since 10 1368 * @test 1369 */ 1370/** 1371 * Observer to monitor UI events. 1372 * 1373 * @typedef UIEventObserver 1374 * @syscap SystemCapability.Test.UiTest 1375 * @atomicservice 1376 * @since 11 1377 * @test 1378 */ 1379declare interface UIEventObserver { 1380 /** 1381 * Listen for toast show once 1382 * 1383 * @param { 'toastShow' } type 'toastShow'. 1384 * @param { Callback<UIElementInfo> } callback function, returns the monitored UIElementInfo. 1385 * @throws { BusinessError } 401 - if the input parameters are invalid. 1386 * @syscap SystemCapability.Test.UiTest 1387 * @since 10 1388 * @test 1389 */ 1390 /** 1391 * Listen for toast show once 1392 * 1393 * @param { 'toastShow' } type -'toastShow'. 1394 * @param { Callback<UIElementInfo> } callback - function, returns the monitored UIElementInfo. 1395 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 1396 * @syscap SystemCapability.Test.UiTest 1397 * @atomicservice 1398 * @since 11 1399 * @test 1400 */ 1401 once(type: 'toastShow', callback: Callback<UIElementInfo>): void; 1402 1403 /** 1404 * Listen for dialog show once 1405 * 1406 * @param { 'dialogShow' } type 'dialogShow'. 1407 * @param { Callback<UIElementInfo> } callback function, returns the monitored UIElementInfo. 1408 * @throws { BusinessError } 401 - if the input parameters are invalid. 1409 * @syscap SystemCapability.Test.UiTest 1410 * @since 10 1411 * @test 1412 */ 1413 /** 1414 * Listen for dialog show once 1415 * 1416 * @param { 'dialogShow' } type - 'dialogShow'. 1417 * @param { Callback<UIElementInfo> } callback - function, returns the monitored UIElementInfo. 1418 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 1419 * @syscap SystemCapability.Test.UiTest 1420 * @atomicservice 1421 * @since 11 1422 * @test 1423 */ 1424 once(type: 'dialogShow', callback: Callback<UIElementInfo>): void; 1425} 1426 1427/** 1428 * Enumerates the direction for the UI operation . 1429 * 1430 * @enum { number } 1431 * @syscap SystemCapability.Test.UiTest 1432 * @since 10 1433 */ 1434/** 1435 * Enumerates the direction for the UI operation . 1436 * 1437 * @enum { number } 1438 * @syscap SystemCapability.Test.UiTest 1439 * @atomicservice 1440 * @since 11 1441 */ 1442/** 1443 * Enumerates the direction for the UI operation . 1444 * 1445 * @enum { number } 1446 * @syscap SystemCapability.Test.UiTest 1447 * @crossplatform 1448 * @atomicservice 1449 * @since 12 1450 */ 1451declare enum UiDirection { 1452 /** 1453 * Left. 1454 * 1455 * @syscap SystemCapability.Test.UiTest 1456 * @since 10 1457 * @test 1458 */ 1459 /** 1460 * Left. 1461 * 1462 * @syscap SystemCapability.Test.UiTest 1463 * @atomicservice 1464 * @since 11 1465 * @test 1466 */ 1467 /** 1468 * Left. 1469 * 1470 * @syscap SystemCapability.Test.UiTest 1471 * @crossplatform 1472 * @atomicservice 1473 * @since 12 1474 * @test 1475 */ 1476 LEFT = 0, 1477 /** 1478 * Right. 1479 * 1480 * @syscap SystemCapability.Test.UiTest 1481 * @since 10 1482 * @test 1483 */ 1484 /** 1485 * Right. 1486 * 1487 * @syscap SystemCapability.Test.UiTest 1488 * @atomicservice 1489 * @since 11 1490 * @test 1491 */ 1492 /** 1493 * Right. 1494 * 1495 * @syscap SystemCapability.Test.UiTest 1496 * @crossplatform 1497 * @atomicservice 1498 * @since 12 1499 * @test 1500 */ 1501 RIGHT = 1, 1502 /** 1503 * Up. 1504 * 1505 * @syscap SystemCapability.Test.UiTest 1506 * @since 10 1507 * @test 1508 */ 1509 /** 1510 * Up. 1511 * 1512 * @syscap SystemCapability.Test.UiTest 1513 * @atomicservice 1514 * @since 11 1515 * @test 1516 */ 1517 /** 1518 * Up. 1519 * 1520 * @syscap SystemCapability.Test.UiTest 1521 * @crossplatform 1522 * @atomicservice 1523 * @since 12 1524 * @test 1525 */ 1526 UP = 2, 1527 /** 1528 * Down. 1529 * 1530 * @syscap SystemCapability.Test.UiTest 1531 * @since 10 1532 * @test 1533 */ 1534 /** 1535 * Down. 1536 * 1537 * @syscap SystemCapability.Test.UiTest 1538 * @atomicservice 1539 * @since 11 1540 * @test 1541 */ 1542 /** 1543 * Down. 1544 * 1545 * @syscap SystemCapability.Test.UiTest 1546 * @crossplatform 1547 * @atomicservice 1548 * @since 12 1549 * @test 1550 */ 1551 DOWN = 3 1552} 1553 1554/** 1555 * Enumerates the id of the button on the mouse. 1556 * 1557 * @enum { number } 1558 * @syscap SystemCapability.Test.UiTest 1559 * @since 10 1560 */ 1561/** 1562 * Enumerates the id of the button on the mouse. 1563 * 1564 * @enum { number } 1565 * @syscap SystemCapability.Test.UiTest 1566 * @atomicservice 1567 * @since 11 1568 */ 1569declare enum MouseButton { 1570 /** 1571 * Left button of the mouse. 1572 * 1573 * @syscap SystemCapability.Test.UiTest 1574 * @since 10 1575 * @test 1576 */ 1577 /** 1578 * Left button of the mouse. 1579 * 1580 * @syscap SystemCapability.Test.UiTest 1581 * @atomicservice 1582 * @since 11 1583 * @test 1584 */ 1585 MOUSE_BUTTON_LEFT = 0, 1586 /** 1587 * Right button of the mouse.. 1588 * 1589 * @syscap SystemCapability.Test.UiTest 1590 * @since 10 1591 * @test 1592 */ 1593 /** 1594 * Right button of the mouse.. 1595 * 1596 * @syscap SystemCapability.Test.UiTest 1597 * @atomicservice 1598 * @since 11 1599 * @test 1600 */ 1601 MOUSE_BUTTON_RIGHT = 1, 1602 /** 1603 * MIDDLE button of the mouse. 1604 * 1605 * @syscap SystemCapability.Test.UiTest 1606 * @since 10 1607 * @test 1608 */ 1609 /** 1610 * MIDDLE button of the mouse. 1611 * 1612 * @syscap SystemCapability.Test.UiTest 1613 * @atomicservice 1614 * @since 11 1615 * @test 1616 */ 1617 MOUSE_BUTTON_MIDDLE = 2 1618} 1619 1620/** 1621 * Describes the attribute requirements for the target Components. 1622 * 1623 * @syscap SystemCapability.Test.UiTest 1624 * @since 9 1625 */ 1626/** 1627 * Describes the attribute requirements for the target Components. 1628 * 1629 * @syscap SystemCapability.Test.UiTest 1630 * @atomicservice 1631 * @since 11 1632 */ 1633/** 1634 * Describes the attribute requirements for the target Components. 1635 * 1636 * @syscap SystemCapability.Test.UiTest 1637 * @crossplatform 1638 * @atomicservice 1639 * @since 12 1640 */ 1641declare class On { 1642 /** 1643 * Specifies the text for the target Component. 1644 * 1645 * @param { string } txt The text value. 1646 * @param { MatchPattern } pattern The {@link MatchPattern} of the text value, default to {@link MatchPattern.EQUALS} 1647 * @returns { On } this {@link On} object. 1648 * @throws { BusinessError } 401 - if the input parameters are invalid. 1649 * @syscap SystemCapability.Test.UiTest 1650 * @since 9 1651 * @test 1652 */ 1653 /** 1654 * Specifies the text for the target Component. 1655 * 1656 * @param { string } txt The text value. 1657 * @param { MatchPattern } pattern The {@link MatchPattern} of the text value, default to {@link MatchPattern.EQUALS} 1658 * @returns { On } this {@link On} object. 1659 * @throws { BusinessError } 401 - if the input parameters are invalid. 1660 * @syscap SystemCapability.Test.UiTest 1661 * @crossplatform 1662 * @since 10 1663 * @test 1664 */ 1665 /** 1666 * Specifies the text for the target Component. 1667 * 1668 * @param { string } txt - the text value. 1669 * @param { MatchPattern } [pattern] - the {@link MatchPattern} of the text value,Set it default {@link MatchPattern.EQUALS} if null or undefined. 1670 * @returns { On } this {@link On} object. 1671 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 1672 * @syscap SystemCapability.Test.UiTest 1673 * @crossplatform 1674 * @atomicservice 1675 * @since 11 1676 * @test 1677 */ 1678 text(txt: string, pattern?: MatchPattern): On; 1679 1680 /** 1681 * Specifies the id of the target Component. 1682 * 1683 * @param { string } id The id value. 1684 * @returns { On } this {@link On} object. 1685 * @throws { BusinessError } 401 - if the input parameters are invalid. 1686 * @syscap SystemCapability.Test.UiTest 1687 * @since 9 1688 * @test 1689 */ 1690 /** 1691 * Specifies the id of the target Component. 1692 * 1693 * @param { string } id The id value. 1694 * @returns { On } this {@link On} object. 1695 * @throws { BusinessError } 401 - if the input parameters are invalid. 1696 * @syscap SystemCapability.Test.UiTest 1697 * @crossplatform 1698 * @since 10 1699 * @test 1700 */ 1701 /** 1702 * Specifies the id of the target Component. 1703 * 1704 * @param { string } id - the id value. 1705 * @returns { On } this {@link On} object. 1706 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 1707 * @syscap SystemCapability.Test.UiTest 1708 * @crossplatform 1709 * @atomicservice 1710 * @since 11 1711 * @test 1712 */ 1713 id(id: string): On; 1714 1715 /** 1716 * Specifies the type of the target Component. 1717 * 1718 * @param { string } tp The type value. 1719 * @returns { On } this {@link On} object. 1720 * @throws { BusinessError } 401 - if the input parameters are invalid. 1721 * @syscap SystemCapability.Test.UiTest 1722 * @since 9 1723 * @test 1724 */ 1725 /** 1726 * Specifies the type of the target Component. 1727 * 1728 * @param { string } tp The type value. 1729 * @returns { On } this {@link On} object. 1730 * @throws { BusinessError } 401 - if the input parameters are invalid. 1731 * @syscap SystemCapability.Test.UiTest 1732 * @crossplatform 1733 * @since 10 1734 * @test 1735 */ 1736 /** 1737 * Specifies the type of the target Component. 1738 * 1739 * @param { string } tp - The type value. 1740 * @returns { On } this {@link On} object. 1741 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 1742 * @syscap SystemCapability.Test.UiTest 1743 * @crossplatform 1744 * @atomicservice 1745 * @since 11 1746 * @test 1747 */ 1748 type(tp: string): On; 1749 1750 /** 1751 * Specifies the clickable status of the target Component. 1752 * 1753 * @param { boolean } b The clickable status,default to true. 1754 * @returns { On } this {@link On} object. 1755 * @throws { BusinessError } 401 - if the input parameters are invalid. 1756 * @syscap SystemCapability.Test.UiTest 1757 * @since 9 1758 * @test 1759 */ 1760 /** 1761 * Specifies the clickable status of the target Component. 1762 * 1763 * @param { boolean } b The clickable status,default to true. 1764 * @returns { On } this {@link On} object. 1765 * @throws { BusinessError } 401 - if the input parameters are invalid. 1766 * @syscap SystemCapability.Test.UiTest 1767 * @crossplatform 1768 * @since 10 1769 * @test 1770 */ 1771 /** 1772 * Specifies the clickable status of the target Component. 1773 * 1774 * @param { boolean } [b] - the clickable status.Set it default true if null or undefined. 1775 * @returns { On } this {@link On} object. 1776 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types; 2. Parameter verification failed. 1777 * @syscap SystemCapability.Test.UiTest 1778 * @crossplatform 1779 * @atomicservice 1780 * @since 11 1781 * @test 1782 */ 1783 clickable(b?: boolean): On; 1784 1785 /** 1786 * Specifies the longClickable status of the target Component. 1787 * 1788 * @param { boolean } b The clickable status,default to true. 1789 * @returns { On } this {@link On} object. 1790 * @throws { BusinessError } 401 - if the input parameters are invalid. 1791 * @syscap SystemCapability.Test.UiTest 1792 * @since 9 1793 * @test 1794 */ 1795 /** 1796 * Specifies the longClickable status of the target Component. 1797 * 1798 * @param { boolean } b The clickable status,default to true. 1799 * @returns { On } this {@link On} object. 1800 * @throws { BusinessError } 401 - if the input parameters are invalid. 1801 * @syscap SystemCapability.Test.UiTest 1802 * @crossplatform 1803 * @since 10 1804 * @test 1805 */ 1806 /** 1807 * Specifies the longClickable status of the target Component. 1808 * 1809 * @param { boolean } [b] - the longClickable status.Set it default true if null or undefined. 1810 * @returns { On } this {@link On} object. 1811 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types; 2. Parameter verification failed. 1812 * @syscap SystemCapability.Test.UiTest 1813 * @crossplatform 1814 * @atomicservice 1815 * @since 11 1816 * @test 1817 */ 1818 longClickable(b?: boolean): On; 1819 1820 /** 1821 * Specifies the scrollable status of the target Component. 1822 * 1823 * @param { boolean } b The scrollable status,default to true. 1824 * @returns { On } this {@link On} object. 1825 * @throws { BusinessError } 401 - if the input parameters are invalid. 1826 * @syscap SystemCapability.Test.UiTest 1827 * @since 9 1828 * @test 1829 */ 1830 /** 1831 * Specifies the scrollable status of the target Component. 1832 * 1833 * @param { boolean } b The scrollable status,default to true. 1834 * @returns { On } this {@link On} object. 1835 * @throws { BusinessError } 401 - if the input parameters are invalid. 1836 * @syscap SystemCapability.Test.UiTest 1837 * @crossplatform 1838 * @since 10 1839 * @test 1840 */ 1841 /** 1842 * Specifies the scrollable status of the target Component. 1843 * 1844 * @param { boolean } [b] - the scrollable status.Set it default true if null or undefined. 1845 * @returns { On } this {@link On} object. 1846 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types; 2. Parameter verification failed. 1847 * @syscap SystemCapability.Test.UiTest 1848 * @crossplatform 1849 * @atomicservice 1850 * @since 11 1851 * @test 1852 */ 1853 scrollable(b?: boolean): On; 1854 1855 /** 1856 * Specifies the enabled status of the target Component. 1857 * 1858 * @param { boolean } b The enabled status,default to true. 1859 * @returns { On } this {@link On} object. 1860 * @throws { BusinessError } 401 - if the input parameters are invalid. 1861 * @syscap SystemCapability.Test.UiTest 1862 * @since 9 1863 * @test 1864 */ 1865 /** 1866 * Specifies the enabled status of the target Component. 1867 * 1868 * @param { boolean } b The enabled status,default to true. 1869 * @returns { On } this {@link On} object. 1870 * @throws { BusinessError } 401 - if the input parameters are invalid. 1871 * @syscap SystemCapability.Test.UiTest 1872 * @crossplatform 1873 * @since 10 1874 * @test 1875 */ 1876 /** 1877 * Specifies the enabled status of the target Component. 1878 * 1879 * @param { boolean } [b] - the enabled status.Set it default true if null or undefined. 1880 * @returns { On } this {@link On} object. 1881 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types; 2. Parameter verification failed. 1882 * @syscap SystemCapability.Test.UiTest 1883 * @crossplatform 1884 * @atomicservice 1885 * @since 11 1886 * @test 1887 */ 1888 enabled(b?: boolean): On; 1889 1890 /** 1891 * Specifies the focused status of the target Component. 1892 * 1893 * @param { boolean } b The focused status,default to true. 1894 * @returns { On } this {@link On} object. 1895 * @throws { BusinessError } 401 - if the input parameters are invalid. 1896 * @syscap SystemCapability.Test.UiTest 1897 * @since 9 1898 * @test 1899 */ 1900 /** 1901 * Specifies the focused status of the target Component. 1902 * 1903 * @param { boolean } b The focused status,default to true. 1904 * @returns { On } this {@link On} object. 1905 * @throws { BusinessError } 401 - if the input parameters are invalid. 1906 * @syscap SystemCapability.Test.UiTest 1907 * @crossplatform 1908 * @since 10 1909 * @test 1910 */ 1911 /** 1912 * Specifies the focused status of the target Component. 1913 * 1914 * @param { boolean } [b] - the focused status.Set it default true if null or undefined. 1915 * @returns { On } this {@link On} object. 1916 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types; 2. Parameter verification failed. 1917 * @syscap SystemCapability.Test.UiTest 1918 * @crossplatform 1919 * @atomicservice 1920 * @since 11 1921 * @test 1922 */ 1923 focused(b?: boolean): On; 1924 1925 /** 1926 * Specifies the selected status of the target Component. 1927 * 1928 * @param { boolean } b The selected status,default to true. 1929 * @returns { On } this {@link On} object. 1930 * @throws { BusinessError } 401 - if the input parameters are invalid. 1931 * @syscap SystemCapability.Test.UiTest 1932 * @since 9 1933 * @test 1934 */ 1935 /** 1936 * Specifies the selected status of the target Component. 1937 * 1938 * @param { boolean } b The selected status,default to true. 1939 * @returns { On } this {@link On} object. 1940 * @throws { BusinessError } 401 - if the input parameters are invalid. 1941 * @syscap SystemCapability.Test.UiTest 1942 * @crossplatform 1943 * @since 10 1944 * @test 1945 */ 1946 /** 1947 * Specifies the selected status of the target Component. 1948 * 1949 * @param { boolean } [b] the - selected status.Set it default true if null or undefined. 1950 * @returns { On } this {@link On} object. 1951 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types; 2. Parameter verification failed. 1952 * @syscap SystemCapability.Test.UiTest 1953 * @crossplatform 1954 * @atomicservice 1955 * @since 11 1956 * @test 1957 */ 1958 selected(b?: boolean): On; 1959 1960 /** 1961 * Specifies the checked status of the target Component. 1962 * 1963 * @param { boolean } b The checked status,default to false. 1964 * @returns { On } this {@link On} object. 1965 * @throws { BusinessError } 401 - if the input parameters are invalid. 1966 * @syscap SystemCapability.Test.UiTest 1967 * @since 9 1968 * @test 1969 */ 1970 /** 1971 * Specifies the checked status of the target Component. 1972 * 1973 * @param { boolean } b The checked status,default to false. 1974 * @returns { On } this {@link On} object. 1975 * @throws { BusinessError } 401 - if the input parameters are invalid. 1976 * @syscap SystemCapability.Test.UiTest 1977 * @crossplatform 1978 * @since 10 1979 * @test 1980 */ 1981 /** 1982 * Specifies the checked status of the target Component. 1983 * 1984 * @param { boolean } [b] - the checked status.Set it default false if null or undefined. 1985 * @returns { On } this {@link On} object. 1986 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types; 2. Parameter verification failed. 1987 * @syscap SystemCapability.Test.UiTest 1988 * @crossplatform 1989 * @atomicservice 1990 * @since 11 1991 * @test 1992 */ 1993 checked(b?: boolean): On; 1994 1995 /** 1996 * Specifies the checkable status of the target Component. 1997 * 1998 * @param { boolean } b The checkable status,default to false. 1999 * @returns { On } this {@link On} object. 2000 * @throws { BusinessError } 401 - if the input parameters are invalid. 2001 * @syscap SystemCapability.Test.UiTest 2002 * @since 9 2003 * @test 2004 */ 2005 /** 2006 * Specifies the checkable status of the target Component. 2007 * 2008 * @param { boolean } b The checkable status,default to false. 2009 * @returns { On } this {@link On} object. 2010 * @throws { BusinessError } 401 - if the input parameters are invalid. 2011 * @syscap SystemCapability.Test.UiTest 2012 * @crossplatform 2013 * @since 10 2014 * @test 2015 */ 2016 /** 2017 * Specifies the checkable status of the target Component. 2018 * 2019 * @param { boolean } [b] - the checkable status.Set it default false if null or undefined. 2020 * @returns { On } this {@link On} object. 2021 * @throws { BusinessError } 401 - Parameter error. 1. Incorrect parameter types; 2. Parameter verification failed. 2022 * @syscap SystemCapability.Test.UiTest 2023 * @crossplatform 2024 * @atomicservice 2025 * @since 11 2026 * @test 2027 */ 2028 checkable(b?: boolean): On; 2029 2030 /** 2031 * Requires that the target Component which is before another Component that specified by the given {@link On} 2032 * object,used to locate Component relatively. 2033 * 2034 * @param { On } on Describes the attribute requirements of Component which the target one is in front of. 2035 * @returns { On } this {@link On} object. 2036 * @throws { BusinessError } 401 - if the input parameters are invalid. 2037 * @syscap SystemCapability.Test.UiTest 2038 * @since 9 2039 * @test 2040 */ 2041 /** 2042 * Requires that the target Component which is before another Component that specified by the given {@link On} 2043 * object,used to locate Component relatively. 2044 * 2045 * @param { On } on - describes the attribute requirements of Component which the target one is in front of. 2046 * @returns { On } this {@link On} object. 2047 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 2048 * @syscap SystemCapability.Test.UiTest 2049 * @crossplatform 2050 * @atomicservice 2051 * @since 11 2052 * @test 2053 */ 2054 isBefore(on: On): On; 2055 2056 /** 2057 * Requires that the target Component which is after another Component that specified by the given {@link On} 2058 * object,used to locate Component relatively. 2059 * 2060 * @param { On } on Describes the attribute requirements of Component which the target one is in back of. 2061 * @returns { On } this {@link On} object. 2062 * @throws { BusinessError } 401 - if the input parameters are invalid. 2063 * @syscap SystemCapability.Test.UiTest 2064 * @since 9 2065 * @test 2066 */ 2067 /** 2068 * Requires that the target Component which is after another Component that specified by the given {@link On} 2069 * object,used to locate Component relatively. 2070 * 2071 * @param { On } on - describes the attribute requirements of Component which the target one is in back of. 2072 * @returns { On } this {@link On} object. 2073 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 2074 * @syscap SystemCapability.Test.UiTest 2075 * @crossplatform 2076 * @atomicservice 2077 * @since 11 2078 * @test 2079 */ 2080 isAfter(on: On): On; 2081 2082 /** 2083 * Requires that the target Component which is inside of another Component that specified by the given {@link On} 2084 * object,used to locate Component relatively. 2085 * 2086 * @param { On } on Describes the attribute requirements of Component which the target one is inside of. 2087 * @returns { On } this {@link On} object. 2088 * @throws { BusinessError } 401 - if the input parameters are invalid. 2089 * @syscap SystemCapability.Test.UiTest 2090 * @since 10 2091 * @test 2092 */ 2093 /** 2094 * Requires that the target Component which is inside of another Component that specified by the given {@link On} 2095 * object,used to locate Component relatively. 2096 * 2097 * @param { On } on - describes the attribute requirements of Component which the target one is inside of. 2098 * @returns { On } this {@link On} object. 2099 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 2100 * @syscap SystemCapability.Test.UiTest 2101 * @crossplatform 2102 * @atomicservice 2103 * @since 11 2104 * @test 2105 */ 2106 within(on: On): On; 2107 2108 /** 2109 * Specifies the bundleName of the application which the window that the target Component is located belongs. 2110 * 2111 * @param { string } bundleName The bundleName of the specified window. 2112 * @returns { On } this {@link On} object. 2113 * @throws { BusinessError } 401 - if the input parameters are invalid. 2114 * @syscap SystemCapability.Test.UiTest 2115 * @since 10 2116 * @test 2117 */ 2118 /** 2119 * Specifies the bundleName of the application which the window that the target Component is located belongs. 2120 * 2121 * @param { string } bundleName - the bundleName of the specified window. 2122 * @returns { On } this {@link On} object. 2123 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 2124 * @syscap SystemCapability.Test.UiTest 2125 * @atomicservice 2126 * @since 11 2127 * @test 2128 */ 2129 inWindow(bundleName: string): On; 2130 2131 /** 2132 * Specifies the description for the target Component. 2133 * 2134 * @param { string } val - the description value. 2135 * @param { MatchPattern } [pattern] - the {@link MatchPattern} of description value,set it default {@link MatchPattern.EQUALS} if null or undefined. 2136 * @returns { On } this {@link On} object. 2137 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 2138 * @syscap SystemCapability.Test.UiTest 2139 * @atomicservice 2140 * @since 11 2141 * @test 2142 */ 2143 description(val: string, pattern?: MatchPattern): On; 2144} 2145 2146/** 2147 * Represents an Component of the ohos application,user can perform operations or query attributes on it. 2148 * 2149 * @syscap SystemCapability.Test.UiTest 2150 * @since 9 2151 * @test 2152 */ 2153/** 2154 * Represents an Component of the ohos application,user can perform operations or query attributes on it. 2155 * 2156 * @syscap SystemCapability.Test.UiTest 2157 * @atomicservice 2158 * @since 11 2159 * @test 2160 */ 2161/** 2162 * Represents an Component of the ohos application,user can perform operations or query attributes on it. 2163 * 2164 * @syscap SystemCapability.Test.UiTest 2165 * @crossplatform 2166 * @atomicservice 2167 * @since 12 2168 * @test 2169 */ 2170declare class Component { 2171 /** 2172 * Click this {@link Component}. 2173 * 2174 * @returns { Promise<void> } 2175 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2176 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2177 * @syscap SystemCapability.Test.UiTest 2178 * @since 9 2179 * @test 2180 */ 2181 /** 2182 * Click this {@link Component}. 2183 * 2184 * @returns { Promise<void> } 2185 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2186 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2187 * @syscap SystemCapability.Test.UiTest 2188 * @crossplatform 2189 * @since 10 2190 * @test 2191 */ 2192 /** 2193 * Click this {@link Component}. 2194 * 2195 * @returns { Promise<void> } 2196 * @throws { BusinessError } 17000002 - The async function is not called with await. 2197 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 2198 * @syscap SystemCapability.Test.UiTest 2199 * @crossplatform 2200 * @atomicservice 2201 * @since 11 2202 * @test 2203 */ 2204 click(): Promise<void>; 2205 2206 /** 2207 * Double click this {@link Component}. 2208 * 2209 * @returns { Promise<void> } 2210 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2211 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2212 * @syscap SystemCapability.Test.UiTest 2213 * @since 9 2214 * @test 2215 */ 2216 /** 2217 * Double click this {@link Component}. 2218 * 2219 * @returns { Promise<void> } 2220 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2221 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2222 * @syscap SystemCapability.Test.UiTest 2223 * @crossplatform 2224 * @since 10 2225 * @test 2226 */ 2227 /** 2228 * Double click this {@link Component}. 2229 * 2230 * @returns { Promise<void> } 2231 * @throws { BusinessError } 17000002 - The async function is not called with await. 2232 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 2233 * @syscap SystemCapability.Test.UiTest 2234 * @crossplatform 2235 * @atomicservice 2236 * @since 11 2237 * @test 2238 */ 2239 doubleClick(): Promise<void>; 2240 2241 /** 2242 * Long click this {@link Component}. 2243 * 2244 * @returns { Promise<void> } 2245 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2246 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2247 * @syscap SystemCapability.Test.UiTest 2248 * @since 9 2249 * @test 2250 */ 2251 /** 2252 * Long click this {@link Component}. 2253 * 2254 * @returns { Promise<void> } 2255 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2256 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2257 * @syscap SystemCapability.Test.UiTest 2258 * @crossplatform 2259 * @since 10 2260 * @test 2261 */ 2262 /** 2263 * Long click this {@link Component}. 2264 * 2265 * @returns { Promise<void> } 2266 * @throws { BusinessError } 17000002 - The async function is not called with await. 2267 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 2268 * @syscap SystemCapability.Test.UiTest 2269 * @crossplatform 2270 * @atomicservice 2271 * @since 11 2272 * @test 2273 */ 2274 longClick(): Promise<void>; 2275 2276 /** 2277 * Get the id attribute value. 2278 * 2279 * @returns { Promise<string> } the id value. 2280 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2281 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2282 * @syscap SystemCapability.Test.UiTest 2283 * @since 9 2284 * @test 2285 */ 2286 /** 2287 * Get the id attribute value. 2288 * 2289 * @returns { Promise<string> } the id value. 2290 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2291 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2292 * @syscap SystemCapability.Test.UiTest 2293 * @crossplatform 2294 * @since 10 2295 * @test 2296 */ 2297 /** 2298 * Get the id attribute value. 2299 * 2300 * @returns { Promise<string> } the id value. 2301 * @throws { BusinessError } 17000002 - The async function is not called with await. 2302 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 2303 * @syscap SystemCapability.Test.UiTest 2304 * @crossplatform 2305 * @atomicservice 2306 * @since 11 2307 * @test 2308 */ 2309 getId(): Promise<string>; 2310 2311 /** 2312 * Get the text attribute value. 2313 * 2314 * @returns { Promise<string> } the text value. 2315 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2316 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2317 * @syscap SystemCapability.Test.UiTest 2318 * @since 9 2319 * @test 2320 */ 2321 /** 2322 * Get the text attribute value. 2323 * 2324 * @returns { Promise<string> } the text value. 2325 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2326 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2327 * @syscap SystemCapability.Test.UiTest 2328 * @crossplatform 2329 * @since 10 2330 * @test 2331 */ 2332 /** 2333 * Get the text attribute value. 2334 * 2335 * @returns { Promise<string> } the text value. 2336 * @throws { BusinessError } 17000002 - The async function is not called with await. 2337 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 2338 * @syscap SystemCapability.Test.UiTest 2339 * @crossplatform 2340 * @atomicservice 2341 * @since 11 2342 * @test 2343 */ 2344 getText(): Promise<string>; 2345 2346 /** 2347 * Get the type name. 2348 * 2349 * @returns { Promise<string> } the type name. 2350 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2351 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2352 * @syscap SystemCapability.Test.UiTest 2353 * @since 9 2354 * @test 2355 */ 2356 /** 2357 * Get the type name. 2358 * 2359 * @returns { Promise<string> } the type name. 2360 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2361 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2362 * @syscap SystemCapability.Test.UiTest 2363 * @crossplatform 2364 * @since 10 2365 * @test 2366 */ 2367 /** 2368 * Get the type name. 2369 * 2370 * @returns { Promise<string> } the type name. 2371 * @throws { BusinessError } 17000002 - The async function is not called with await. 2372 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 2373 * @syscap SystemCapability.Test.UiTest 2374 * @crossplatform 2375 * @atomicservice 2376 * @since 11 2377 * @test 2378 */ 2379 getType(): Promise<string>; 2380 2381 /** 2382 * Get the clickable status of this {@link Component}. 2383 * 2384 * @returns { Promise<boolean> } the clickable status. 2385 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2386 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2387 * @syscap SystemCapability.Test.UiTest 2388 * @since 9 2389 * @test 2390 */ 2391 /** 2392 * Get the clickable status of this {@link Component}. 2393 * 2394 * @returns { Promise<boolean> } the clickable status. 2395 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2396 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2397 * @syscap SystemCapability.Test.UiTest 2398 * @crossplatform 2399 * @since 10 2400 * @test 2401 */ 2402 /** 2403 * Get the clickable status of this {@link Component}. 2404 * 2405 * @returns { Promise<boolean> } the clickable status. 2406 * @throws { BusinessError } 17000002 - The async function is not called with await. 2407 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 2408 * @syscap SystemCapability.Test.UiTest 2409 * @crossplatform 2410 * @atomicservice 2411 * @since 11 2412 * @test 2413 */ 2414 isClickable(): Promise<boolean>; 2415 2416 /** 2417 * Get the longClickable status of this {@link Component}. 2418 * 2419 * @returns { Promise<boolean> } the longClickable status. 2420 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2421 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2422 * @syscap SystemCapability.Test.UiTest 2423 * @since 9 2424 * @test 2425 */ 2426 /** 2427 * Get the longClickable status of this {@link Component}. 2428 * 2429 * @returns { Promise<boolean> } the longClickable status. 2430 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2431 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2432 * @syscap SystemCapability.Test.UiTest 2433 * @crossplatform 2434 * @since 10 2435 * @test 2436 */ 2437 /** 2438 * Get the clickable status of this {@link Component}. 2439 * 2440 * @returns { Promise<boolean> } the clickable status. 2441 * @throws { BusinessError } 17000002 - The async function is not called with await. 2442 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 2443 * @syscap SystemCapability.Test.UiTest 2444 * @crossplatform 2445 * @atomicservice 2446 * @since 11 2447 * @test 2448 */ 2449 isLongClickable(): Promise<boolean>; 2450 2451 /** 2452 * Get the scrollable status of this {@link Component}. 2453 * 2454 * @returns { Promise<boolean> } the scrollable status. 2455 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2456 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2457 * @syscap SystemCapability.Test.UiTest 2458 * @since 9 2459 * @test 2460 */ 2461 /** 2462 * Get the scrollable status of this {@link Component}. 2463 * 2464 * @returns { Promise<boolean> } the scrollable status. 2465 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2466 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2467 * @syscap SystemCapability.Test.UiTest 2468 * @crossplatform 2469 * @since 10 2470 * @test 2471 */ 2472 /** 2473 * Get the scrollable status of this {@link Component}. 2474 * 2475 * @returns { Promise<boolean> } the scrollable status. 2476 * @throws { BusinessError } 17000002 - The async function is not called with await. 2477 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 2478 * @syscap SystemCapability.Test.UiTest 2479 * @crossplatform 2480 * @atomicservice 2481 * @since 11 2482 * @test 2483 */ 2484 isScrollable(): Promise<boolean>; 2485 2486 /** 2487 * Get the enabled status of this {@link Component}. 2488 * 2489 * @returns { Promise<boolean> } the enabled status. 2490 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2491 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2492 * @syscap SystemCapability.Test.UiTest 2493 * @since 9 2494 * @test 2495 */ 2496 /** 2497 * Get the enabled status of this {@link Component}. 2498 * 2499 * @returns { Promise<boolean> } the enabled status. 2500 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2501 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2502 * @syscap SystemCapability.Test.UiTest 2503 * @crossplatform 2504 * @since 10 2505 * @test 2506 */ 2507 /** 2508 * Get the enabled status of this {@link Component}. 2509 * 2510 * @returns { Promise<boolean> } the enabled status. 2511 * @throws { BusinessError } 17000002 - The async function is not called with await. 2512 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 2513 * @syscap SystemCapability.Test.UiTest 2514 * @crossplatform 2515 * @atomicservice 2516 * @since 11 2517 * @test 2518 */ 2519 isEnabled(): Promise<boolean>; 2520 2521 /** 2522 * Get the focused status of this {@link Component}. 2523 * 2524 * @returns { Promise<boolean> } the focused status. 2525 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2526 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2527 * @syscap SystemCapability.Test.UiTest 2528 * @since 9 2529 * @test 2530 */ 2531 /** 2532 * Get the focused status of this {@link Component}. 2533 * 2534 * @returns { Promise<boolean> } the focused status. 2535 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2536 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2537 * @syscap SystemCapability.Test.UiTest 2538 * @crossplatform 2539 * @since 10 2540 * @test 2541 */ 2542 /** 2543 * Get the focused status of this {@link Component}. 2544 * 2545 * @returns { Promise<boolean> } the focused status. 2546 * @throws { BusinessError } 17000002 - The async function is not called with await. 2547 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 2548 * @syscap SystemCapability.Test.UiTest 2549 * @crossplatform 2550 * @atomicservice 2551 * @since 11 2552 * @test 2553 */ 2554 isFocused(): Promise<boolean>; 2555 2556 /** 2557 * Get the selected status of this {@link Component}. 2558 * 2559 * @returns { Promise<boolean> } the selected status. 2560 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2561 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2562 * @syscap SystemCapability.Test.UiTest 2563 * @since 9 2564 * @test 2565 */ 2566 /** 2567 * Get the selected status of this {@link Component}. 2568 * 2569 * @returns { Promise<boolean> } the selected status. 2570 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2571 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2572 * @syscap SystemCapability.Test.UiTest 2573 * @crossplatform 2574 * @since 10 2575 * @test 2576 */ 2577 /** 2578 * Get the selected status of this {@link Component}. 2579 * 2580 * @returns { Promise<boolean> } the selected status. 2581 * @throws { BusinessError } 17000002 - The async function is not called with await. 2582 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 2583 * @syscap SystemCapability.Test.UiTest 2584 * @crossplatform 2585 * @atomicservice 2586 * @since 11 2587 * @test 2588 */ 2589 isSelected(): Promise<boolean>; 2590 2591 /** 2592 * Get the checked status of this {@link Component}. 2593 * 2594 * @returns { Promise<boolean> } the checked status. 2595 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2596 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2597 * @syscap SystemCapability.Test.UiTest 2598 * @since 9 2599 * @test 2600 */ 2601 /** 2602 * Get the checked status of this {@link Component}. 2603 * 2604 * @returns { Promise<boolean> } the checked status. 2605 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2606 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2607 * @syscap SystemCapability.Test.UiTest 2608 * @crossplatform 2609 * @since 10 2610 * @test 2611 */ 2612 /** 2613 * Get the checked status of this {@link Component}. 2614 * 2615 * @returns { Promise<boolean> } the checked status. 2616 * @throws { BusinessError } 17000002 - The async function is not called with await. 2617 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 2618 * @syscap SystemCapability.Test.UiTest 2619 * @crossplatform 2620 * @atomicservice 2621 * @since 11 2622 * @test 2623 */ 2624 isChecked(): Promise<boolean>; 2625 2626 /** 2627 * Get the checkable status of this {@link Component}. 2628 * 2629 * @returns { Promise<boolean> } the checkable status. 2630 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2631 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2632 * @syscap SystemCapability.Test.UiTest 2633 * @since 9 2634 * @test 2635 */ 2636 /** 2637 * Get the checkable status of this {@link Component}. 2638 * 2639 * @returns { Promise<boolean> } the checkable status. 2640 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2641 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2642 * @syscap SystemCapability.Test.UiTest 2643 * @crossplatform 2644 * @since 10 2645 * @test 2646 */ 2647 /** 2648 * Get the checkable status of this {@link Component}. 2649 * 2650 * @returns { Promise<boolean> } the checkable status. 2651 * @throws { BusinessError } 17000002 - The async function is not called with await. 2652 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 2653 * @syscap SystemCapability.Test.UiTest 2654 * @crossplatform 2655 * @atomicservice 2656 * @since 11 2657 * @test 2658 */ 2659 isCheckable(): Promise<boolean>; 2660 2661 /** 2662 * Inject text to this {@link Component},applicable to TextInput. 2663 * 2664 * @param { string } text The text to inject. 2665 * @returns { Promise<void> } 2666 * @throws { BusinessError } 401 - if the input parameters are invalid. 2667 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2668 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2669 * @syscap SystemCapability.Test.UiTest 2670 * @since 9 2671 * @test 2672 */ 2673 /** 2674 * Inject text to this {@link Component},applicable to TextInput. 2675 * 2676 * @param { string } text The text to inject. 2677 * @returns { Promise<void> } 2678 * @throws { BusinessError } 401 - if the input parameters are invalid. 2679 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2680 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2681 * @syscap SystemCapability.Test.UiTest 2682 * @crossplatform 2683 * @since 10 2684 * @test 2685 */ 2686 /** 2687 * Inject text to this {@link Component},applicable to TextInput. 2688 * 2689 * @param { string } text - the text to inject. 2690 * @returns { Promise<void> } 2691 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 2692 * @throws { BusinessError } 17000002 - The async function is not called with await. 2693 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 2694 * @syscap SystemCapability.Test.UiTest 2695 * @crossplatform 2696 * @atomicservice 2697 * @since 11 2698 * @test 2699 */ 2700 inputText(text: string): Promise<void>; 2701 2702 /** 2703 * Clear text of this {@link Component},applicable to TextInput. 2704 * 2705 * @returns { Promise<void> } 2706 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2707 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2708 * @syscap SystemCapability.Test.UiTest 2709 * @since 9 2710 * @test 2711 */ 2712 /** 2713 * Clear text of this {@link Component},applicable to TextInput. 2714 * 2715 * @returns { Promise<void> } 2716 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2717 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2718 * @syscap SystemCapability.Test.UiTest 2719 * @crossplatform 2720 * @since 10 2721 * @test 2722 */ 2723 /** 2724 * Clear text of this {@link Component},applicable to TextInput. 2725 * 2726 * @returns { Promise<void> } 2727 * @throws { BusinessError } 17000002 - The async function is not called with await. 2728 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 2729 * @syscap SystemCapability.Test.UiTest 2730 * @crossplatform 2731 * @atomicservice 2732 * @since 11 2733 * @test 2734 */ 2735 clearText(): Promise<void>; 2736 2737 /** 2738 * Scroll on this {@link Component} to the top,applicable to scrollable one. 2739 * 2740 * @param { number } speed The speed of swipe (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range. 2741 * @returns { Promise<void> } 2742 * @throws { BusinessError } 401 - if the input parameters are invalid. 2743 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2744 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2745 * @syscap SystemCapability.Test.UiTest 2746 * @since 9 2747 * @test 2748 */ 2749 /** 2750 * Scroll on this {@link Component} to the top,applicable to scrollable one. 2751 * 2752 * @param { number } speed The speed of swipe (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range. 2753 * @returns { Promise<void> } 2754 * @throws { BusinessError } 401 - if the input parameters are invalid. 2755 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2756 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2757 * @syscap SystemCapability.Test.UiTest 2758 * @crossplatform 2759 * @since 10 2760 * @test 2761 */ 2762 /** 2763 * Scroll on this {@link Component} to the top,applicable to scrollable one. 2764 * 2765 * @param { number } [speed] - the speed of swipe(pixels per second),ranges from 200 to 40000.Set it default 600 if out of range or null or undefined. 2766 * @returns { Promise<void> } 2767 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types; 2. Parameter verification failed. 2768 * @throws { BusinessError } 17000002 - The async function is not called with await. 2769 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 2770 * @syscap SystemCapability.Test.UiTest 2771 * @crossplatform 2772 * @atomicservice 2773 * @since 11 2774 * @test 2775 */ 2776 scrollToTop(speed?: number): Promise<void>; 2777 2778 /** 2779 * Scroll on this {@link Component} to the bottom,applicable to scrollable one. 2780 * 2781 * @param { number } speed The speed of swipe (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range. 2782 * @returns { Promise<void> } 2783 * @throws { BusinessError } 401 - if the input parameters are invalid. 2784 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2785 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2786 * @syscap SystemCapability.Test.UiTest 2787 * @since 9 2788 * @test 2789 */ 2790 /** 2791 * Scroll on this {@link Component} to the bottom,applicable to scrollable one. 2792 * 2793 * @param { number } speed The speed of swipe (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range. 2794 * @returns { Promise<void> } 2795 * @throws { BusinessError } 401 - if the input parameters are invalid. 2796 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2797 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2798 * @syscap SystemCapability.Test.UiTest 2799 * @crossplatform 2800 * @since 10 2801 * @test 2802 */ 2803 /** 2804 * Scroll on this {@link Component} to the bottom,applicable to scrollable one. 2805 * 2806 * @param { number } [speed] - the speed of swipe(pixels per second),ranges from 200 to 40000. Set it default 600 if out of range or null or undefined. 2807 * @returns { Promise<void> } 2808 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types; 2. Parameter verification failed. 2809 * @throws { BusinessError } 17000002 - The async function is not called with await. 2810 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 2811 * @syscap SystemCapability.Test.UiTest 2812 * @crossplatform 2813 * @atomicservice 2814 * @since 11 2815 * @test 2816 */ 2817 scrollToBottom(speed?: number): Promise<void>; 2818 2819 /** 2820 * Scroll on this {@link Component}to find matched {@link Component},applicable to scrollable one. 2821 * 2822 * @param { On } on The attribute requirements of the target {@link Component}. 2823 * @returns { Promise<Component> } the found result,or undefined if not found. 2824 * @throws { BusinessError } 401 - if the input parameters are invalid. 2825 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2826 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2827 * @syscap SystemCapability.Test.UiTest 2828 * @since 9 2829 * @test 2830 */ 2831 /** 2832 * Scroll on this {@link Component}to find matched {@link Component},applicable to scrollable one. 2833 * 2834 * @param { On } on The attribute requirements of the target {@link Component}. 2835 * @returns { Promise<Component> } the found result,or undefined if not found. 2836 * @throws { BusinessError } 401 - if the input parameters are invalid. 2837 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2838 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2839 * @syscap SystemCapability.Test.UiTest 2840 * @crossplatform 2841 * @since 10 2842 * @test 2843 */ 2844 /** 2845 * Scroll on this {@link Component}to find matched {@link Component},applicable to scrollable one. 2846 * 2847 * @param { On } on - the attribute requirements of the target {@link Component}. 2848 * @returns { Promise<Component> } the found result,or undefined if not found. 2849 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 2850 * @throws { BusinessError } 17000002 - The async function is not called with await. 2851 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 2852 * @syscap SystemCapability.Test.UiTest 2853 * @crossplatform 2854 * @atomicservice 2855 * @since 11 2856 * @test 2857 */ 2858 scrollSearch(on: On): Promise<Component>; 2859 2860 /** 2861 * Get the bounds rect of this {@link Component}. 2862 * 2863 * @returns { Promise<Rect> } the bounds rect object. 2864 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2865 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2866 * @syscap SystemCapability.Test.UiTest 2867 * @since 9 2868 * @test 2869 */ 2870 /** 2871 * Get the bounds rect of this {@link Component}. 2872 * 2873 * @returns { Promise<Rect> } the bounds rect object. 2874 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2875 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2876 * @syscap SystemCapability.Test.UiTest 2877 * @atomicservice 2878 * @since 11 2879 * @test 2880 */ 2881 /** 2882 * Get the bounds rect of this {@link Component}. 2883 * 2884 * @returns { Promise<Rect> } the bounds rect object. 2885 * @throws { BusinessError } 17000002 - The async function is not called with await. 2886 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 2887 * @syscap SystemCapability.Test.UiTest 2888 * @crossplatform 2889 * @atomicservice 2890 * @since 12 2891 * @test 2892 */ 2893 getBounds(): Promise<Rect>; 2894 2895 /** 2896 * Get the boundsCenter of this {@link Component}. 2897 * 2898 * @returns { Promise<Point> } the boundsCenter object. 2899 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2900 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2901 * @syscap SystemCapability.Test.UiTest 2902 * @since 9 2903 * @test 2904 */ 2905 /** 2906 * Get the boundsCenter of this {@link Component}. 2907 * 2908 * @returns { Promise<Point> } the boundsCenter object. 2909 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2910 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2911 * @syscap SystemCapability.Test.UiTest 2912 * @crossplatform 2913 * @since 10 2914 * @test 2915 */ 2916 /** 2917 * Get the boundsCenter of this {@link Component}. 2918 * 2919 * @returns { Promise<Point> } the boundsCenter object. 2920 * @throws { BusinessError } 17000002 - The async function is not called with await. 2921 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 2922 * @syscap SystemCapability.Test.UiTest 2923 * @crossplatform 2924 * @atomicservice 2925 * @since 11 2926 * @test 2927 */ 2928 getBoundsCenter(): Promise<Point>; 2929 2930 /** 2931 * Drag this {@link Component} to the bounds rect of target Component. 2932 * 2933 * @param { Component } target The target {@link Component}. 2934 * @returns { Promise<void> } 2935 * @throws { BusinessError } 401 - if the input parameters are invalid. 2936 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2937 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2938 * @syscap SystemCapability.Test.UiTest 2939 * @since 9 2940 * @test 2941 */ 2942 /** 2943 * Drag this {@link Component} to the bounds rect of target Component. 2944 * 2945 * @param { Component } target - the target {@link Component}. 2946 * @returns { Promise<void> } 2947 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 2948 * @throws { BusinessError } 17000002 - The async function is not called with await. 2949 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 2950 * @syscap SystemCapability.Test.UiTest 2951 * @atomicservice 2952 * @since 11 2953 * @test 2954 */ 2955 dragTo(target: Component): Promise<void>; 2956 2957 /** 2958 * Pinch enlarge this {@link Component} to the target scale. 2959 * 2960 * @param { number } scale The scale of the pinch enlarge this {@link Component}'s size. 2961 * @returns { Promise<void> } 2962 * @throws { BusinessError } 401 - if the input parameters are invalid. 2963 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2964 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2965 * @syscap SystemCapability.Test.UiTest 2966 * @since 9 2967 * @test 2968 */ 2969 /** 2970 * Pinch enlarge this {@link Component} to the target scale. 2971 * 2972 * @param { number } scale - the scale of the pinch enlarge this {@link Component}'s size, ranges greater than 1. 2973 * @returns { Promise<void> } 2974 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 2975 * @throws { BusinessError } 17000002 - The async function is not called with await. 2976 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 2977 * @syscap SystemCapability.Test.UiTest 2978 * @crossplatform 2979 * @atomicservice 2980 * @since 11 2981 * @test 2982 */ 2983 pinchOut(scale: number): Promise<void>; 2984 2985 /** 2986 * Pinch shrink this {@link Component} to the target scale. 2987 * 2988 * @param { number } scale The scale of the pinch shrink this {@link Component}'s size. 2989 * @returns { Promise<void> } 2990 * @throws { BusinessError } 401 - if the input parameters are invalid. 2991 * @throws { BusinessError } 17000002 - if the async function was not called with await. 2992 * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. 2993 * @syscap SystemCapability.Test.UiTest 2994 * @since 9 2995 * @test 2996 */ 2997 /** 2998 * Pinch shrink this {@link Component} to the target scale. 2999 * 3000 * @param { number } scale - the scale of the pinch shrink this {@link Component}'s size, ranges from 0 to 1. 3001 * @returns { Promise<void> } 3002 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 3003 * @throws { BusinessError } 17000002 - The async function is not called with await. 3004 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 3005 * @syscap SystemCapability.Test.UiTest 3006 * @crossplatform 3007 * @atomicservice 3008 * @since 11 3009 * @test 3010 */ 3011 pinchIn(scale: number): Promise<void>; 3012 3013 /** 3014 * Get the description attribute value. 3015 * 3016 * @returns { Promise<string> } the description value. 3017 * @throws { BusinessError } 17000002 - The async function is not called with await. 3018 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 3019 * @syscap SystemCapability.Test.UiTest 3020 * @atomicservice 3021 * @since 11 3022 * @test 3023 */ 3024 getDescription(): Promise<string>; 3025} 3026 3027/** 3028 * The unified facade of UiTest framework,can be used to find {@link Component},trigger keyEvents,perform 3029 * coordinates-based UI actions,capture screen and so on. 3030 * 3031 * @syscap SystemCapability.Test.UiTest 3032 * @since 9 3033 * @test 3034 */ 3035/** 3036 * The unified facade of UiTest framework,can be used to find {@link Component},trigger keyEvents,perform 3037 * coordinates-based UI actions,capture screen and so on. 3038 * 3039 * @syscap SystemCapability.Test.UiTest 3040 * @atomicservice 3041 * @since 11 3042 * @test 3043 */ 3044/** 3045 * The unified facade of UiTest framework,can be used to find {@link Component},trigger keyEvents,perform 3046 * coordinates-based UI actions,capture screen and so on. 3047 * 3048 * @syscap SystemCapability.Test.UiTest 3049 * @crossplatform 3050 * @atomicservice 3051 * @since 12 3052 * @test 3053 */ 3054declare class Driver { 3055 /** 3056 * Create an {@link Driver} object. 3057 * 3058 * @returns { Driver } the {@link Driver} object. 3059 * @throws { BusinessError } 17000001 - if the test framework failed to initialize. 3060 * @syscap SystemCapability.Test.UiTest 3061 * @since 9 3062 * @test 3063 */ 3064 /** 3065 * Create an {@link Driver} object. 3066 * 3067 * @returns { Driver } the {@link Driver} object. 3068 * @throws { BusinessError } 17000001 - if the test framework failed to initialize. 3069 * @syscap SystemCapability.Test.UiTest 3070 * @crossplatform 3071 * @since 10 3072 * @test 3073 */ 3074 /** 3075 * Create an {@link Driver} object. 3076 * 3077 * @returns { Driver } the {@link Driver} object. 3078 * @throws { BusinessError } 17000001 - Initialization failed. 3079 * @syscap SystemCapability.Test.UiTest 3080 * @crossplatform 3081 * @atomicservice 3082 * @since 11 3083 * @test 3084 */ 3085 static create(): Driver; 3086 3087 /** 3088 * Delay with specified duration. 3089 * 3090 * @param { number } duration The delay duration in milliseconds. 3091 * @returns { Promise<void> } 3092 * @throws { BusinessError } 401 - if the input parameters are invalid. 3093 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3094 * @syscap SystemCapability.Test.UiTest 3095 * @since 9 3096 * @test 3097 */ 3098 /** 3099 * Delay with specified duration. 3100 * 3101 * @param { number } duration The delay duration in milliseconds. 3102 * @returns { Promise<void> } 3103 * @throws { BusinessError } 401 - if the input parameters are invalid. 3104 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3105 * @syscap SystemCapability.Test.UiTest 3106 * @crossplatform 3107 * @since 10 3108 * @test 3109 */ 3110 /** 3111 * Delay with specified duration. 3112 * 3113 * @param { number } duration - the delay duration in milliseconds, not less than 0. 3114 * @returns { Promise<void> } 3115 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 3116 * @throws { BusinessError } 17000002 - The async function is not called with await. 3117 * @syscap SystemCapability.Test.UiTest 3118 * @crossplatform 3119 * @atomicservice 3120 * @since 11 3121 * @test 3122 */ 3123 delayMs(duration: number): Promise<void>; 3124 3125 /** 3126 * Find the first matched {@link Component} on current UI. 3127 * 3128 * @param { On } on The attribute requirements of the target {@link Component}. 3129 * @returns { Promise<Component> } the first matched {@link Component} or undefined. 3130 * @throws { BusinessError } 401 - if the input parameters are invalid. 3131 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3132 * @syscap SystemCapability.Test.UiTest 3133 * @since 9 3134 * @test 3135 */ 3136 /** 3137 * Find the first matched {@link Component} on current UI. 3138 * 3139 * @param { On } on The attribute requirements of the target {@link Component}. 3140 * @returns { Promise<Component> } the first matched {@link Component} or undefined. 3141 * @throws { BusinessError } 401 - if the input parameters are invalid. 3142 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3143 * @syscap SystemCapability.Test.UiTest 3144 * @crossplatform 3145 * @since 10 3146 * @test 3147 */ 3148 /** 3149 * Find the first matched {@link Component} on current UI. 3150 * 3151 * @param { On } on - the attribute requirements of the target {@link Component}. 3152 * @returns { Promise<Component> } the first matched {@link Component} or undefined. 3153 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 3154 * @throws { BusinessError } 17000002 - The async function is not called with await. 3155 * @syscap SystemCapability.Test.UiTest 3156 * @crossplatform 3157 * @atomicservice 3158 * @since 11 3159 * @test 3160 */ 3161 findComponent(on: On): Promise<Component>; 3162 3163 /** 3164 * Find the first matched {@link UiWindow} window. 3165 * 3166 * @param { WindowFilter } filter The filer condition of the target {@link UiWindow}. 3167 * @returns { Promise<UiWindow> } the first matched {@link UiWindow} or undefined. 3168 * @throws { BusinessError } 401 - if the input parameters are invalid. 3169 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3170 * @syscap SystemCapability.Test.UiTest 3171 * @since 9 3172 * @test 3173 */ 3174 /** 3175 * Find the first matched {@link UiWindow} window. 3176 * 3177 * @param { WindowFilter } filter - the filer condition of the target {@link UiWindow}. 3178 * @returns { Promise<UiWindow> } the first matched {@link UiWindow} or undefined. 3179 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 3180 * @throws { BusinessError } 17000002 - The async function is not called with await. 3181 * @syscap SystemCapability.Test.UiTest 3182 * @atomicservice 3183 * @since 11 3184 * @test 3185 */ 3186 findWindow(filter: WindowFilter): Promise<UiWindow>; 3187 3188 /** 3189 * Find the first matched {@link Component} on current UI during the time given. 3190 * 3191 * @param { On } on The attribute requirements of the target {@link Component}. 3192 * @param { number } time Duration of finding in milliseconds 3193 * @returns { Promise<Component> } the first matched {@link Component} or undefined. 3194 * @throws { BusinessError } 401 - if the input parameters are invalid. 3195 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3196 * @syscap SystemCapability.Test.UiTest 3197 * @since 9 3198 * @test 3199 */ 3200 /** 3201 * Find the first matched {@link Component} on current UI during the time given. 3202 * 3203 * @param { On } on - the attribute requirements of the target {@link Component}. 3204 * @param { number } time - duration of finding in milliseconds, not less than 0. 3205 * @returns { Promise<Component> } the first matched {@link Component} or undefined. 3206 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 3207 * @throws { BusinessError } 17000002 - The async function is not called with await. 3208 * @syscap SystemCapability.Test.UiTest 3209 * @atomicservice 3210 * @since 11 3211 * @test 3212 */ 3213 waitForComponent(on: On, time: number): Promise<Component>; 3214 3215 /** 3216 * Find all the matched {@link Component}s on current UI. 3217 * 3218 * @param { On } on The attribute requirements of the target {@link Component}. 3219 * @returns { Promise<Array<Component>> } the matched {@link Component}s list. 3220 * @throws { BusinessError } 401 - if the input parameters are invalid. 3221 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3222 * @syscap SystemCapability.Test.UiTest 3223 * @since 9 3224 * @test 3225 */ 3226 /** 3227 * Find all the matched {@link Component}s on current UI. 3228 * 3229 * @param { On } on The attribute requirements of the target {@link Component}. 3230 * @returns { Promise<Array<Component>> } the matched {@link Component}s list. 3231 * @throws { BusinessError } 401 - if the input parameters are invalid. 3232 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3233 * @syscap SystemCapability.Test.UiTest 3234 * @crossplatform 3235 * @since 10 3236 * @test 3237 */ 3238 /** 3239 * Find all the matched {@link Component}s on current UI. 3240 * 3241 * @param { On } on - the attribute requirements of the target {@link Component}. 3242 * @returns { Promise<Array<Component>> } the matched {@link Component}s list. 3243 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 3244 * @throws { BusinessError } 17000002 - The async function is not called with await. 3245 * @syscap SystemCapability.Test.UiTest 3246 * @crossplatform 3247 * @atomicservice 3248 * @since 11 3249 * @test 3250 */ 3251 findComponents(on: On): Promise<Array<Component>>; 3252 3253 /** 3254 * Assert t the matched {@link Component}s exists on current UI;if not,assertError will be raised. 3255 * 3256 * @param { On } on The attribute requirements of the target {@link Component}. 3257 * @returns { Promise<void> } 3258 * @throws { BusinessError } 401 - if the input parameters are invalid. 3259 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3260 * @throws { BusinessError } 17000003 - if the assertion failed. 3261 * @syscap SystemCapability.Test.UiTest 3262 * @since 9 3263 * @test 3264 */ 3265 /** 3266 * Assert t the matched {@link Component}s exists on current UI;if not,assertError will be raised. 3267 * 3268 * @param { On } on The attribute requirements of the target {@link Component}. 3269 * @returns { Promise<void> } 3270 * @throws { BusinessError } 401 - if the input parameters are invalid. 3271 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3272 * @throws { BusinessError } 17000003 - if the assertion failed. 3273 * @syscap SystemCapability.Test.UiTest 3274 * @crossplatform 3275 * @since 10 3276 * @test 3277 */ 3278 /** 3279 * Assert t the matched {@link Component}s exists on current UI;if not,assertError will be raised. 3280 * 3281 * @param { On } on - the attribute requirements of the target {@link Component}. 3282 * @returns { Promise<void> } 3283 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 3284 * @throws { BusinessError } 17000002 - The async function is not called with await. 3285 * @throws { BusinessError } 17000003 - Assertion failed. 3286 * @syscap SystemCapability.Test.UiTest 3287 * @crossplatform 3288 * @atomicservice 3289 * @since 11 3290 * @test 3291 */ 3292 assertComponentExist(on: On): Promise<void>; 3293 3294 /** 3295 * Press the BACK key. 3296 * 3297 * @returns { Promise<void> } 3298 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3299 * @syscap SystemCapability.Test.UiTest 3300 * @since 9 3301 * @test 3302 */ 3303 /** 3304 * Press the BACK key. 3305 * 3306 * @returns { Promise<void> } 3307 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3308 * @syscap SystemCapability.Test.UiTest 3309 * @crossplatform 3310 * @since 10 3311 * @test 3312 */ 3313 /** 3314 * Press the BACK key. 3315 * 3316 * @returns { Promise<void> } 3317 * @throws { BusinessError } 17000002 - The async function is not called with await. 3318 * @syscap SystemCapability.Test.UiTest 3319 * @crossplatform 3320 * @atomicservice 3321 * @since 11 3322 * @test 3323 */ 3324 pressBack(): Promise<void>; 3325 3326 /** 3327 * Press the specified key. 3328 * 3329 * @param { number } keyCode the target keyCode. 3330 * @returns { Promise<void> } 3331 * @throws { BusinessError } 401 - if the input parameters are invalid. 3332 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3333 * @syscap SystemCapability.Test.UiTest 3334 * @since 9 3335 * @test 3336 */ 3337 /** 3338 * Press the specified key. 3339 * 3340 * @param { number } keyCode - the target keyCode. 3341 * @returns { Promise<void> } 3342 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 3343 * @throws { BusinessError } 17000002 - The async function is not called with await. 3344 * @syscap SystemCapability.Test.UiTest 3345 * @crossplatform 3346 * @atomicservice 3347 * @since 11 3348 * @test 3349 */ 3350 triggerKey(keyCode: number): Promise<void>; 3351 3352 /** 3353 * Press two or three key combinations 3354 * 3355 * @param { number } key0 the first keyCode. 3356 * @param { number } key1 the second keyCode. 3357 * @param { number } key2 the third keyCode. 3358 * @returns { Promise<void> } 3359 * @throws { BusinessError } 401 - if the input parameters are invalid. 3360 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3361 * @syscap SystemCapability.Test.UiTest 3362 * @since 9 3363 * @test 3364 */ 3365 /** 3366 * Press two or three key combinations 3367 * 3368 * @param { number } key0 - the first keyCode. 3369 * @param { number } key1 - the second keyCode. 3370 * @param { number } [key2] - the third keyCode,set it default 0 if null or undefined. 3371 * @returns { Promise<void> } 3372 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 3373 * @throws { BusinessError } 17000002 - The async function is not called with await. 3374 * @syscap SystemCapability.Test.UiTest 3375 * @crossplatform 3376 * @atomicservice 3377 * @since 11 3378 * @test 3379 */ 3380 triggerCombineKeys(key0: number, key1: number, key2?: number): Promise<void>; 3381 3382 /** 3383 * Click on the specified location on the screen. 3384 * 3385 * @param { number } x The x-coordinate. 3386 * @param { number } y The y-coordinate. 3387 * @returns { Promise<void> } 3388 * @throws { BusinessError } 401 - if the input parameters are invalid. 3389 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3390 * @syscap SystemCapability.Test.UiTest 3391 * @since 9 3392 * @test 3393 */ 3394 /** 3395 * Click on the specified location on the screen. 3396 * 3397 * @param { number } x The x-coordinate. 3398 * @param { number } y The y-coordinate. 3399 * @returns { Promise<void> } 3400 * @throws { BusinessError } 401 - if the input parameters are invalid. 3401 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3402 * @syscap SystemCapability.Test.UiTest 3403 * @crossplatform 3404 * @since 10 3405 * @test 3406 */ 3407 /** 3408 * Click on the specified location on the screen. 3409 * 3410 * @param { number } x - the x-coordinate, not less than 0. 3411 * @param { number } y - the y-coordinate, not less than 0. 3412 * @returns { Promise<void> } 3413 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 3414 * @throws { BusinessError } 17000002 - The async function is not called with await. 3415 * @syscap SystemCapability.Test.UiTest 3416 * @crossplatform 3417 * @atomicservice 3418 * @since 11 3419 * @test 3420 */ 3421 click(x: number, y: number): Promise<void>; 3422 3423 /** 3424 * DoubleClick on the specified location on the screen. 3425 * 3426 * @param { number } x The x-coordinate. 3427 * @param { number } y The y-coordinate. 3428 * @returns { Promise<void> } 3429 * @throws { BusinessError } 401 - if the input parameters are invalid. 3430 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3431 * @syscap SystemCapability.Test.UiTest 3432 * @since 9 3433 * @test 3434 */ 3435 /** 3436 * DoubleClick on the specified location on the screen. 3437 * 3438 * @param { number } x The x-coordinate. 3439 * @param { number } y The y-coordinate. 3440 * @returns { Promise<void> } 3441 * @throws { BusinessError } 401 - if the input parameters are invalid. 3442 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3443 * @syscap SystemCapability.Test.UiTest 3444 * @crossplatform 3445 * @since 10 3446 * @test 3447 */ 3448 /** 3449 * DoubleClick on the specified location on the screen. 3450 * 3451 * @param { number } x - the x-coordinate, not less than 0. 3452 * @param { number } y - the y-coordinate, not less than 0. 3453 * @returns { Promise<void> } 3454 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 3455 * @throws { BusinessError } 17000002 - The async function is not called with await. 3456 * @syscap SystemCapability.Test.UiTest 3457 * @crossplatform 3458 * @atomicservice 3459 * @since 11 3460 * @test 3461 */ 3462 doubleClick(x: number, y: number): Promise<void>; 3463 3464 /** 3465 * LongClick on the specified location on the screen. 3466 * 3467 * @param { number } x The x-coordinate. 3468 * @param { number } y The y-coordinate. 3469 * @returns { Promise<void> } 3470 * @throws { BusinessError } 401 - if the input parameters are invalid. 3471 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3472 * @syscap SystemCapability.Test.UiTest 3473 * @since 9 3474 * @test 3475 */ 3476 /** 3477 * LongClick on the specified location on the screen. 3478 * 3479 * @param { number } x The x-coordinate. 3480 * @param { number } y The y-coordinate. 3481 * @returns { Promise<void> } 3482 * @throws { BusinessError } 401 - if the input parameters are invalid. 3483 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3484 * @syscap SystemCapability.Test.UiTest 3485 * @crossplatform 3486 * @since 10 3487 * @test 3488 */ 3489 /** 3490 * LongClick on the specified location on the screen. 3491 * 3492 * @param { number } x - the x-coordinate, not less than 0. 3493 * @param { number } y - the y-coordinate, not less than 0. 3494 * @returns { Promise<void> } 3495 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 3496 * @throws { BusinessError } 17000002 - The async function is not called with await. 3497 * @syscap SystemCapability.Test.UiTest 3498 * @crossplatform 3499 * @atomicservice 3500 * @since 11 3501 * @test 3502 */ 3503 longClick(x: number, y: number): Promise<void>; 3504 3505 /** 3506 * Swipe on the screen between the specified points. 3507 * 3508 * @param { number } startx The x-coordinate of the starting point. 3509 * @param { number } starty The y-coordinate of the starting point. 3510 * @param { number } endx The x-coordinate of the ending point. 3511 * @param { number } endy The y-coordinate of the ending point. 3512 * @param { number } speed The speed of swipe (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range. 3513 * @returns { Promise<void> } 3514 * @throws { BusinessError } 401 - if the input parameters are invalid. 3515 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3516 * @syscap SystemCapability.Test.UiTest 3517 * @since 9 3518 * @test 3519 */ 3520 /** 3521 * Swipe on the screen between the specified points. 3522 * 3523 * @param { number } startx The x-coordinate of the starting point. 3524 * @param { number } starty The y-coordinate of the starting point. 3525 * @param { number } endx The x-coordinate of the ending point. 3526 * @param { number } endy The y-coordinate of the ending point. 3527 * @param { number } speed The speed of swipe (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range. 3528 * @returns { Promise<void> } 3529 * @throws { BusinessError } 401 - if the input parameters are invalid. 3530 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3531 * @syscap SystemCapability.Test.UiTest 3532 * @crossplatform 3533 * @since 10 3534 * @test 3535 */ 3536 /** 3537 * Swipe on the screen between the specified points. 3538 * 3539 * @param { number } startx - the x-coordinate of the starting point, not less than 0. 3540 * @param { number } starty - the y-coordinate of the starting point, not less than 0. 3541 * @param { number } endx - the x-coordinate of the ending point, not less than 0. 3542 * @param { number } endy - the y-coordinate of the ending point, not less than 0. 3543 * @param { number } [speed] - the speed of swipe(pixels per second),ranges from 200 to 40000. Set it default 600 if out of range or null or undefined. 3544 * @returns { Promise<void> } 3545 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 3546 * @throws { BusinessError } 17000002 - The async function is not called with await. 3547 * @syscap SystemCapability.Test.UiTest 3548 * @crossplatform 3549 * @atomicservice 3550 * @since 11 3551 * @test 3552 */ 3553 swipe(startx: number, starty: number, endx: number, endy: number, speed?: number): Promise<void>; 3554 3555 /** 3556 * Drag on the screen between the specified points. 3557 * 3558 * @param { number } startx The x-coordinate of the starting point. 3559 * @param { number } starty The y-coordinate of the starting point. 3560 * @param { number } endx The x-coordinate of the ending point. 3561 * @param { number } endy The y-coordinate of the ending point. 3562 * @param { number } speed The speed of swipe (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range. 3563 * @returns { Promise<void> } 3564 * @throws { BusinessError } 401 - if the input parameters are invalid. 3565 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3566 * @syscap SystemCapability.Test.UiTest 3567 * @since 9 3568 * @test 3569 */ 3570 /** 3571 * Drag on the screen between the specified points. 3572 * 3573 * @param { number } startx - the x-coordinate of the starting point, not less than 0. 3574 * @param { number } starty - the y-coordinate of the starting point, not less than 0. 3575 * @param { number } endx - the x-coordinate of the ending point, not less than 0. 3576 * @param { number } endy - the y-coordinate of the ending point, not less than 0. 3577 * @param { number } [speed] the speed of drag(pixels per second),ranges from 200 to 40000. Set it default 600 if out of range or null or undefined. 3578 * @returns { Promise<void> } 3579 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 3580 * @throws { BusinessError } 17000002 - The async function is not called with await. 3581 * @syscap SystemCapability.Test.UiTest 3582 * @atomicservice 3583 * @since 11 3584 * @test 3585 */ 3586 drag(startx: number, starty: number, endx: number, endy: number, speed?: number): Promise<void>; 3587 3588 /** 3589 * Capture current screen and save as picture which PNG format. 3590 * 3591 * @param { string } savePath the path where to store the picture. 3592 * @returns { Promise<boolean> } true if screen-capturing and file-storing are completed successfully,false otherwise. 3593 * @throws { BusinessError } 401 - if the input parameters are invalid. 3594 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3595 * @syscap SystemCapability.Test.UiTest 3596 * @since 9 3597 * @test 3598 */ 3599 /** 3600 * Capture current screen and save as picture which PNG format. 3601 * 3602 * @param { string } savePath - the path where to store the picture, must be in the application sandbox directory. 3603 * @returns { Promise<boolean> } true if screen-capturing and file-storing are completed successfully,false otherwise. 3604 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 3605 * @throws { BusinessError } 17000002 - The async function is not called with await. 3606 * @syscap SystemCapability.Test.UiTest 3607 * @atomicservice 3608 * @since 11 3609 * @test 3610 */ 3611 screenCap(savePath: string): Promise<boolean>; 3612 3613 /** 3614 * Set the rotation of the device display. 3615 * 3616 * @param { DisplayRotation } rotation The target rotation to set. 3617 * @returns { Promise<void> } 3618 * @throws { BusinessError } 401 - if the input parameters are invalid. 3619 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3620 * @syscap SystemCapability.Test.UiTest 3621 * @since 9 3622 * @test 3623 */ 3624 /** 3625 * Set the rotation of the device display. 3626 * 3627 * @param { DisplayRotation } rotation - the target rotation to set. 3628 * @returns { Promise<void> } 3629 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 3630 * @throws { BusinessError } 17000002 - The async function is not called with await. 3631 * @syscap SystemCapability.Test.UiTest 3632 * @atomicservice 3633 * @since 11 3634 * @test 3635 */ 3636 setDisplayRotation(rotation: DisplayRotation): Promise<void>; 3637 3638 /** 3639 * Get the rotation of the device display. 3640 * 3641 * @returns { Promise<DisplayRotation> } the current display rotation. 3642 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3643 * @syscap SystemCapability.Test.UiTest 3644 * @since 9 3645 * @test 3646 */ 3647 /** 3648 * Get the rotation of the device display. 3649 * 3650 * @returns { Promise<DisplayRotation> } the current display rotation. 3651 * @throws { BusinessError } 17000002 - The async function is not called with await. 3652 * @syscap SystemCapability.Test.UiTest 3653 * @atomicservice 3654 * @since 11 3655 * @test 3656 */ 3657 getDisplayRotation(): Promise<DisplayRotation>; 3658 3659 /** 3660 * Enable/disable the rotation of device display. 3661 * 3662 * @param { boolean } enabled Enable the rotation or not. 3663 * @returns { Promise<void> } 3664 * @throws { BusinessError } 401 - if the input parameters are invalid. 3665 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3666 * @syscap SystemCapability.Test.UiTest 3667 * @since 9 3668 * @test 3669 */ 3670 /** 3671 * Enable/disable the rotation of device display. 3672 * 3673 * @param { boolean } enabled - enable the rotation or not. 3674 * @returns { Promise<void> } 3675 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 3676 * @throws { BusinessError } 17000002 - The async function is not called with await. 3677 * @syscap SystemCapability.Test.UiTest 3678 * @atomicservice 3679 * @since 11 3680 * @test 3681 */ 3682 setDisplayRotationEnabled(enabled: boolean): Promise<void>; 3683 3684 /** 3685 * Get the size of the device display. 3686 * 3687 * @returns { Promise<Point> } the size of the device display. 3688 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3689 * @syscap SystemCapability.Test.UiTest 3690 * @since 9 3691 * @test 3692 */ 3693 /** 3694 * Get the size of the device display. 3695 * 3696 * @returns { Promise<Point> } the size of the device display. 3697 * @throws { BusinessError } 17000002 - The async function is not called with await. 3698 * @syscap SystemCapability.Test.UiTest 3699 * @atomicservice 3700 * @since 11 3701 * @test 3702 */ 3703 getDisplaySize(): Promise<Point>; 3704 3705 /** 3706 * Get the density of the device display. 3707 * 3708 * @returns { Promise<Point> } the density of the device display. 3709 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3710 * @syscap SystemCapability.Test.UiTest 3711 * @since 9 3712 * @test 3713 */ 3714 /** 3715 * Get the density of the device display. 3716 * 3717 * @returns { Promise<Point> } the density of the device display. 3718 * @throws { BusinessError } 17000002 - The async function is not called with await. 3719 * @syscap SystemCapability.Test.UiTest 3720 * @atomicservice 3721 * @since 11 3722 * @test 3723 */ 3724 getDisplayDensity(): Promise<Point>; 3725 3726 /** 3727 * Wake up the device display. 3728 * 3729 * @returns { Promise<void> } 3730 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3731 * @syscap SystemCapability.Test.UiTest 3732 * @since 9 3733 * @test 3734 */ 3735 /** 3736 * Wake up the device display. 3737 * 3738 * @returns { Promise<void> } 3739 * @throws { BusinessError } 17000002 - The async function is not called with await. 3740 * @syscap SystemCapability.Test.UiTest 3741 * @atomicservice 3742 * @since 11 3743 * @test 3744 */ 3745 wakeUpDisplay(): Promise<void>; 3746 3747 /** 3748 * Press the home key. 3749 * 3750 * @returns { Promise<void> } 3751 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3752 * @syscap SystemCapability.Test.UiTest 3753 * @since 9 3754 * @test 3755 */ 3756 /** 3757 * Press the home key. 3758 * 3759 * @returns { Promise<void> } 3760 * @throws { BusinessError } 17000002 - The async function is not called with await. 3761 * @syscap SystemCapability.Test.UiTest 3762 * @atomicservice 3763 * @since 11 3764 * @test 3765 */ 3766 pressHome(): Promise<void>; 3767 3768 /** 3769 * Wait for the UI become idle. 3770 * 3771 * @param { number } idleTime the threshold of UI idle time, in millisecond. 3772 * @param { number } timeout The maximum time to wait for idle, in millisecond. 3773 * @returns { Promise<boolean> } true if wait for idle succeed in the timeout, false otherwise. 3774 * @throws { BusinessError } 401 - if the input parameters are invalid. 3775 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3776 * @syscap SystemCapability.Test.UiTest 3777 * @since 9 3778 * @test 3779 */ 3780 /** 3781 * Wait for the UI become idle. 3782 * 3783 * @param { number } idleTime - the threshold of UI idle time, in millisecond, not less than 0. 3784 * @param { number } timeout - the maximum time to wait for idle, in millisecond, not less than 0. 3785 * @returns { Promise<boolean> } true if wait for idle succeed in the timeout, false otherwise. 3786 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 3787 * @throws { BusinessError } 17000002 - The async function is not called with await. 3788 * @syscap SystemCapability.Test.UiTest 3789 * @atomicservice 3790 * @since 11 3791 * @test 3792 */ 3793 waitForIdle(idleTime: number, timeout: number): Promise<boolean>; 3794 3795 /** 3796 * Inject fling on the device display. 3797 * 3798 * @param { Point } from The coordinate point where the finger touches the screen. 3799 * @param { Point } to The coordinate point where the finger leaves the screen. 3800 * @param { number } stepLen the length of each step, in pixels. 3801 * @param { number } speed The speed of fling (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range. 3802 * @returns { Promise<void> } 3803 * @throws { BusinessError } 401 - if the input parameters are invalid. 3804 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3805 * @syscap SystemCapability.Test.UiTest 3806 * @since 9 3807 * @test 3808 */ 3809 /** 3810 * Inject fling on the device display. 3811 * 3812 * @param { Point } from The coordinate point where the finger touches the screen. 3813 * @param { Point } to The coordinate point where the finger leaves the screen. 3814 * @param { number } stepLen the length of each step, in pixels. 3815 * @param { number } speed The speed of fling (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range. 3816 * @returns { Promise<void> } 3817 * @throws { BusinessError } 401 - if the input parameters are invalid. 3818 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3819 * @syscap SystemCapability.Test.UiTest 3820 * @crossplatform 3821 * @since 10 3822 * @test 3823 */ 3824 /** 3825 * Inject fling on the device display. 3826 * 3827 * @param { Point } from - the coordinate point where the finger touches the screen. 3828 * @param { Point } to - the coordinate point where the finger leaves the screen. 3829 * @param { number } stepLen - the length of each step, in pixels. 3830 * @param { number } [speed] - the speed of fling(pixels per second),ranges from 200 to 40000. Set it default 600 if out of range or null or undefined. 3831 * @returns { Promise<void> } 3832 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 3833 * @throws { BusinessError } 17000002 - The async function is not called with await. 3834 * @syscap SystemCapability.Test.UiTest 3835 * @crossplatform 3836 * @atomicservice 3837 * @since 11 3838 * @test 3839 */ 3840 fling(from: Point, to: Point, stepLen: number, speed: number): Promise<void>; 3841 3842 /** 3843 * Inject multi-pointer action on the device display. 3844 * 3845 * @param { PointerMatrix } pointers The two-dimensional array of pointers to inject. 3846 * @param { number } speed The speed of swipe (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range. 3847 * @returns { Promise<boolean> } true if the operation finished, false 3848 * @throws { BusinessError } 401 - if the input parameters are invalid. 3849 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3850 * @syscap SystemCapability.Test.UiTest 3851 * @since 9 3852 * @test 3853 */ 3854 /** 3855 * Inject multi-pointer action on the device display. 3856 * 3857 * @param { PointerMatrix } pointers - the two-dimensional array of pointers to inject. 3858 * @param { number } [speed] - the speed of swipe(pixels per second),ranges from 200 to 40000. Set it default 600 if out of range or null or undefined. 3859 * @returns { Promise<boolean> } true if the operation finished, false 3860 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 3861 * @throws { BusinessError } 17000002 - The async function is not called with await. 3862 * @syscap SystemCapability.Test.UiTest 3863 * @crossplatform 3864 * @atomicservice 3865 * @since 11 3866 * @test 3867 */ 3868 injectMultiPointerAction(pointers: PointerMatrix, speed?: number): Promise<boolean>; 3869 3870 /** 3871 * Inject fling on the device display. 3872 * 3873 * @param { UiDirection } direction The direction of this action. 3874 * @param { number } speed The speed of fling (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range. 3875 * @returns { Promise<void> } 3876 * @throws { BusinessError } 401 - if the input parameters are invalid. 3877 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3878 * @syscap SystemCapability.Test.UiTest 3879 * @since 10 3880 * @test 3881 */ 3882 /** 3883 * Inject fling on the device display. 3884 * 3885 * @param { UiDirection } direction - the direction of this action. 3886 * @param { number } speed - the speed of fling (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range. 3887 * @returns { Promise<void> } 3888 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 3889 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3890 * @syscap SystemCapability.Test.UiTest 3891 * @atomicservice 3892 * @since 11 3893 * @test 3894 */ 3895 /** 3896 * Inject fling on the device display. 3897 * 3898 * @param { UiDirection } direction - the direction of this action. 3899 * @param { number } speed - the speed of fling (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range. 3900 * @returns { Promise<void> } 3901 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 3902 * @throws { BusinessError } 17000002 - The async function is not called with await. 3903 * @syscap SystemCapability.Test.UiTest 3904 * @crossplatform 3905 * @atomicservice 3906 * @since 12 3907 * @test 3908 */ 3909 fling(direction: UiDirection, speed: number): Promise<void>; 3910 3911 /** 3912 * Click on the specified location on the screen with the specified mouse button, and press the specified key simultaneously if necessary. 3913 * 3914 * @param { Point } p The coordinate of the specified location. 3915 * @param { MouseButton } btnId The button of Mouse. 3916 * @param { number } key1 the first keyCode. 3917 * @param { number } key2 the second keyCode. 3918 * @returns { Promise<void> } 3919 * @throws { BusinessError } 401 - if the input parameters are invalid. 3920 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3921 * @syscap SystemCapability.Test.UiTest 3922 * @since 10 3923 * @test 3924 */ 3925 /** 3926 * Click on the specified location on the screen with the specified mouse button, and press the specified key simultaneously if necessary. 3927 * 3928 * @param { Point } p - the coordinate of the specified location. 3929 * @param { MouseButton } btnId - the button of Mouse. 3930 * @param { number } [key1] - the first keyCode,set it default 0 if null or undefined. 3931 * @param { number } [key2] - the second keyCode,set it default 0 if null or undefined. 3932 * @returns { Promise<void> } 3933 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 3934 * @throws { BusinessError } 17000002 - The async function is not called with await. 3935 * @syscap SystemCapability.Test.UiTest 3936 * @atomicservice 3937 * @since 11 3938 * @test 3939 */ 3940 mouseClick(p: Point, btnId: MouseButton, key1?: number, key2?: number): Promise<void>; 3941 3942 /** 3943 * Move the mouse cursor to the specified location. 3944 * 3945 * @param { Point } p The coordinate of the specified location. 3946 * @returns { Promise<void> } 3947 * @throws { BusinessError } 401 - if the input parameters are invalid. 3948 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3949 * @syscap SystemCapability.Test.UiTest 3950 * @since 10 3951 * @test 3952 */ 3953 /** 3954 * Move the mouse cursor to the specified location. 3955 * 3956 * @param { Point } p - the coordinate of the specified location. 3957 * @returns { Promise<void> } 3958 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 3959 * @throws { BusinessError } 17000002 - The async function is not called with await. 3960 * @syscap SystemCapability.Test.UiTest 3961 * @atomicservice 3962 * @since 11 3963 * @test 3964 */ 3965 mouseMoveTo(p: Point): Promise<void>; 3966 3967 /** 3968 * The mouse wheel scrolls the specified cell at the specified position, and press the specified key simultaneously if necessary. 3969 * 3970 * @param { Point } p The coordinate of the specified location. 3971 * @param { boolean } down Whether the mouse wheel rolls down. 3972 * @param { number } d The number of cells that the mouse wheel scrolls, each cell will make the target point shift 120 pixels. 3973 * @param { number } key1 the first keyCode. 3974 * @param { number } key2 the second keyCode. 3975 * @returns { Promise<void> } 3976 * @throws { BusinessError } 401 - if the input parameters are invalid. 3977 * @throws { BusinessError } 17000002 - if the async function was not called with await. 3978 * @syscap SystemCapability.Test.UiTest 3979 * @since 10 3980 * @test 3981 */ 3982 /** 3983 * The mouse wheel scrolls the specified cell at the specified position, and press the specified key simultaneously if necessary. 3984 * 3985 * @param { Point } p - the coordinate of the specified location. 3986 * @param { boolean } down - whether the mouse wheel rolls down. 3987 * @param { number } d - the number of cells that the mouse wheel scrolls, each cell will make the target point shift 120 pixels. 3988 * @param { number } [key1] - the first keyCode,set it default 0 if null or undefined. 3989 * @param { number } [key2] - the second keyCode,set it default 0 if null or undefined. 3990 * @returns { Promise<void> } 3991 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 3992 * @throws { BusinessError } 17000002 - The async function is not called with await. 3993 * @syscap SystemCapability.Test.UiTest 3994 * @atomicservice 3995 * @since 11 3996 * @test 3997 */ 3998 mouseScroll(p: Point, down: boolean, d: number, key1?: number, key2?: number): Promise<void>; 3999 /** 4000 * The mouse wheel scrolls the specified cell at the specified position, and press the specified key simultaneously if necessary. 4001 * 4002 * @param { Point } p - the coordinate of the specified location. 4003 * @param { boolean } down - whether the mouse wheel rolls down. 4004 * @param { number } d - the number of cells that the mouse wheel scrolls, each cell will make the target point shift 120 pixels. 4005 * @param { number } [key1] - the first keyCode,set it default 0 if null or undefined. 4006 * @param { number } [key2] - the second keyCode,set it default 0 if null or undefined. 4007 * @param { number } [speed] - The Speed of mouse wheel rolls(cells per second),ranges from 1 to 500.Set it default 20 if out of range or null or undefined. 4008 * @returns { Promise<void> } 4009 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 4010 * @throws { BusinessError } 17000002 - The async function is not called with await. 4011 * @syscap SystemCapability.Test.UiTest 4012 * @atomicservice 4013 * @since 11 4014 * @test 4015 */ 4016 mouseScroll(p: Point, down: boolean, d: number, key1?: number, key2?: number, speed?: number): Promise<void>; 4017 4018 /** 4019 * Capture the specified area of current screen and save as picture which PNG format. 4020 * 4021 * @param { string } savePath the path where to store the picture. 4022 * @param { Rect } rect The specified area of current screen, default to full screen. 4023 * @returns { Promise<boolean> } true if screen-capturing and file-storing are completed successfully,false otherwise. 4024 * @throws { BusinessError } 401 - if the input parameters are invalid. 4025 * @throws { BusinessError } 17000002 - if the async function was not called with await. 4026 * @syscap SystemCapability.Test.UiTest 4027 * @since 10 4028 * @test 4029 */ 4030 /** 4031 * Capture the specified area of current screen and save as picture which PNG format. 4032 * 4033 * @param { string } savePath - the path where to store the picture, must be in the application sandbox directory. 4034 * @param { Rect } [rect] - the specified area of current screen, default to full screen.Set it default if null or undefined. 4035 * @returns { Promise<boolean> } true if screen-capturing and file-storing are completed successfully,false otherwise. 4036 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 4037 * @throws { BusinessError } 17000002 - The async function is not called with await. 4038 * @syscap SystemCapability.Test.UiTest 4039 * @atomicservice 4040 * @since 11 4041 * @test 4042 */ 4043 screenCapture(savePath: string, rect?: Rect): Promise<boolean>; 4044 4045 /** 4046 * Create an {@link UIEventObserver} object. 4047 * 4048 * @returns { UIEventObserver } the {@link UIEventObserver} object. 4049 * @throws { BusinessError } 17000002 - if the async function was not called with await. 4050 * @syscap SystemCapability.Test.UiTest 4051 * @since 10 4052 * @test 4053 */ 4054 /** 4055 * Create an {@link UIEventObserver} object. 4056 * 4057 * @returns { UIEventObserver } the {@link UIEventObserver} object. 4058 * @throws { BusinessError } 17000002 - The async function is not called with await. 4059 * @syscap SystemCapability.Test.UiTest 4060 * @atomicservice 4061 * @since 11 4062 * @test 4063 */ 4064 createUIEventObserver(): UIEventObserver; 4065 4066 /** 4067 * Double click on the specified location on the screen with the specified mouse button, and press the specified key simultaneously if necessary. 4068 * 4069 * @param { Point } p - the coordinate of the specified location. 4070 * @param { MouseButton } btnId - the button of Mouse. 4071 * @param { number } [key1] - the first keyCode,set it default 0 if null or undefined. 4072 * @param { number } [key2] - the second keyCode,set it default 0 if null or undefined. 4073 * @returns { Promise<void> } 4074 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 4075 * @throws { BusinessError } 17000002 - The async function is not called with await. 4076 * @syscap SystemCapability.Test.UiTest 4077 * @atomicservice 4078 * @since 11 4079 * @test 4080 */ 4081 mouseDoubleClick(p: Point, btnId: MouseButton, key1?: number, key2?: number): Promise<void>; 4082 4083 /** 4084 * Long click on the specified location on the screen with the specified mouse button, and press the specified key simultaneously if necessary. 4085 * 4086 * @param { Point } p - the coordinate of the specified location. 4087 * @param { MouseButton } btnId - the button of Mouse. 4088 * @param { number } [key1] - the first keyCode,set it default 0 if null or undefined. 4089 * @param { number } [key2] - the second keyCode,set it default 0 if null or undefined. 4090 * @returns { Promise<void> } 4091 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 4092 * @throws { BusinessError } 17000002 - The async function is not called with await. 4093 * @syscap SystemCapability.Test.UiTest 4094 * @atomicservice 4095 * @since 11 4096 * @test 4097 */ 4098 mouseLongClick(p: Point, btnId: MouseButton, key1?: number, key2?: number): Promise<void>; 4099 4100 /** 4101 * Swipe on the screen between the specified points with mouse. 4102 * 4103 * @param { Point } from - the starting point. 4104 * @param { Point } to - the ending point. 4105 * @param { number } [speed] - speed of swipe (pixels per second),the value ranges from 200 to 40000.Set it default 600 if out of range or null or undefined. 4106 * @returns { Promise<void> } 4107 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 4108 * @throws { BusinessError } 17000002 - The async function is not called with await. 4109 * @syscap SystemCapability.Test.UiTest 4110 * @atomicservice 4111 * @since 11 4112 * @test 4113 */ 4114 mouseMoveWithTrack(from: Point, to: Point, speed?: number): Promise<void>; 4115 4116 /** 4117 * Hold down the left mouse button and drag on the screen between the specified points. 4118 * 4119 * @param { Point } from - the starting point. 4120 * @param { Point } to - the ending point. 4121 * @param { number } [speed] - speed of drag (pixels per second),the value ranges from 200 to 40000,Set it default 600 if out of range or null or undefined. 4122 * @returns { Promise<void> } 4123 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 4124 * @throws { BusinessError } 17000002 - The async function is not called with await. 4125 * @syscap SystemCapability.Test.UiTest 4126 * @atomicservice 4127 * @since 11 4128 * @test 4129 */ 4130 mouseDrag(from: Point, to: Point, speed?: number): Promise<void>; 4131 4132 /** 4133 * Inject text on the specified location. 4134 * 4135 * @param { Point } p - the coordinate of the specified location. 4136 * @param { string } text - the text to inject. 4137 * @returns { Promise<void> } 4138 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 4139 * @throws { BusinessError } 17000002 - The async function is not called with await. 4140 * @syscap SystemCapability.Test.UiTest 4141 * @atomicservice 4142 * @since 11 4143 * @test 4144 */ 4145 inputText(p: Point, text: string): Promise<void>; 4146} 4147 4148/** 4149 * @syscap SystemCapability.Test.UiTest 4150 * @since 9 4151 * @test 4152 */ 4153/** 4154 * Represents a window of the ohos application,user can perform operations or query attributes on it. 4155 * 4156 * @syscap SystemCapability.Test.UiTest 4157 * @atomicservice 4158 * @since 11 4159 * @test 4160 */ 4161declare class UiWindow { 4162 /** 4163 * Get the bundle name of this {@link UiWindow}. 4164 * 4165 * @returns { Promise<string> } the bundle name. 4166 * @throws { BusinessError } 17000002 - if the async function was not called with await. 4167 * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. 4168 * @syscap SystemCapability.Test.UiTest 4169 * @since 9 4170 * @test 4171 */ 4172 /** 4173 * Get the bundle name of this {@link UiWindow}. 4174 * 4175 * @returns { Promise<string> } the bundle name. 4176 * @throws { BusinessError } 17000002 - The async function is not called with await. 4177 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 4178 * @syscap SystemCapability.Test.UiTest 4179 * @atomicservice 4180 * @since 11 4181 * @test 4182 */ 4183 getBundleName(): Promise<string>; 4184 4185 /** 4186 * Get the bounds rect of this {@link UiWindow}. 4187 * 4188 * @returns { Promise<Rect> } the bounds rect object. 4189 * @throws { BusinessError } 17000002 - if the async function was not called with await. 4190 * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. 4191 * @syscap SystemCapability.Test.UiTest 4192 * @since 9 4193 * @test 4194 */ 4195 /** 4196 * Get the bounds rect of this {@link UiWindow}. 4197 * 4198 * @returns { Promise<Rect> } the bounds rect object. 4199 * @throws { BusinessError } 17000002 - The async function is not called with await. 4200 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 4201 * @syscap SystemCapability.Test.UiTest 4202 * @crossplatform 4203 * @atomicservice 4204 * @since 11 4205 * @test 4206 */ 4207 getBounds(): Promise<Rect>; 4208 4209 /** 4210 * Get the title of this {@link UiWindow}. 4211 * 4212 * @returns { Promise<string> } the title value. 4213 * @throws { BusinessError } 17000002 - if the async function was not called with await. 4214 * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. 4215 * @syscap SystemCapability.Test.UiTest 4216 * @since 9 4217 * @test 4218 */ 4219 /** 4220 * Get the title of this {@link UiWindow}. 4221 * 4222 * @returns { Promise<string> } the title value. 4223 * @throws { BusinessError } 17000002 - The async function is not called with await. 4224 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 4225 * @syscap SystemCapability.Test.UiTest 4226 * @atomicservice 4227 * @since 11 4228 * @test 4229 */ 4230 getTitle(): Promise<string>; 4231 4232 /** 4233 * Get the window mode of this {@link UiWindow}. 4234 * 4235 * @returns { Promise<WindowMode> } the {@link WindowMode} object 4236 * @throws { BusinessError } 17000002 - if the async function was not called with await. 4237 * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. 4238 * @syscap SystemCapability.Test.UiTest 4239 * @since 9 4240 * @test 4241 */ 4242 /** 4243 * Get the window mode of this {@link UiWindow}. 4244 * 4245 * @returns { Promise<WindowMode> } the {@link WindowMode} object 4246 * @throws { BusinessError } 17000002 - The async function is not called with await. 4247 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 4248 * @syscap SystemCapability.Test.UiTest 4249 * @atomicservice 4250 * @since 11 4251 * @test 4252 */ 4253 getWindowMode(): Promise<WindowMode>; 4254 4255 /** 4256 * Get the focused status of this {@link UiWindow}. 4257 * 4258 * @returns { Promise<boolean> } the focused status 4259 * @throws { BusinessError } 17000002 - if the async function was not called with await. 4260 * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. 4261 * @syscap SystemCapability.Test.UiTest 4262 * @since 9 4263 * @test 4264 */ 4265 /** 4266 * Get the focused status of this {@link UiWindow}. 4267 * 4268 * @returns { Promise<boolean> } the focused status 4269 * @throws { BusinessError } 17000002 - The async function is not called with await. 4270 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 4271 * @syscap SystemCapability.Test.UiTest 4272 * @atomicservice 4273 * @since 11 4274 * @test 4275 */ 4276 isFocused(): Promise<boolean>; 4277 4278 /** 4279 * Get the active status of this {@link UiWindow}. 4280 * 4281 * @returns { Promise<boolean> } the actived status 4282 * @throws { BusinessError } 17000002 - if the async function was not called with await. 4283 * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. 4284 * @syscap SystemCapability.Test.UiTest 4285 * @since 9 4286 * @test 4287 */ 4288 /** 4289 * Get the active status of this {@link UiWindow}. 4290 * 4291 * @returns { Promise<boolean> } the actived status 4292 * @throws { BusinessError } 17000002 - The async function is not called with await. 4293 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 4294 * @syscap SystemCapability.Test.UiTest 4295 * @since 11 4296 * @deprecated since 11 4297 * @useinstead ohos.UiTest.UiWindow#isActive 4298 * @test 4299 */ 4300 isActived(): Promise<boolean>; 4301 4302 /** 4303 * Set the focused status of this {@link UiWindow}. 4304 * 4305 * @returns { Promise<void> } 4306 * @throws { BusinessError } 17000002 - if the async function was not called with await. 4307 * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. 4308 * @syscap SystemCapability.Test.UiTest 4309 * @since 9 4310 * @test 4311 */ 4312 /** 4313 * Set the focused status of this {@link UiWindow}. 4314 * 4315 * @returns { Promise<void> } 4316 * @throws { BusinessError } 17000002 - The async function is not called with await. 4317 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 4318 * @syscap SystemCapability.Test.UiTest 4319 * @atomicservice 4320 * @since 11 4321 * @test 4322 */ 4323 focus(): Promise<void>; 4324 4325 /** 4326 * Move this {@link UiWindow} to the specified points. 4327 * 4328 * @param { number } x The x coordinate of destination. 4329 * @param { number } y The y coordinate of destination. 4330 * @returns { Promise<void> } 4331 * @throws { BusinessError } 401 - if the input parameters are invalid. 4332 * @throws { BusinessError } 17000002 - if the async function was not called with await. 4333 * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. 4334 * @throws { BusinessError } 17000005 - if the action is not supported on this window. 4335 * @syscap SystemCapability.Test.UiTest 4336 * @since 9 4337 * @test 4338 */ 4339 /** 4340 * Move this {@link UiWindow} to the specified points. 4341 * 4342 * @param { number } x - the x coordinate of destination, not less than 0. 4343 * @param { number } y - the y coordinate of destination, not less than 0. 4344 * @returns { Promise<void> } 4345 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 4346 * @throws { BusinessError } 17000002 - The async function is not called with await. 4347 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 4348 * @throws { BusinessError } 17000005 - This operation is not supported. 4349 * @syscap SystemCapability.Test.UiTest 4350 * @atomicservice 4351 * @since 11 4352 * @test 4353 */ 4354 moveTo(x: number, y: number): Promise<void>; 4355 4356 /** 4357 * Resize this {@link UiWindow} to the specified size for the specified direction. 4358 * 4359 * @param { number } wide The expected wide of the window after resizing. 4360 * @param { number } height The expected height of the window after resizing. 4361 * @param { ResizeDirection } direction The expected direction of the window after resizing. 4362 * @returns { Promise<void> } 4363 * @throws { BusinessError } 401 - if the input parameters are invalid. 4364 * @throws { BusinessError } 17000002 - if the async function was not called with await. 4365 * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. 4366 * @throws { BusinessError } 17000005 - if the action is not supported on this window. 4367 * @syscap SystemCapability.Test.UiTest 4368 * @since 9 4369 * @test 4370 */ 4371 /** 4372 * Resize this {@link UiWindow} to the specified size for the specified direction. 4373 * 4374 * @param { number } wide - the expected wide of the window after resizing. 4375 * @param { number } height - the expected height of the window after resizing. 4376 * @param { ResizeDirection } direction - the expected direction of the window after resizing. 4377 * @returns { Promise<void> } 4378 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 4379 * @throws { BusinessError } 17000002 - The async function is not called with await. 4380 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 4381 * @throws { BusinessError } 17000005 - This operation is not supported. 4382 * @syscap SystemCapability.Test.UiTest 4383 * @atomicservice 4384 * @since 11 4385 * @test 4386 */ 4387 resize(wide: number, height: number, direction: ResizeDirection): Promise<void>; 4388 4389 /** 4390 * Change this {@link UiWindow} into split screen mode. 4391 * 4392 * @returns { Promise<void> } 4393 * @throws { BusinessError } 17000002 - if the async function was not called with await. 4394 * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. 4395 * @throws { BusinessError } 17000005 - if the action is not supported on this window. 4396 * @syscap SystemCapability.Test.UiTest 4397 * @since 9 4398 * @test 4399 */ 4400 /** 4401 * Change this {@link UiWindow} into split screen mode. 4402 * 4403 * @returns { Promise<void> } 4404 * @throws { BusinessError } 17000002 - The async function is not called with await. 4405 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 4406 * @throws { BusinessError } 17000005 - This operation is not supported. 4407 * @syscap SystemCapability.Test.UiTest 4408 * @atomicservice 4409 * @since 11 4410 * @test 4411 */ 4412 split(): Promise<void>; 4413 4414 /** 4415 * Maximize this {@link UiWindow}. 4416 * 4417 * @returns { Promise<void> } 4418 * @throws { BusinessError } 17000002 - if the async function was not called with await. 4419 * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. 4420 * @throws { BusinessError } 17000005 - if the action is not supported on this window. 4421 * @syscap SystemCapability.Test.UiTest 4422 * @since 9 4423 * @test 4424 */ 4425 /** 4426 * Maximize this {@link UiWindow}. 4427 * 4428 * @returns { Promise<void> } 4429 * @throws { BusinessError } 17000002 - The async function is not called with await. 4430 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 4431 * @throws { BusinessError } 17000005 - This operation is not supported. 4432 * @syscap SystemCapability.Test.UiTest 4433 * @atomicservice 4434 * @since 11 4435 * @test 4436 */ 4437 maximize(): Promise<void>; 4438 4439 /** 4440 * Minimize this {@link UiWindow}. 4441 * 4442 * @returns { Promise<void> } 4443 * @throws { BusinessError } 17000002 - if the async function was not called with await. 4444 * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. 4445 * @throws { BusinessError } 17000005 - if the action is not supported on this window. 4446 * @syscap SystemCapability.Test.UiTest 4447 * @since 9 4448 * @test 4449 */ 4450 /** 4451 * Minimize this {@link UiWindow}. 4452 * 4453 * @returns { Promise<void> } 4454 * @throws { BusinessError } 17000002 - The async function is not called with await. 4455 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 4456 * @throws { BusinessError } 17000005 - This operation is not supported. 4457 * @syscap SystemCapability.Test.UiTest 4458 * @atomicservice 4459 * @since 11 4460 * @test 4461 */ 4462 minimize(): Promise<void>; 4463 4464 /** 4465 * Resume this {@link UiWindow}. 4466 * 4467 * @returns { Promise<void> } 4468 * @throws { BusinessError } 17000002 - if the async function was not called with await. 4469 * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. 4470 * @throws { BusinessError } 17000005 - if the action is not supported on this window. 4471 * @syscap SystemCapability.Test.UiTest 4472 * @since 9 4473 * @test 4474 */ 4475 /** 4476 * Resume this {@link UiWindow}. 4477 * 4478 * @returns { Promise<void> } 4479 * @throws { BusinessError } 17000002 - The async function is not called with await. 4480 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 4481 * @throws { BusinessError } 17000005 - This operation is not supported. 4482 * @syscap SystemCapability.Test.UiTest 4483 * @atomicservice 4484 * @since 11 4485 * @test 4486 */ 4487 resume(): Promise<void>; 4488 4489 /** 4490 * Close this {@link UiWindow}. 4491 * 4492 * @returns { Promise<void> } 4493 * @throws { BusinessError } 17000002 - if the async function was not called with await. 4494 * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. 4495 * @throws { BusinessError } 17000005 - if the action is not supported on this window. 4496 * @syscap SystemCapability.Test.UiTest 4497 * @since 9 4498 * @test 4499 */ 4500 /** 4501 * Close this {@link UiWindow}. 4502 * 4503 * @returns { Promise<void> } 4504 * @throws { BusinessError } 17000002 - The async function is not called with await. 4505 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 4506 * @throws { BusinessError } 17000005 - This operation is not supported. 4507 * @syscap SystemCapability.Test.UiTest 4508 * @atomicservice 4509 * @since 11 4510 * @test 4511 */ 4512 close(): Promise<void>; 4513 4514 /** 4515 * Get the active status of this {@link UiWindow}. 4516 * 4517 * @returns { Promise<boolean> } the active status. 4518 * @throws { BusinessError } 17000002 - The async function is not called with await. 4519 * @throws { BusinessError } 17000004 - The window or component is invisible or destroyed. 4520 * @syscap SystemCapability.Test.UiTest 4521 * @atomicservice 4522 * @since 11 4523 * @test 4524 */ 4525 isActive(): Promise<boolean>; 4526} 4527 4528/** 4529 * Represents a two-dimensional array of pointers on the device display, it's used to build a 4530 * multi-finger trace which can be injected with UiDriver. 4531 * 4532 * @syscap SystemCapability.Test.UiTest 4533 * @since 9 4534 * @test 4535 */ 4536/** 4537 * Represents a two-dimensional array of pointers on the device display, it's used to build a 4538 * multi-finger trace which can be injected with UiDriver. 4539 * 4540 * @syscap SystemCapability.Test.UiTest 4541 * @crossplatform 4542 * @atomicservice 4543 * @since 11 4544 * @test 4545 */ 4546declare class PointerMatrix { 4547 /** 4548 * Create an {@link PointerMatrix} object. 4549 * 4550 * @param { number } fingers The number of fingers. 4551 * @param { number } steps The number of steps of each finger trace. 4552 * @returns { PointerMatrix } the {@link PointerMatrix} object. 4553 * @throws { BusinessError } 401 - if the input parameters are invalid. 4554 * @syscap SystemCapability.Test.UiTest 4555 * @since 9 4556 * @test 4557 */ 4558 /** 4559 * Create an {@link PointerMatrix} object. 4560 * 4561 * @param { number } fingers - The number of fingers, ranges from 1 to 10. 4562 * @param { number } steps - The number of steps of each finger trace, ranges from 1 to 1000. 4563 * @returns { PointerMatrix } the {@link PointerMatrix} object. 4564 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 4565 * @syscap SystemCapability.Test.UiTest 4566 * @crossplatform 4567 * @atomicservice 4568 * @since 11 4569 * @test 4570 */ 4571 static create(fingers: number, steps: number): PointerMatrix; 4572 4573 /** 4574 * Set the point value of an element in the PointerMatrix. 4575 * 4576 * @param { number } finger The index of target finger to set. 4577 * @param { number } step The index of target step to set. 4578 * @param { Point } point The coordinate of target step to set. 4579 * @throws { BusinessError } 401 - if the input parameters are invalid. 4580 * @syscap SystemCapability.Test.UiTest 4581 * @since 9 4582 * @test 4583 */ 4584 /** 4585 * Set the point value of an element in the PointerMatrix. 4586 * 4587 * @param { number } finger - the index of target finger to set. 4588 * @param { number } step - the index of target step to set. 4589 * @param { Point } point - the coordinate of target step to set. 4590 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. 4591 * @syscap SystemCapability.Test.UiTest 4592 * @crossplatform 4593 * @atomicservice 4594 * @since 11 4595 * @test 4596 */ 4597 setPoint(finger: number, step: number, point: Point): void; 4598} 4599 4600/** 4601 * The static builder for building {@link By}object conveniently,usage example:BY.text('txt').enabled(true). 4602 * 4603 * @syscap SystemCapability.Test.UiTest 4604 * @since 8 4605 * @deprecated since 9 4606 * @useinstead ohos.uitest.ON 4607 * @test 4608 */ 4609declare const BY: By; 4610 4611/** 4612 * The static builder for building {@link On}object conveniently,usage example:ON.text('txt').enabled(true). 4613 * 4614 * @syscap SystemCapability.Test.UiTest 4615 * @since 9 4616 * @test 4617 */ 4618/** 4619 * The static builder for building {@link On}object conveniently,usage example:ON.text('txt').enabled(true). 4620 * 4621 * @syscap SystemCapability.Test.UiTest 4622 * @crossplatform 4623 * @atomicservice 4624 * @since 11 4625 * @test 4626 */ 4627declare const ON: On; 4628 4629export { 4630 UiComponent, 4631 UiDriver, 4632 Component, 4633 Driver, 4634 UiWindow, 4635 ON, 4636 On, 4637 BY, 4638 By, 4639 MatchPattern, 4640 DisplayRotation, 4641 ResizeDirection, 4642 WindowMode, 4643 Point, 4644 WindowFilter, 4645 Rect, 4646 PointerMatrix, 4647 UiDirection, 4648 MouseButton, 4649 UIElementInfo, 4650 UIEventObserver 4651}; 4652