提交 7355df60 编写于 作者: E ester.zhou

Update docs (18183)

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 2c914fe1
......@@ -74,7 +74,7 @@ As shown above, the **module.json5** file contains several tags.
| Name| Description| Data Type| Initial Value Allowed|
| -------- | -------- | -------- | -------- |
| name | Name of the module. The value is a string with a maximum of 31 bytes and must be unique in the entire application. Chinese characters are not allowed.| String| No|
| name | Name of the module. The value is a string with a maximum of 31 bytes and must be unique in the entire application. | String| No|
| type | Type of the module. The options are as follows:<br>- **entry**: main module of the application.<br>- **feature**: dynamic feature module of the application.<br>- **har**: static shared module.<br>- **shared**: dynamic shared module.| String| No|
| srcEntry | Code path corresponding to the module. The value is a string with a maximum of 127 bytes.| String| Yes (initial value: left empty)|
| description | Description of the module. The value is a string with a maximum of 255 bytes or a string resource index.| String| Yes (initial value: left empty)|
......@@ -226,74 +226,7 @@ The **metadata** tag represents the custom metadata of the HAP file. The tag val
## abilities
UIAbility configuration of the module, which is valid only for the current UIAbility component.
**By default, application icons cannot be hidden from the home screen in OpenHarmony.**
The OpenHarmony system imposes a strict rule on the presence of application icons. If no icon is configured in the HAP file of an application, the system uses the icon specified in the **app.json** file as the application icon and displays it on the home screen.
Touching this icon will direct the user to the application details screen in **Settings**, as shown in Figure 1.
To hide an application icon from the home screen, you must configure the **AllowAppDesktopIconHide** privilege. For details, see [Application Privilege Configuration Guide](../../device-dev/subsystems/subsys-app-privilege-config-guide.md).
**Objectives**:
This requirement on application icons is intended to prevent malicious applications from deliberately configuring no icon to block uninstallation attempts.
**Setting the application icon to be displayed on the home screen**:
Set **icon**, **label**, and **skills** under **abilities** in the **module.json5** file. In addition, make sure the **skills** configuration contains **ohos.want.action.home** and **entity.system.home**.
```
{
"module":{
...
"abilities": [{
"icon": "$media:icon",
"label": "Login",
"skills": [{
"actions": ["ohos.want.action.home"],
"entities": ["entity.system.home"],
"uris": []
}]
}],
...
}
}
```
**Display rules of application icons and labels on the home screen:**
* The HAP file contains UIAbility configuration.
* The application icon on the home screen is set under **abilities** in the **module.json5** file.
* The application does not have the privilege to hide its icon from the home screen.
* The application icon displayed on the home screen is the icon configured for the UIAbility.
* The application label displayed on the home screen is the label configured for the UIAbility. If no label is configured, the bundle name is returned.
* The name of the UIAbility is displayed.
* When the user touches the home screen icon, the home screen of the UIAbility is displayed.
* The application has the privilege to hide its icon from the home screen.
* The information about the application is not returned during home screen information query, and the icon of the application is not displayed on the home screen.
* The application icon on the home screen is not set under **abilities** in the **module.json5** file.
* The application does not have the privilege to hide its icon from the home screen.
* The application icon displayed on the home screen is the icon specified under **app**. (The **icon** field in the **app.json** file is mandatory.)
* The application label displayed on the home screen is the label specified under **app**. (The **label** field in the **app.json** file is mandatory.)
* Touching the application icon on the home screen will direct the user to the application details screen shown in Figure 1.
* The application has the privilege to hide its icon from the home screen.
* The information about the application is not returned during home screen information query, and the icon of the application is not displayed on the home screen.
* The HAP file does not contain UIAbility configuration.
* The application does not have the privilege to hide its icon from the home screen.
* The application icon displayed on the home screen is the icon specified under **app**. (The **icon** field in the **app.json** file is mandatory.)
* The application label displayed on the home screen is the label specified under **app**. (The **label** field in the **app.json** file is mandatory.)
* Touching the application icon on the home screen will direct the user to the application details screen shown in Figure 1.
* The application has the privilege to hide its icon from the home screen.
* The information about the application is not returned during home screen information query, and the icon of the application is not displayed on the home screen.<br><br>
**Figure 1** Application details screen
![Application details screen](figures/application_details.jpg)
The **abilities** tag represents the UIAbility configuration of the module, which is valid only for the current UIAbility component.
**Table 6** abilities
......@@ -325,6 +258,7 @@ Set **icon**, **label**, and **skills** under **abilities** in the **module.json
| minWindowHeight | Minimum window height supported by the UIAbility component, in vp. The minimum value is 0, and the value cannot be less than the minimum window height allowed by the platform or greater than the value of **maxWindowHeight**. For details about the window size, see [Constraints](../windowmanager/window-overview.md#constraints).| Number| Yes (initial value: minimum window height supported by the platform)|
| excludeFromMissions | Whether the UIAbility component is displayed in the recent task list.<br>- **true**: displayed in the recent task list.<br>- **false**: not displayed in the recent task list.<br>**NOTE**<br>This attribute applies only to system applications and does not take effect for third-party applications.| Boolean| Yes (initial value: **false**)|
| recoverable | Whether the application can be recovered to its previous state in case of a detected fault.<br>- **true**: The application can be recovered to its previous state in case of a detected fault.<br>- **false**: The application cannot be recovered to its previous state in case of a detected fault.| Boolean| Yes (initial value: **false**)|
| unclearableMission | Whether the UIAbility component is unclearable in the recent tasks list.<br>- **true**: The UIAbility component is unclearable in the recent tasks list.<br>- **false**: The UIAbility component is clearable in the recent tasks list.<br>**NOTE**<br>This attribute works only after the [AllowMissionNotCleared](../../device-dev/subsystems/subsys-app-privilege-config-guide.md) privilege is obtained.| Boolean| Yes (initial value: **false**)|
Example of the **abilities** structure:
......@@ -369,7 +303,8 @@ Example of the **abilities** structure:
"minWindowWidth": 1400,
"maxWindowHeight": 300,
"minWindowHeight": 200,
"excludeFromMissions": false
"excludeFromMissions": false,
"unclearableMission": false
}]
}
```
......@@ -441,12 +376,12 @@ The **extensionAbilities** tag represents the configuration of extensionAbilitie
| description | Description of the ExtensionAbility component. The value is a string with a maximum of 255 bytes or a resource index to the description.| String| Yes (initial value: left empty)|
| icon | Icon of the ExtensionAbility component. The value is an icon resource index. If **ExtensionAbility** is set to **MainElement** of the current module, this attribute is mandatory and its value must be unique in the application.| String| Yes (initial value: left empty)|
| label | Name of the ExtensionAbility component displayed to users. The value is a string resource index.<br>**NOTE**<br>If **ExtensionAbility** is set to **MainElement** of the current module, this attribute is mandatory and its value must be unique in the application.| String| No|
| type | Type of the ExtensionAbility component. The options are as follows:<br>- **form**: ExtensionAbility of a widget.<br>- **workScheduler**: ExtensionAbility of a Work Scheduler task.<br>- **inputMethod**: ExtensionAbility of an input method.<br>- **service**: service component running in the background.<br>- **accessibility**: ExtensionAbility of an accessibility feature.<br>- **dataShare**: ExtensionAbility for data sharing.<br>- **fileShare**: ExtensionAbility for file sharing.<br>- **staticSubscriber**: ExtensionAbility for static broadcast.<br>- **wallpaper**: ExtensionAbility of the wallpaper.<br>- **backup**: ExtensionAbility for data backup.<br>- **window**: ExtensionAbility of a window. This type of ExtensionAbility creates a window during startup for which you can develop the GUI. The window is then combined with other application windows through **abilityComponent**.<br>- **thumbnail**: ExtensionAbility for obtaining file thumbnails. You can provide thumbnails for files of customized file types.<br>- **preview**: ExtensionAbility for preview. This type of ExtensionAbility can parse the file and display it in a window. You can combine the window with other application windows.<br>- **print**: ExtensionAbility for the print framework.<br>- **driver**: ExtensionAbility for the driver framework.<br>**NOTE**<br>The **service** and **dataShare** types apply only to system applications and do not take effect for third-party applications.| String| No|
| type | Type of the ExtensionAbility component. The options are as follows:<br>- **form**: ExtensionAbility of a widget.<br>- **workScheduler**: ExtensionAbility of a Work Scheduler task.<br>- **inputMethod**: ExtensionAbility of an input method.<br>- **service**: service component running in the background.<br>- **accessibility**: ExtensionAbility of an accessibility feature.<br>- **dataShare**: ExtensionAbility for data sharing.<br>- **fileShare**: ExtensionAbility for file sharing.<br>- **staticSubscriber**: ExtensionAbility for static broadcast.<br>- **wallpaper**: ExtensionAbility of the wallpaper.<br>- **backup**: ExtensionAbility for data backup.<br>- **window**: ExtensionAbility of a window. This type of ExtensionAbility creates a window during startup for which you can develop the GUI. The window is then combined with other application windows through **abilityComponent**.<br>- **thumbnail**: ExtensionAbility for obtaining file thumbnails. You can provide thumbnails for files of customized file types.<br>- **preview**: ExtensionAbility for preview. This type of ExtensionAbility can parse the file and display it in a window. You can combine the window with other application windows.<br>- **print**: ExtensionAbility for the print framework.<br>- **push**: ExtensionAbility to be pushed.<br>- **driver**: ExtensionAbility for the driver framework.<br>**NOTE**<br>The **service** and **dataShare** types apply only to system applications and do not take effect for third-party applications.| String| No|
| permissions | Permissions required for another application to access the ExtensionAbility component.<br>The value is generally in the reverse domain name notation and contains a maximum of 255 bytes. It is an array of permission names predefined by the system or customized. The name of a customized permission must be the same as the **name** value of a permission defined in the **defPermissions** attribute.| String array| Yes (initial value: left empty)|
| uri | Data URI provided by the ExtensionAbility component. The value is a string with a maximum of 255 bytes, in the reverse domain name notation.<br>**NOTE**<br>This attribute is mandatory when the type of the ExtensionAbility component is set to **dataShare**.| String| Yes (initial value: left empty)|
|skills | Feature set of [wants](../application-models/want-overview.md) that can be received by the ExtensionAbility component.<br>Configuration rule: In an entry package, you can configure multiple **skills** attributes with the entry capability. (A **skills** attribute with the entry capability is the one that has **ohos.want.action.home** and **entity.system.home** configured.) The **label** and **icon** in the first ExtensionAbility that has **skills** configured are used as the **label** and **icon** of the entire OpenHarmony service/application.<br>**NOTE**<br>The **skills** attribute with the entry capability can be configured for the feature package of an OpenHarmony application, but not for an OpenHarmony service.| Array| Yes (initial value: left empty)|
| [metadata](#metadata)| Metadata of the ExtensionAbility component.| Object| Yes (initial value: left empty)|
| exported | Whether the ExtensionAbility component can be called by other applications. <br>- **true**: The ExtensionAbility component can be called by other applications.<br>- **false**: The UIAbility component cannot be called by other applications.| Boolean| Yes (initial value: **false**)|
| exported | Whether the ExtensionAbility component can be called by other applications. <br>- **true**: The ExtensionAbility component can be called by other applications.<br>- **false**: The ExtensionAbility component cannot be called by other applications.| Boolean| Yes (initial value: **false**)|
Example of the **extensionAbilities** structure:
......
......@@ -7,24 +7,24 @@ The **module** tag contains the HAP configuration.
| Name| Description| Data Type| Initial Value Allowed|
| -------- | -------- | -------- | -------- |
| mainAbility | Ability whose icon is displayed in the Service Center. When the resident process is started, the **mainAbility** is started.| String| Yes (initial value: left empty)|
| package | Package name of the HAP file, which must be unique in the application. The value is a string with a maximum of 127 bytes, in the reverse domain name notation. It is recommended that the value be the same as the project directory of the HAP file. | String| No|
| name | Class name of the HAP file. The value is a string with a maximum of 255 bytes, in the reverse domain name notation. The prefix must be the same as the **package** value specified for this module. Alternatively, the value can start with a period (.) followed by the class name.| String| Yes (initial value: left empty)|
| description | Description of the HAP file. The value is a string with a maximum of 255 bytes. If the value exceeds the limit or needs to support multiple languages, you can use a resource index to the description.| String| Yes (initial value: left empty)|
| supportedModes | Modes supported by the application. Currently, only the **drive** mode is defined. This attribute applies only to head units.| String array| Yes (initial value: left empty)|
|deviceType | Type of device on which the ability can run. The device types predefined in the system include **tablet**, **tv**, **car**, and **wearable**.| String array| No|
|distro | Distribution description of the HAP file.| Object| No|
|metaData | Metadata of the HAP file.| Object| Yes (initial value: left empty)|
| abilities | All abilities in the current module. The value is an array of objects, each of which represents an ability.| Object array| Yes (initial value: left empty)|
| js | A set of JS modules developed using ArkUI. The value is an array of objects, each of which represents a JS module.| Object array| Yes (initial value: left empty)|
| shortcuts | Shortcuts of the application. The value is an array of objects, each of which represents a shortcut object.| Object array| Yes (initial value: left empty)|
| reqPermissions | Permissions that the application requests from the system when it is running.| Object array| Yes (initial value: left empty)|
| colorMode | Color mode of the application. The options are as follows:<br>- **dark**: Resources applicable for the dark mode are used.<br>- **light**: Resources applicable for the light mode are used.<br>- **auto**: Resources are used based on the color mode of the system.| String| Yes (initial value: **auto**)|
| mainAbility | Ability whose icon is displayed in the Service Center. When the resident process is started, the **mainAbility** is started.| String| Yes (initial value: left empty)|
| package | Package name of the HAP file, which must be unique in the application. The value is a string with a maximum of 127 bytes, in the reverse domain name notation. It is recommended that the value be the same as the project directory of the HAP file. | String| No|
| name | Class name of the HAP file. The value is a string with a maximum of 255 bytes, in the reverse domain name notation. The prefix must be the same as the **package** value specified for this module. Alternatively, the value can start with a period (.) followed by the class name.| String| Yes (initial value: left empty)|
| description | Description of the HAP file. The value is a string with a maximum of 255 bytes. If the value exceeds the limit or needs to support multiple languages, you can use a resource index to the description.| String| Yes (initial value: left empty)|
| supportedModes | Modes supported by the application. Currently, only the **drive** mode is defined. This attribute applies only to head units.| String array| Yes (initial value: left empty)|
|deviceType | Type of device on which the ability can run. The device types predefined in the system include **tablet**, **tv**, **car**, and **wearable**.| String array| No|
|distro | Distribution description of the HAP file.| Object| No|
|metaData | Metadata of the HAP file.| Object| Yes (initial value: left empty)|
| abilities | All abilities in the current module. The value is an array of objects, each of which represents an ability.| Object array| Yes (initial value: left empty)|
| js | A set of JS modules developed using ArkUI. The value is an array of objects, each of which represents a JS module.| Object array| Yes (initial value: left empty)|
| shortcuts | Shortcuts of the application. The value is an array of objects, each of which represents a shortcut object.| Object array| Yes (initial value: left empty)|
| reqPermissions | Permissions that the application requests from the system when it is running.| Object array| Yes (initial value: left empty)|
| colorMode | Color mode of the application. The options are as follows:<br>- **dark**: Resources applicable for the dark mode are used.<br>- **light**: Resources applicable for the light mode are used.<br>- **auto**: Resources are used based on the color mode of the system.| String| Yes (initial value: **auto**)|
| distributionFilter | Distribution rules of the application. This attribute defines the rules for distributing HAP files based on different device specifications, so that precise matching can be performed when the application market distributes applications. Distribution rules cover three factors: API version, screen shape, and screen resolution. During distribution, a unique HAP is determined based on the mapping between **deviceType** and these three factors.| Object| Yes (initial value: left empty) Set this attribute when an application has multiple entry modules.|
|commonEvents | Information about the common event static subscriber, which must contain the subscriber name, required permissions, and list of the common events subscribed to. When a subscribed event is sent, the static subscriber is started. Unlike the dynamic subscriber, the static subscriber does not need to proactively call the common event subscription API in the service code, and may not be running when the common event is published.| Object array| Yes (initial value: left empty)|
| entryTheme | Keyword of an OpenHarmony internal theme. Set it to the resource index of the name.| String| Yes (initial value: left empty)|
|testRunner | Test runner configuration.| Object| Yes (initial value: left empty)|
|generateBuildHash |Whether the hash value of the HAP or HSP file is generated by the packaging tool. The hash value (if any) is used to determine whether the application needs to be updated when the system is updated in OTA mode but the value of [code](#internal-structure-of-the-apiversion-attribute) in **version** of the application remains unchanged.<br>**NOTE**<br>This tag applies only to system applications.|Boolean|Yes (initial value: **false**)|
|commonEvents | Information about the common event static subscriber, which must contain the subscriber name, required permissions, and list of the common events subscribed to. When a subscribed event is sent, the static subscriber is started. Unlike the dynamic subscriber, the static subscriber does not need to proactively call the common event subscription API in the service code, and may not be running when the common event is published.| Object array| Yes (initial value: left empty)|
| entryTheme | Keyword of an OpenHarmony internal theme. Set it to the resource index of the name.| String| Yes (initial value: left empty)|
|testRunner | Test runner configuration.| Object| Yes (initial value: left empty)|
|generateBuildHash | Whether the hash value of the HAP or HSP file is generated by the packaging tool. The hash value (if any) is used to determine whether the application needs to be updated when the system is updated in OTA mode but the value of [code](#internal-structure-of-the-apiversion-attribute) in **version** of the application remains unchanged.<br>**NOTE**<br>This tag applies only to system applications.|Boolean|Yes (initial value: **false**)|
Example of the **module** tag structure:
......@@ -129,7 +129,7 @@ Example of the **distro** attribute structure:
| Name| Description| Data Type| Initial Value Allowed|
| -------- | -------- | -------- | -------- |
| description | Description of the parameter. The value can be a string or a resource index to descriptions in multiple languages. The value can contain a maximum of 255 characters.| String| Yes (initial value: left empty)|
| description | Description of the parameter. The value can be a string or a resource index to descriptions in multiple languages. The value can contain a maximum of 255 bytes.| String| Yes (initial value: left empty)|
| name | Name of the parameter passed for calling the ability. The value can contain a maximum of 255 bytes.| String| No|
| type | Type of the parameter passed for calling the ability, for example, **Integer**.| String| No|
......@@ -139,8 +139,8 @@ Example of the **distro** attribute structure:
| Name| Description| Data Type| Initial Value Allowed|
| -------- | -------- | -------- | -------- |
| description | Description of the return value. The value can be a string or a resource index to descriptions in multiple languages. The value can contain a maximum of 255 characters.| String| Yes (initial value: left empty)|
| name | Name of the return value. The value can contain a maximum of 255 characters.| String| Yes (initial value: left empty)|
| description | Description of the return value. The value can be a string or a resource index to descriptions in multiple languages. The value can contain a maximum of 255 bytes.| String| Yes (initial value: left empty)|
| name | Name of the return value. The value can contain a maximum of 255 bytes.| String| Yes (initial value: left empty)|
| type | Type of the return value, for example, **Integer**.| String| No|
## Internal Structure of the customizeData Attribute
......@@ -191,21 +191,48 @@ Example of the metadata attribute:
## Internal Structure of the abilities Attribute
**By default, application icons cannot be hidden from the home screen in OpenHarmony.**
The OpenHarmony system imposes a strict rule on the presence of application icons. If no icon is configured in the HAP file of an application, the system creates a default icon for the application and displays it on the home screen.
**Table 8** Internal structure of the abilities attribute
Touching this icon will direct the user to the application details screen in **Settings**, as shown in Figure 1.
| Name| Description| Data Type| Initial Value Allowed|
| -------- | -------- | -------- | -------- |
| process | Name of the process running the application or ability. If the **process** attribute is configured in the **deviceConfig** tag, all abilities of the application run in this process. You can set the **process** attribute for a specific ability in the **abilities** attribute, so that the ability can run in the particular process. If this attribute is set to the name of the process running other applications, all these applications can run in the same process, provided they have the same unified user ID and the same signature. The value can contain a maximum of 31 bytes.| String| Yes (initial value: left empty)|
| name | Ability name. The value can be a reverse domain name, in the format of "*bundleName*.*className*", for example, **"com.example.myapplication.EntryAbility"**. Alternatively, the value can start with a period (.) followed by the class name, for example, **".EntryAbility"**.<br>The ability name must be unique in an application.<br/>**NOTE**<br/>If you use DevEco Studio to create the project, an ability named **EntryAbility** will be created by default, and its configuration will be saved to the **config.json** file. If you use other IDEs, the value of this attribute can be customized. The value can contain a maximum of 127 bytes. | String| No|
| description | Description of the ability. The value can be a string or a resource index to descriptions in multiple languages. The value can contain a maximum of 255 bytes.| String| Yes (initial value: left empty)|
| icon | Index to the ability icon file. Example value: **$media:ability_icon**. In the **skills** attribute of the ability, if the **actions** value contains **action.system.home** and the **entities** value contains **entity.system.home**, the icon of the ability is also used as the icon of the application. If multiple abilities address this condition, the icon of the first candidate ability is used as the application icon.<br>**NOTE**<br>The **icon** and **label** values of an application are visible to users. Ensure that at least one of them is different from any existing icons or labels. | String| Yes (initial value: left empty)|
| label | Ability name displayed to users. The value can be a name string or a resource index to names in multiple languages, for example, **$string:ability_label**. In the **skills** attribute of the ability, if the **actions** value contains **action.system.home** and the **entities** value contains **entity.system.home**, the label of the ability is also used as the label of the application. If multiple abilities address this condition, the label of the first candidate ability is used as the application label.<br>**NOTE**<br/>The **icon** and **label** values of an application are visible to users. Ensure that at least one of them is different from any existing icons or labels. The value can be a reference to a string defined in a resource file or a string enclosed in brackets ({}). The value can contain a maximum of 255 bytes. | String| Yes (initial value: left empty)|
| uri | Uniform Resource Identifier (URI) of the ability. The value can contain a maximum of 255 bytes.| String| Yes (No for abilities using the Data template)|
| launchType | Launch type of the ability. The value can be **standard** or **singleton**.<br>**standard**: Multiple **Ability** instances can be created during startup. Most abilities can use this type.<br>**singleton**: Only a single **Ability** instance can be created across all task stacks during startup. For example, a globally unique incoming call screen uses the singleton launch type. This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types.| String| Yes (initial value: **"singleton"**)|
| visible | Whether the ability can be called by other applications.<br>**true**: The ability can be called by other applications.<br>**false**: The ability cannot be called by other applications.| Boolean| Yes (initial value: **false**)|
| permissions | Permissions required for abilities of another application to call the current ability. The value is an array of permission names predefined by the system, generally in the reverse domain name notation. It contains a maximum of 255 bytes.| String array| Yes (initial value: left empty)|
|skills | Types of the **want** that can be accepted by the ability.| Object array| Yes (initial value: left empty)|
| deviceCapability | Device capabilities required to run the ability. The value is an array of up to 512 elements, each of which contains a maximum of 64 bytes.| String array| Yes (initial value: left empty)|
| metaData | Metadata.| Object| Yes (initial value: left empty)|
| type | Ability type. The options are as follows:<br>**page**: FA developed using the Page template to provide the capability of interacting with users.<br>**service**: PA developed using the Service template to provide the capability of running tasks in the background.<br>**data**: PA developed using the Data template to provide unified data access for external systems.<br>**CA**: ability that can be started by other applications as a window.| String| No|
| orientation | Display orientations of the ability. This attribute applies only to the ability using the Page template. The options are as follows:<br>**unspecified**: indicates that the system automatically determines the display orientation of the ability.<br>**landscape**: indicates the landscape orientation.<br>**portrait**: indicates the portrait orientation.<br>**followRecent**: indicates that the orientation follows the most recent application in the stack.| String| Yes (initial value: **"unspecified"**)|
| backgroundModes | Background service type of the ability. You can assign multiple background service types to a specific ability. This field applies only to the ability using the Service template. The options are as follows:<br>**dataTransfer**: service for downloading, backing up, sharing, or transferring data from the network or peer devices.<br>**audioPlayback**: audio playback service.<br>**audioRecording**: audio recording service.<br>**pictureInPicture**: picture in picture (PiP) and small-window video playback services.<br>**voip**: voice/video call and VoIP services.<br>**location**: location and navigation services.<br>**bluetoothInteraction**: Bluetooth scanning, connection, and transmission services.<br>**wifiInteraction**: WLAN scanning, connection, and transmission services.<br>**screenFetch**: screen recording and screenshot services.<br>**multiDeviceConnection**: multi-device interconnection service.| String array| Yes (initial value: left empty)|
| grantPermission | Whether permissions can be granted for any data in the ability.| Boolean| Yes (initial value: left empty)|
| readPermission | Permission required for reading data in the ability. This attribute applies only to the ability using the Data template. The value is a string with a maximum of 255 bytes. This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types.| String| Yes (initial value: left empty)|
| writePermission | Permission required for writing data to the ability. This attribute applies only to the ability using the Data template. The value is a string with a maximum of 255 bytes.| String| Yes (initial value: left empty)|
| configChanges | System configurations that the ability concerns. Upon any changes on the concerned configurations, the **onConfigurationUpdated** callback will be invoked to notify the ability. The options are as follows:<br>**mcc**: indicates that the mobile country code (MCC) of the IMSI is changed. Typical scenario: A SIM card is detected, and the MCC is updated.<br>**mnc**: indicates that the mobile network code (MNC) of the IMSI is changed. Typical scenario: A SIM card is detected, and the MNC is updated.<br>**locale**: indicates that the locale is changed. Typical scenario: The user selects a new language for the text display of the device.<br>**layout**: indicates that the screen layout is changed. Typical scenario: Currently, different display forms are all in the active state.<br>**fontSize**: indicates that font size is changed. Typical scenario: A new global font size is set.<br>**orientation**: indicates that the screen orientation is changed. Typical scenario: The user rotates the device.<br>**density**: indicates that the display density is changed. Typical scenario: The user may specify different display ratios, or different display forms are active at the same time.<br>**size**: indicates that the size of the display window is changed.<br>**smallestSize**: indicates that the length of the shorter side of the display window is changed.<br>**colorMode**: indicates that the color mode is changed.| String array| Yes (initial value: left empty)|
| mission | Task stack of the ability. This attribute applies only to the ability using the Page template. By default, all abilities in an application belong to the same task stack.| String| Yes (initial value: bundle name of the application)|
| targetAbility | Target ability that this ability alias points to. This attribute applies only to the ability using the Page template. If the **targetAbility** attribute is set, only **name**, **icon**, **label**, **visible**, **permissions**, and **skills** take effect in the current ability (ability alias). Other attributes use the values of the **targetAbility** attribute. The target ability must belong to the same application as the alias and must be declared in **config.json** ahead of the alias.| String| Yes (initial value: left empty, indicating that the current ability is not an alias)|
| formsEnabled | Whether the ability can provide widgets. This attribute applies only to the ability using the Page template.<br>**true**: This ability can provide widgets.<br>**false**: This ability cannot provide widgets.| Boolean| Yes (initial value: **false**)|
| forms | Information about the widgets used by the ability. This attribute is valid only when **formsEnabled** is set to **true**.| Object array| Yes (initial value: left empty)|
| srcLanguage | Programming language of the ability, which you can specify when creating the project.| String| Yes (initial value: **"js"**)|
| srcPath | JS code path corresponding to the ability. The value can contain a maximum of 127 bytes.| String| No|
| uriPermission | Application data that the ability can access. This attribute consists of the **mode** and **path** sub-attributes. This attribute is valid only for the capability of the type provider.| Object| Yes (initial value: left empty)|
| startWindowIcon | Index to the icon file of the ability startup page. This attribute applies only to the ability using the Page template. Example: **$media:icon**.| String| Yes (initial value: left empty)|
| startWindowBackground | Index to the background color resource file of the ability startup page. This attribute applies only to the ability using the Page template. Example: **$color:red**.| String| Yes (initial value: left empty)|
| removeMissionAfterTerminate | Whether to remove the relevant task from the task list after the ability is destroyed. This attribute applies only to the ability using the Page template. The value **true** means to remove the relevant task from the task list after the ability is destroyed, and **false** means the opposite.| Boolean| Yes (initial value: **false**)|
To hide an application icon from the home screen, you must configure the **AllowAppDesktopIconHide** privilege. For details, see [Application Privilege Configuration Guide](../../device-dev/subsystems/subsys-app-privilege-config-guide.md).
**Objectives**:
**By default, application icons cannot be hidden from the home screen in OpenHarmony.**
This requirement on application icons is intended to prevent malicious applications from deliberately configuring no icon to block uninstallation attempts.
OpenHarmony strictly controls applications without icons to prevent malicious applications from deliberately configuring no icon to block uninstall attempts.
**Setting the application icon to be displayed on the home screen**:
Set **icon**, **label**, and **skills** under **abilities** in the **config.json** file. In addition, make sure the **skills** configuration contains **ohos.want.action.home** and **entity.system.home**.
Set **icon**, **label**, and **skills** under **abilities** in the **config.json** file. Make sure the **skills** configuration contains **ohos.want.action.home** and **entity.system.home**.
```
{
......@@ -229,71 +256,34 @@ Set **icon**, **label**, and **skills** under **abilities** in the **config.json
}
```
**Display rules of application icons and labels on the home screen:**
To hide an application icon from the home screen, you must configure the **AllowAppDesktopIconHide** privilege. For details, see [Application Privilege Configuration Guide](../../device-dev/subsystems/subsys-app-privilege-config-guide.md). The rules for displaying the entry icon and entry label are as follows:
* The HAP file contains Page ability configuration.
* The application icon on the home screen is set under **abilities** in the **config.json** file.
* The application does not have the privilege to hide its icon from the home screen.
* The application icon displayed on the home screen is the icon configured for the Page ability.
* The application label displayed on the home screen is the label configured for the Page ability. If no label is configured, the bundle name is returned.
* The name of the Page ability is displayed.
* When the user touches the home screen icon, the home screen of the Page ability is displayed.
* The system uses the icon configured for the Page ability as the entry icon and displays it on the home screen. Touching this icon will direct the user to the home page of the Page ability.
* The system uses the label configured for the PageAbility as the entry label and displays it on the home screen. If no label is configured, the bundle name is returned.
* The application has the privilege to hide its icon from the home screen.
* The information about the application is not returned during home screen information query, and the icon of the application is not displayed on the home screen.
* The application information is not returned when the home screen queries the information, and the entry icon and label of the application are not displayed on the home screen.
* The application icon on the home screen is not set under **abilities** in the **config.json** file.
* The application does not have the privilege to hide its icon from the home screen.
* The application icon displayed on the home screen is the default icon.
* The application label displayed on the home screen is the bundle name of the application.
* Touching the application icon on the home screen will direct the user to the application details screen shown in Figure 1.
* The system uses the default icon as the entry icon and displays it on the home screen. Touching this icon will direct the user to the application details screen under application management, as shown in Figure 1.
* The system uses the bundle name of the application as the entry label and displays it on the home screen.
* The application has the privilege to hide its icon from the home screen.
* The information about the application is not returned during home screen information query, and the icon of the application is not displayed on the home screen.
* The application information is not returned when the home screen queries the information, and the entry icon and label of the application are not displayed on the home screen.
* The HAP file does not contain Page ability configuration.
* The application does not have the privilege to hide its icon from the home screen.
* The application icon displayed on the home screen is the default icon.
* The application label displayed on the home screen is the bundle name of the application.
* Touching the application icon on the home screen will direct the user to the application details screen shown in Figure 1.
* The system uses the default icon as the entry icon and displays it on the home screen. Touching this icon will direct the user to the application details screen under application management, as shown in Figure 1.
* The system uses the bundle name of the application as the entry label and displays it on the home screen.
* The application has the privilege to hide its icon from the home screen.
* The information about the application is not returned during home screen information query, and the icon of the application is not displayed on the home screen.
Note: The label displayed on the application details screen may be different from that displayed on the home screen. For non-Page abilities, it is the entry label set (if any).<br><br>
* The application information is not returned when the home screen queries the information, and the entry icon and label of the application are not displayed on the home screen.
**Figure 1** Application details screen
![Application details screen](figures/application_details.jpg)
**Table 8** Internal structure of the abilities attribute
| Name| Description| Data Type| Initial Value Allowed|
| -------- | -------- | -------- | -------- |
| process | Name of the process running the application or ability. If the **process** attribute is configured in the **deviceConfig** tag, all abilities of the application run in this process. You can set the **process** attribute for a specific ability in the **abilities** attribute, so that the ability can run in the particular process. If this attribute is set to the name of the process running other applications, all these applications can run in the same process, provided they have the same unified user ID and the same signature. The value can contain a maximum of 31 bytes.| String| Yes (initial value: left empty)|
| name | Ability name. The value can be a reverse domain name, in the format of "*bundleName*.*className*", for example, **"com.example.myapplication.EntryAbility"**. Alternatively, the value can start with a period (.) followed by the class name, for example, **".EntryAbility"**.<br>The ability name must be unique in an application. Note: If you use DevEco Studio to create the project, an ability named **EntryAbility** will be created by default, and its configuration will be saved to the **config.json** file. If you use other IDEs, the value of this attribute can be customized. The value can contain a maximum of 127 bytes.| String| No|
| description | Description of the ability. The value can be a string or a resource index to descriptions in multiple languages. The value can contain a maximum of 255 bytes.| String| Yes (initial value: left empty)|
| icon | Index to the ability icon file. Example value: **$media:ability_icon**. In the **skills** attribute of the ability, if the **actions** value contains **action.system.home** and the **entities** value contains **entity.system.home**, the icon of the ability is also used as the icon of the application. If multiple abilities address this condition, the icon of the first candidate ability is used as the application icon.<br>Note: The **icon** and **label** values of an application are visible to users. Ensure that at least one of them is different from any existing icons or labels.| String| Yes (initial value: left empty)|
| label | Ability name displayed to users. The value can be a name string or a resource index to names in multiple languages, for example, **$string:ability_label**. In the **skills** attribute of the ability, if the **actions** value contains **action.system.home** and the **entities** value contains **entity.system.home**, the label of the ability is also used as the label of the application. If multiple abilities address this condition, the label of the first candidate ability is used as the application label.<br>Note: The **icon** and **label** values of an application are visible to users. Ensure that at least one of them is different from any existing icons or labels. The value can be a reference to a string defined in a resource file or a string enclosed in brackets ({}). The value can contain a maximum of 255 characters.| String| Yes (initial value: left empty)|
| uri | Uniform Resource Identifier (URI) of the ability. The value can contain a maximum of 255 bytes.| String| Yes (No for abilities using the Data template)|
| launchType | Launch type of the ability. The value can be **standard** or **singleton**.<br>**standard**: Multiple **Ability** instances can be created during startup. Most abilities can use this type.<br>**singleton**: Only a single **Ability** instance can be created across all task stacks during startup. For example, a globally unique incoming call screen uses the singleton launch type. This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types.| String| Yes (initial value: **"singleton"**)|
| visible | Whether the ability can be called by other applications.<br>**true**: The ability can be called by other applications.<br>**false**: The ability cannot be called by other applications.| Boolean| Yes (initial value: **false**)|
| permissions | Permissions required for abilities of another application to call the current ability. The value is an array of permission names predefined by the system, generally in the reverse domain name notation. It contains a maximum of 255 bytes.| String array| Yes (initial value: left empty)|
|skills | Types of the **want** that can be accepted by the ability.| Object array| Yes (initial value: left empty)|
| deviceCapability | Device capabilities required to run the ability. The value is an array of up to 512 elements, each of which contains a maximum of 64 bytes.| String array| Yes (initial value: left empty)|
| metaData | Metadata.| Object| Yes (initial value: left empty)|
| type | Ability type. The options are as follows:<br>**page**: FA developed using the Page template to provide the capability of interacting with users.<br>**service**: PA developed using the Service template to provide the capability of running tasks in the background.<br>**data**: PA developed using the Data template to provide unified data access for external systems.<br>**CA**: ability that can be started by other applications as a window.| String| No|
| orientation | Display orientations of the ability. This attribute applies only to the ability using the Page template. The options are as follows:<br>**unspecified**: indicates that the system automatically determines the display orientation of the ability.<br>**landscape**: indicates the landscape orientation.<br>**portrait**: indicates the portrait orientation.<br>**followRecent**: indicates that the orientation follows the most recent application in the stack.| String| Yes (initial value: **"unspecified"**)|
| backgroundModes | Background service type of the ability. You can assign multiple background service types to a specific ability. This field applies only to the ability using the Service template. The options are as follows:<br>**dataTransfer**: service for downloading, backing up, sharing, or transferring data from the network or peer devices.<br>**audioPlayback**: audio playback service.<br>**audioRecording**: audio recording service.<br>**pictureInPicture**: picture in picture (PiP) and small-window video playback services.<br>**voip**: voice/video call and VoIP services.<br>**location**: location and navigation services.<br>**bluetoothInteraction**: Bluetooth scanning, connection, and transmission services.<br>**wifiInteraction**: WLAN scanning, connection, and transmission services.<br>**screenFetch**: screen recording and screenshot services.<br>**multiDeviceConnection**: multi-device interconnection service.| String array| Yes (initial value: left empty)|
| grantPermission | Whether permissions can be granted for any data in the ability.| Boolean| Yes (initial value: left empty)|
| readPermission | Permission required for reading data in the ability. This attribute applies only to the ability using the Data template. The value is a string with a maximum of 255 bytes. This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types.| String| Yes (initial value: left empty)|
| writePermission | Permission required for writing data to the ability. This attribute applies only to the ability using the Data template. The value is a string with a maximum of 255 bytes.| String| Yes (initial value: left empty)|
| configChanges | System configurations that the ability concerns. Upon any changes on the concerned configurations, the **onConfigurationUpdated** callback will be invoked to notify the ability. The options are as follows:<br>**mcc**: indicates that the mobile country code (MCC) of the IMSI is changed. Typical scenario: A SIM card is detected, and the MCC is updated.<br>**mnc**: indicates that the mobile network code (MNC) of the IMSI is changed. Typical scenario: A SIM card is detected, and the MNC is updated.<br>**locale**: indicates that the locale is changed. Typical scenario: The user selects a new language for the text display of the device.<br>**layout**: indicates that the screen layout is changed. Typical scenario: Currently, different display forms are all in the active state.<br>**fontSize**: indicates that font size is changed. Typical scenario: A new global font size is set.<br>**orientation**: indicates that the screen orientation is changed. Typical scenario: The user rotates the device.<br>**density**: indicates that the display density is changed. Typical scenario: The user may specify different display ratios, or different display forms are active at the same time.<br>**size**: indicates that the size of the display window is changed.<br>**smallestSize**: indicates that the length of the shorter side of the display window is changed.<br>**colorMode**: indicates that the color mode is changed.| String array| Yes (initial value: left empty)|
| mission | Task stack of the ability. This attribute applies only to the ability using the Page template. By default, all abilities in an application belong to the same task stack.| String| Yes (initial value: bundle name of the application)|
| targetAbility | Target ability that this ability alias points to. This attribute applies only to the ability using the Page template. If the **targetAbility** attribute is set, only **name**, **icon**, **label**, **visible**, **permissions**, and **skills** take effect in the current ability (ability alias). Other attributes use the values of the **targetAbility** attribute. The target ability must belong to the same application as the alias and must be declared in **config.json** ahead of the alias.| String| Yes (initial value: left empty, indicating that the current ability is not an alias)|
| formsEnabled | Whether the ability can provide widgets. This attribute applies only to the ability using the Page template.<br>**true**: This ability can provide widgets.<br>**false**: This ability cannot provide widgets.| Boolean| Yes (initial value: **false**)|
| forms | Information about the widgets used by the ability. This attribute is valid only when **formsEnabled** is set to **true**.| Object array| Yes (initial value: left empty)|
| srcLanguage | Programming language of the ability, which you can specify when creating the project.| String| Yes (initial value: **"js"**)|
| srcPath | JS code path corresponding to the ability. The value can contain a maximum of 127 bytes.| String| No|
| uriPermission | Application data that the ability can access. This attribute consists of the **mode** and **path** sub-attributes. This attribute is valid only for the capability of the type provider.| Object| Yes (initial value: left empty)|
| startWindowIcon | Index to the icon file of the ability startup page. This attribute applies only to the ability using the Page template. Example: **$media:icon**.| String| Yes (initial value: left empty)|
| startWindowBackground | Index to the background color resource file of the ability startup page. This attribute applies only to the ability using the Page template. Example: **$color:red**.| String| Yes (initial value: left empty)|
| removeMissionAfterTerminate | Whether to remove the relevant task from the task list after the ability is destroyed. This attribute applies only to the ability using the Page template. The value **true** means to remove the relevant task from the task list after the ability is destroyed, and **false** means the opposite.| Boolean| Yes (initial value: **false**)|
> **NOTE**
>
> The label displayed on the application details screen may be different from the one displayed on the home screen. These two are the same if the entry icon and label are configured for the non-Page ability.
## Internal Structure of the uriPermission Attribute
......@@ -318,7 +308,7 @@ Example of the **abilities** attribute structure:
"label": "$string:example",
"launchType": "standard",
"orientation": "unspecified",
"permissions": [],
"permissions": [],
"visible": true,
"skills": [
{
......@@ -331,11 +321,11 @@ Example of the **abilities** attribute structure:
}
],
"configChanges": [
"locale",
"layout",
"fontSize",
"locale",
"layout",
"fontSize",
"orientation"
],
],
"type": "page",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:red",
......@@ -381,7 +371,7 @@ Example of the **abilities** attribute structure:
| -------- | -------- | -------- | -------- |
| actions | Actions of the **want** that can be accepted by the ability. Generally, the value is an **action** value predefined in the system.| String array| Yes (initial value: left empty)|
| entities | Entities of the **want** that can be accepted by the ability, such as video and home applications.| String array| Yes (initial value: left empty)|
| uris | Data specifications to be added to the want filter. The specification is a data type (using the **mimeType** attribute), a URI, or both a data type and a URI.<br>The URI is specified by separate attributes of each part: &lt;scheme&gt;://&lt;host&gt;:&lt;port&gt;[&lt;path&gt;\|&lt;pathStartWith&gt;\|&lt;pathRegex&gt;]. <br>**scheme** is mandatory when the specification is of the URI type and is optional when the specification is a data type. | Object array| Yes (initial value: left empty)|
| uris | Data specifications to be added to the want filter. The specification is a data type (using the **mimeType** attribute), a URI, or both a data type and a URI.<br>The URI is specified by separate attributes of each part: &lt;scheme&gt;://&lt;host&gt;:&lt;port&gt;[&lt;path&gt;\|&lt;pathStartWith&gt;\|&lt;pathRegex&gt;]. <br>**scheme** is mandatory when the specification is of the URI type and is optional when the specification is a data type.| Object array| Yes (initial value: left empty)|
## Internal Structure of the uris Attribute
......@@ -405,7 +395,7 @@ Example of the **skills** attribute structure:
{
"actions": [
"action.system.home"
],
],
"entities": [
"entity.system.home"
],
......@@ -477,11 +467,11 @@ Example of the **js** attribute structure:
```json
"js": [
{
"name": "default",
"pages": [
"name": "default",
"pages": [
"pages/index/index",
"pages/detail/detail"
],
],
"window": {
"designWidth": 720,
"autoDesignWidth": false
......
......@@ -20,7 +20,7 @@ This module provides the following functions:
## Modules to Import
```js
import {UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix, UiDirection, MouseButton} from '@ohos.UiTest';
import {UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix, UiDirection, MouseButton, UIElementInfo, UIEventObserver} from '@ohos.UiTest';
```
## MatchPattern
......@@ -141,10 +141,31 @@ Describes the injected simulated mouse button.
| MOUSE_BUTTON_RIGHT | 1 | Right button on the mouse. |
| MOUSE_BUTTON_MIDDLE | 2 | Middle button on the mouse.|
## UIElementInfo<sup>10+</sup>
Provides information about the UI event.
**System capability**: SystemCapability.Test.UiTest
| Name | Type | Readable| Writable| Description |
| ---------- | ------ | ---- | ---- | --------------------- |
| bundleName | string | Yes | No | Bundle name of the home application. |
| type | string | Yes | No | Component or window type. |
| text | string | Yes | No | Text information of the component or window.|
## On<sup>9+</sup>
Since API version 9, the UiTest framework provides a wide range of UI component feature description APIs in the **On** class to filter and match components.
The API capabilities provided by the **On** class exhibit the following features: 1. Allow one or more attributes as the match conditions. For example, you can specify both the **text** and **id** attributes to find the target component. <br>2. Provide multiple match patterns for component attributes. <br>3. Support absolute positioning and relative positioning for components. APIs such as [ON.isBefore](#isbefore9) and [ON.isAfter](#isafter9) can be used to specify the features of adjacent components to assist positioning. <br>All APIs provided in the **On** class are synchronous. You are advised to use the static constructor **ON** to create an **On** object in chain mode.
The API capabilities provided by the **On** class exhibit the following features:
- Allow one or more attributes as the match conditions. For example, you can specify both the **text** and **id** attributes to find the target component.
- Provide multiple match patterns for component attributes.
- Support absolute positioning and relative positioning for components. APIs such as [ON.isBefore](#isbefore9) and [ON.isAfter](#isafter9) can be used to specify the features of adjacent components to assist positioning.
All APIs provided in the **On** class are synchronous. You are advised to use the static constructor **ON** to create an **On** object in chain mode.
```js
ON.text('123').type('button');
......@@ -244,7 +265,7 @@ Specifies the clickable status attribute of the target component.
| Name| Type | Mandatory| Description |
| ------ | ------- | ---- | ------------------------------------------------------------ |
| b | boolean | No | Clickable status of the target component.<br>**true**: clickable.<br>**false**: not clickable.<br>Default value: **true** |
| b | boolean | No | Clickable status of the target component.<br>**true**: clickable.<br>**false**: not clickable.<br> Default value: **true**|
**Return value**
......@@ -270,7 +291,7 @@ Specifies the long-clickable status attribute of the target component.
| Name| Type | Mandatory| Description |
| ------ | ------- | ---- | ------------------------------------------------------------ |
| b | boolean | No | Long-clickable status of the target component.<br>**true**: long-clickable.<br>**false**: not long-clickable.<br>Default value: **true** |
| b | boolean | No | Long-clickable status of the target component.<br>**true**: long-clickable.<br>**false**: not long-clickable.<br> Default value: **true**|
**Return value**
......@@ -297,7 +318,7 @@ Specifies the scrollable status attribute of the target component.
| Name| Type | Mandatory| Description |
| ------ | ------- | ---- | ----------------------------------------------------------- |
| b | boolean | No | Scrollable status of the target component.<br>**true**: scrollable.<br>**false**: not scrollable.<br>Default value: **true** |
| b | boolean | No | Scrollable status of the target component.<br>**true**: scrollable.<br>**false**: not scrollable.<br> Default value: **true**|
**Return value**
......@@ -323,7 +344,7 @@ Specifies the enabled status attribute of the target component.
| Name| Type | Mandatory| Description |
| ------ | ------- | ---- | --------------------------------------------------------- |
| b | boolean | No | Enabled status of the target component.<br>**true**: enabled.<br>**false**: not enabled.<br>Default value: **true** |
| b | boolean | No | Enabled status of the target component.<br>**true**: enabled.<br>**false**: not enabled.<br> Default value: **true**|
**Return value**
......@@ -349,7 +370,7 @@ Specifies the focused status attribute of the target component.
| Name| Type | Mandatory| Description |
| ------ | ------- | ---- | ----------------------------------------------------- |
| b | boolean | No | Focused status of the target component.<br>**true**: focused.<br>**false**: not focused.<br>Default value: **true** |
| b | boolean | No | Focused status of the target component.<br>**true**: focused.<br>**false**: not focused.<br> Default value: **true**|
**Return value**
......@@ -375,7 +396,7 @@ Specifies the selected status attribute of the target component.
| Name| Type | Mandatory| Description |
| ------ | ------- | ---- | ------------------------------------------------------------ |
| b | boolean | No | Selected status of the target component.<br>**true**: selected.<br>**false**: not selected.<br>Default value: **true** |
| b | boolean | No | Selected status of the target component.<br>**true**: selected.<br>**false**: not selected.<br> Default value: **true**|
**Return value**
......@@ -401,7 +422,7 @@ Specifies the checked status attribute of the target component.
| Name| Type | Mandatory| Description |
| ------ | ------- | ---- | ------------------------------------------------------------ |
| b | boolean | No | Checked status of the target component.<br>**true**: checked.<br>**false**: not checked.<br>Default value: **false** |
| b | boolean | No | Checked status of the target component.<br>**true**: checked.<br>**false**: not checked.<br> Default value: **false**|
**Return value**
......@@ -427,7 +448,7 @@ Specifies the checkable status attribute of the target component.
| Name| Type | Mandatory| Description |
| ------ | ------- | ---- | ------------------------------------------------------------ |
| b | boolean | No | Checkable status of the target component.<br>**true**: checkable.<br>**false**: not checkable.<br>Default value: **false** |
| b | boolean | No | Checkable status of the target component.<br>**true**: checkable.<br>**false**: not checkable.<br> Default value: **false**|
**Return value**
......@@ -523,7 +544,7 @@ let on = ON.within(ON.type('List')); // Create an On object using the static con
inWindow(bundleName: string): On;
Specifies that the target component is within the given application window.
Specifies that the target component is located within the given application window.
**System capability**: SystemCapability.Test.UiTest
......@@ -542,12 +563,13 @@ Specifies that the target component is within the given application window.
**Example**
```js
let on = ON.inWindow('com.uitestScene.acts'); // Create an On object using the static constructor ON, specifying that the target component is within the given application window.
let on = ON.inWindow('com.uitestScene.acts'); // Create an On object using the static constructor ON, specifying that the target component is located within the given application window.
```
## Component<sup>9+</sup>
In **UiTest** of API version 9, the **Component** class represents a component on the UI and provides APIs for obtaining component attributes, clicking a component, scrolling to search for a component, and text injection.
Represents a component on the UI and provides APIs for obtaining component attributes, clicking a component, scrolling to search for a component, and text injection.
All APIs provided in this class use a promise to return the result and must be invoked using **await**.
### click<sup>9+</sup>
......@@ -564,8 +586,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the component is invisible or destroyed. |
**Example**
......@@ -591,8 +613,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the component is invisible or destroyed. |
**Example**
......@@ -618,8 +640,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the component is invisible or destroyed. |
**Example**
......@@ -651,8 +673,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the component is invisible or destroyed. |
**Example**
......@@ -684,8 +706,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the component is invisible or destroyed. |
**Example**
......@@ -717,8 +739,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the component is invisible or destroyed. |
**Example**
......@@ -750,8 +772,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the component is invisible or destroyed. |
**Example**
......@@ -783,8 +805,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the component is invisible or destroyed. |
**Example**
......@@ -816,8 +838,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the component is invisible or destroyed. |
**Example**
......@@ -853,8 +875,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the component is invisible or destroyed. |
**Example**
......@@ -890,8 +912,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the component is invisible or destroyed. |
**Example**
......@@ -899,7 +921,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
async function demo() {
let driver = Driver.create();
let checkBox = await driver.findComponent(ON.type('Checkbox'));
if(await checkBox.isChecked) {
if(await checkBox.isChecked()) {
console.info('This checkBox is checked');
} else {
console.info('This checkBox is not checked');
......@@ -927,8 +949,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the component is invisible or destroyed. |
**Example**
......@@ -936,7 +958,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
async function demo() {
let driver = Driver.create();
let checkBox = await driver.findComponent(ON.type('Checkbox'));
if(await checkBox.isCheckable) {
if(await checkBox.isCheckable()) {
console.info('This checkBox is checkable');
} else {
console.info('This checkBox is not checkable');
......@@ -964,8 +986,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the component is invisible or destroyed. |
**Example**
......@@ -1002,8 +1024,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the component is invisible or destroyed. |
**Example**
......@@ -1040,8 +1062,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the component is invisible or destroyed. |
**Example**
......@@ -1077,8 +1099,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the component is invisible or destroyed. |
**Example**
......@@ -1114,8 +1136,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the component is invisible or destroyed. |
**Example**
......@@ -1139,8 +1161,8 @@ Clears text in this component. This API is applicable to text boxes.
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the component is invisible or destroyed. |
**Example**
......@@ -1178,8 +1200,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the component is invisible or destroyed. |
**Example**
......@@ -1211,8 +1233,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the component is invisible or destroyed. |
**Example**
......@@ -1244,8 +1266,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the component is invisible or destroyed. |
**Example**
......@@ -1277,8 +1299,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the component is invisible or destroyed. |
**Example**
......@@ -1311,8 +1333,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the component is invisible or destroyed. |
**Example**
......@@ -1344,8 +1366,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the component is invisible or destroyed. |
**Example**
......@@ -1360,6 +1382,7 @@ async function demo() {
## Driver<sup>9+</sup>
The **Driver** class is the main entry to the UiTest framework. It provides APIs for features such as component matching/search, key injection, coordinate clicking/sliding, and screenshot.
All APIs provided by this class, except for **Driver.create()**, use a promise to return the result and must be invoked using **await**.
### create<sup>9+</sup>
......@@ -1382,7 +1405,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ------------------ |
| 17000001 | Initialize failed. |
| 17000001 | if the test framework failed to initialize. |
**Example**
......@@ -1412,7 +1435,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -1449,7 +1472,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -1486,7 +1509,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -1523,7 +1546,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -1561,7 +1584,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -1592,8 +1615,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000003 | Component existence assertion failed. |
| 17000002 | if the async function was not called with await. |
| 17000003 | if the assertion failed. |
**Example**
......@@ -1618,7 +1641,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -1649,7 +1672,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -1682,7 +1705,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -1715,7 +1738,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -1747,7 +1770,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -1779,7 +1802,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -1814,7 +1837,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -1849,7 +1872,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -1886,7 +1909,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -1917,7 +1940,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -1948,7 +1971,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -1979,7 +2002,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -2010,7 +2033,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -2041,7 +2064,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -2066,7 +2089,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -2091,7 +2114,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -2129,7 +2152,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -2163,7 +2186,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -2201,7 +2224,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -2221,7 +2244,7 @@ async function demo() {
### fling<sup>10+</sup>
fling(direction: UiDirection, speed: number): Promise<void>;
fling(direction: UiDirection, speed: number): Promise\<void>;
Simulates a fling operation on the screen, in the specified direction and speed.
......@@ -2240,7 +2263,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -2253,7 +2276,7 @@ async function demo() {
### screenCapture<sup>10+</sup>
screenCapture(savePath: string, rect?: Rect): Promise<boolean>;
screenCapture(savePath: string, rect?: Rect): Promise\<boolean>;
Captures the specified area of the current screen and saves the captured screenshot as a PNG image to the specified path.
......@@ -2278,7 +2301,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -2291,7 +2314,7 @@ async function demo() {
### mouseClick<sup>10+</sup>
mouseClick(p: Point, btnId: MouseButton, key1?: number, key2?: number): Promise<void>;
mouseClick(p: Point, btnId: MouseButton, key1?: number, key2?: number): Promise\<void>;
Injects a mouse click at the specified coordinates, with the optional key or key combination. For example, if the value of **key1** is **2072**, the **Ctrl** button is pressed with the mouse click.
......@@ -2302,8 +2325,8 @@ Injects a mouse click at the specified coordinates, with the optional key or key
| Name| Type | Mandatory| Description |
| ------ | ----------------------------- | ---- | ------------------- |
| p | [Point](#point9) | Yes | Coordinates of the mouse click. |
| btnId | [MouseButton](#mousebutton10) | Yes | Mouse button pressesd. |
| key1 | number | Yes | The first key value.|
| btnId | [MouseButton](#mousebutton10) | Yes | Mouse button pressed. |
| key1 | number | No | The first key value.|
| key2 | number | No | The second key value.|
**Error codes**
......@@ -2312,7 +2335,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -2325,7 +2348,7 @@ async function demo() {
### mouseScroll<sup>10+</sup>
mouseScroll(p: Point, down: boolean, d: number, key1?: number, key2?: number): Promise<void>;
mouseScroll(p: Point, down: boolean, d: number, key1?: number, key2?: number): Promise\<void>;
Injects a mouse scroll action at the specified coordinates, with the optional key or key combination. For example, if the value of **key1** is **2072**, the **Ctrl** button is pressed with mouse scrolling.
......@@ -2338,7 +2361,7 @@ Injects a mouse scroll action at the specified coordinates, with the optional ke
| p | [Point](#point9) | Yes | Coordinates of the mouse click. |
| down | boolean | Yes | Whether the scroll wheel slides downward. |
| d | number | Yes | Number of grids by which the scroll wheel slides. Sliding by one grid means a 120-pixel offset of the target point.|
| key1 | number | Yes | The first key value. |
| key1 | number | No | The first key value. |
| key2 | number | No | The second key value. |
**Error codes**
......@@ -2347,7 +2370,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -2360,7 +2383,7 @@ async function demo() {
### mouseMoveTo<sup>10+</sup>
mouseMoveTo(p: Point): Promise<void>;
mouseMoveTo(p: Point): Promise\<void>;
Moves the cursor to the target point.
......@@ -2378,7 +2401,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000002 | if the async function was not called with await. |
**Example**
......@@ -2389,6 +2412,37 @@ async function demo() {
}
```
### createUIEventObserver<sup>10+</sup>
createUIEventObserver(): UIEventObserver;
Creates a UI event listener.
**System capability**: SystemCapability.Test.UiTest
**Return value**
| Type | Description |
| ----------------------------------------------- | ------------------------------------- |
| Promise\<[UIEventObserver](#uieventobserver10)> | Promise used to return the target window.|
**Error codes**
For details about the error codes, see [UiTest Error Codes](../errorcodes/errorcode-uitest.md).
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | if the async function was not called with await. |
**Example**
```js
async function demo() {
let driver = Driver.create();
let obeserver = await driver.createUiEventObserve();
}
```
## PointerMatrix<sup>9+</sup>
Implements a **PointerMatrix** object that stores coordinates and behaviors of each action of each finger in a multi-touch operation.
......@@ -2455,6 +2509,7 @@ async function demo() {
## UiWindow<sup>9+</sup>
The **UiWindow** class represents a window on the UI and provides APIs for obtaining window attributes, dragging a window, and adjusting the window size.
All APIs provided in this class use a promise to return the result and must be invoked using **await**.
### getBundleName<sup>9+</sup>
......@@ -2477,8 +2532,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the window is invisible or destroyed. |
**Example**
......@@ -2510,8 +2565,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the window is invisible or destroyed. |
**Example**
......@@ -2543,8 +2598,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the window is invisible or destroyed. |
**Example**
......@@ -2576,8 +2631,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the window is invisible or destroyed. |
**Example**
......@@ -2609,8 +2664,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the window is invisible or destroyed. |
**Example**
......@@ -2642,8 +2697,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the window is invisible or destroyed. |
**Example**
......@@ -2669,8 +2724,8 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the window is invisible or destroyed. |
**Example**
......@@ -2703,9 +2758,9 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000005 | This operation is not supported. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the window is invisible or destroyed. |
| 17000005 | if the action is not supported on this window. |
**Example**
......@@ -2739,9 +2794,9 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000005 | This operation is not supported. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the window is invisible or destroyed. |
| 17000005 | if the action is not supported on this window. |
**Example**
......@@ -2767,9 +2822,9 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000005 | This operation is not supported. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the window is invisible or destroyed. |
| 17000005 | if the action is not supported on this window. |
**Example**
......@@ -2795,9 +2850,9 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000005 | This operation is not supported. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the window is invisible or destroyed. |
| 17000005 | if the action is not supported on this window. |
**Example**
......@@ -2823,9 +2878,9 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000005 | This operation is not supported. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the window is invisible or destroyed. |
| 17000005 | if the action is not supported on this window. |
**Example**
......@@ -2851,9 +2906,9 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000005 | This operation is not supported. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the window is invisible or destroyed. |
| 17000005 | if the action is not supported on this window. |
**Example**
......@@ -2879,9 +2934,9 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc
| ID| Error Message |
| -------- | ---------------------------------------- |
| 17000002 | API does not allow calling concurrently. |
| 17000004 | Component lost/UiWindow lost. |
| 17000005 | This operation is not supported. |
| 17000002 | if the async function was not called with await. |
| 17000004 | if the window is invisible or destroyed. |
| 17000005 | if the action is not supported on this window. |
**Example**
......@@ -2893,10 +2948,78 @@ async function demo() {
}
```
## UIEventObserver<sup>10+</sup>
UI event listener.
### once('toastShow')
once(type: 'toastShow', callback: Callback\<UIElementInfo>):void;
Subscribes to events of the toast component. This API uses a callback to return the result.
**System capability**: SystemCapability.Test.UiTest
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------------- | ---- | --------------------------------- |
| type | string | Yes | Event type. The value is fixed at **'toastShow'**.|
| callback | Callback\<[UIElementInfo](#uielementinfo10)> | Yes | Callback used to return the result. |
**Example**
```js
async function demo() {
let observer = await driver.createUIEventObserver()
let callback = (UIElementInfo)=>{
console.info(UIElementInfo.bundleName)
console.info(UIElementInfo.text)
console.info(UIElementInfo.type)
}
observer.once('toastShow', callback)
}
```
### once('dialogShow')
once(type: 'dialogShow', callback: Callback\<UIElementInfo>): void;
Subscribes to events of the dialog component. This API uses a callback to return the result.
**System capability**: SystemCapability.Test.UiTest
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------------- | ---- | ---------------------------------- |
| type | string | Yes | Event type. The value is fixed at **'dialogShow'**.|
| callback | Callback\<[UIElementInfo](#uielementinfo10)> | Yes | Callback used to return the result. |
**Example**
```js
async function demo() {
let observer = await driver.createUIEventObserver()
let callback = (UIElementInfo)=>{
console.info(UIElementInfo.bundleName)
console.info(UIElementInfo.text)
console.info(UIElementInfo.type)
}
observer.once('dialogShow', callback)
}
```
## By<sup>(deprecated)</sup>
The UiTest framework provides a wide range of UI component feature description APIs in the **By** class to filter and match components.
The API capabilities provided by the **By** class exhibit the following features: <br>1. Allow one or more attributes as the match conditions. For example, you can specify both the **text** and **id** attributes to find the target component. <br>2. Provide multiple match patterns for component attributes. <br>3. Support absolute positioning and relative positioning for components. APIs such as [By.isBefore<sup>(deprecated)</sup>](#isbeforedeprecated) and [By.isAfter<sup>(deprecated)</sup>](#isafterdeprecated) can be used to specify the features of adjacent components to assist positioning. <br>All APIs provided in the **By** class are synchronous. You are advised to use the static constructor **BY** to create a **By** object in chain mode.
The API capabilities provided by the **By** class exhibit the following features:
- Allow one or more attributes as the match conditions. For example, you can specify both the **text** and **id** attributes to find the target component.
- Provide multiple match patterns for component attributes.
- Support absolute positioning and relative positioning for components. APIs such as [By.isBefore<sup>(deprecated)</sup>](#isbeforedeprecated) and [By.isAfter<sup>(deprecated)</sup>](#isafterdeprecated) can be used to specify the features of adjacent components to assist positioning.
All APIs provided in the **By** class are synchronous. You are advised to use the static constructor **BY** to create a **By** object in chain mode.
This API is deprecated since API version 9. You are advised to use [On<sup>9+</sup>](#on9) instead.
......@@ -2910,7 +3033,7 @@ text(txt: string, pattern?: MatchPattern): By
Specifies the text attribute of the target component. Multiple match patterns are supported.
This API is deprecated since API version 9. You are advised to use [text<sup>9+</sup>](#text9).
This API is deprecated since API version 9. You are advised to use [text<sup>9+</sup>](#text9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -2940,7 +3063,7 @@ key(key: string): By
Specifies the key attribute of the target component.
This API is deprecated since API version 9. You are advised to use [id<sup>9+</sup>](#id9).
This API is deprecated since API version 9. You are advised to use [id<sup>9+</sup>](#id9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -2998,7 +3121,7 @@ type(tp: string): By
Specifies the type attribute of the target component.
This API is deprecated since API version 9. You are advised to use [type<sup>9+</sup>](#type9).
This API is deprecated since API version 9. You are advised to use [type<sup>9+</sup>](#type9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3027,7 +3150,7 @@ clickable(b?: boolean): By
Specifies the clickable status attribute of the target component.
This API is deprecated since API version 9. You are advised to use [clickable<sup>9+</sup>](#clickable9).
This API is deprecated since API version 9. You are advised to use [clickable<sup>9+</sup>](#clickable9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3035,7 +3158,7 @@ This API is deprecated since API version 9. You are advised to use [clickable<su
| Name| Type | Mandatory| Description |
| ------ | ------- | ---- | ------------------------------------------------------------ |
| b | boolean | No | Clickable status of the target component.<br>**true**: clickable.<br>**false**: not clickable.<br>Default value: **true** |
| b | boolean | No | Clickable status of the target component.<br>**true**: clickable.<br>**false**: not clickable.<br> Default value: **true**|
**Return value**
......@@ -3056,7 +3179,7 @@ scrollable(b?: boolean): By
Specifies the scrollable status attribute of the target component.
This API is deprecated since API version 9. You are advised to use [scrollable<sup>9+</sup>](#scrollable9).
This API is deprecated since API version 9. You are advised to use [scrollable<sup>9+</sup>](#scrollable9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3064,7 +3187,7 @@ This API is deprecated since API version 9. You are advised to use [scrollable<s
| Name| Type | Mandatory| Description |
| ------ | ------- | ---- | ----------------------------------------------------------- |
| b | boolean | No | Scrollable status of the target component.<br>**true**: scrollable.<br>**false**: not scrollable.<br>Default value: **true** |
| b | boolean | No | Scrollable status of the target component.<br>**true**: scrollable.<br>**false**: not scrollable.<br> Default value: **true**|
**Return value**
......@@ -3084,7 +3207,7 @@ enabled(b?: boolean): By
Specifies the enabled status attribute of the target component.
This API is deprecated since API version 9. You are advised to use [enabled<sup>9+</sup>](#enabled9).
This API is deprecated since API version 9. You are advised to use [enabled<sup>9+</sup>](#enabled9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3092,7 +3215,7 @@ This API is deprecated since API version 9. You are advised to use [enabled<sup>
| Name| Type | Mandatory| Description |
| ------ | ------- | ---- | --------------------------------------------------------- |
| b | boolean | No | Enabled status of the target component.<br>**true**: enabled.<br>**false**: not enabled.<br>Default value: **true** |
| b | boolean | No | Enabled status of the target component.<br>**true**: enabled.<br>**false**: not enabled.<br> Default value: **true**|
**Return value**
......@@ -3112,7 +3235,7 @@ focused(b?: boolean): By
Specifies the focused status attribute of the target component.
This API is deprecated since API version 9. You are advised to use [focused<sup>9+</sup>](#focused9).
This API is deprecated since API version 9. You are advised to use [focused<sup>9+</sup>](#focused9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3120,7 +3243,7 @@ This API is deprecated since API version 9. You are advised to use [focused<sup>
| Name| Type | Mandatory| Description |
| ------ | ------- | ---- | ----------------------------------------------------- |
| b | boolean | No | Focused status of the target component.<br>**true**: focused.<br>**false**: not focused.<br>Default value: **true** |
| b | boolean | No | Focused status of the target component.<br>**true**: focused.<br>**false**: not focused.<br> Default value: **true**|
**Return value**
......@@ -3140,7 +3263,7 @@ selected(b?: boolean): By
Specifies the selected status of the target component.
This API is deprecated since API version 9. You are advised to use [selected<sup>9+</sup>](#selected9).
This API is deprecated since API version 9. You are advised to use [selected<sup>9+</sup>](#selected9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3148,7 +3271,7 @@ This API is deprecated since API version 9. You are advised to use [selected<sup
| Name| Type | Mandatory| Description |
| ------ | ------- | ---- | ------------------------------------------------------------ |
| b | boolean | No | Selected status of the target component.<br>**true**: selected.<br>**false**: not selected.<br>Default value: **true** |
| b | boolean | No | Selected status of the target component.<br>**true**: selected.<br>**false**: not selected.<br> Default value: **true**|
**Return value**
......@@ -3168,7 +3291,7 @@ isBefore(by: By): By
Specifies that the target component is located before the given attribute component.
This API is deprecated since API version 9. You are advised to use [isBefore<sup>9+</sup>](#isbefore9).
This API is deprecated since API version 9. You are advised to use [isBefore<sup>9+</sup>](#isbefore9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3194,9 +3317,9 @@ let by = BY.isBefore(BY.text('123')); // Use the static constructor BY to create
isAfter(by: By): By
Specifies the target component is located after the given attribute component.
Specifies that the target component is located after the given attribute component.
This API is deprecated since API version 9. You are advised to use [isAfter<sup>9+</sup>](#isafter9).
This API is deprecated since API version 9. You are advised to use [isAfter<sup>9+</sup>](#isafter9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3221,6 +3344,7 @@ let by = BY.isAfter(BY.text('123')); // Use the static constructor BY to create
## UiComponent<sup>(deprecated)</sup>
In **UiTest**, the **UiComponent** class represents a component on the UI and provides APIs for obtaining component attributes, clicking a component, scrolling to search for a component, and text injection.
All APIs provided in this class use a promise to return the result and must be invoked using **await**.
This API is deprecated since API version 9. You are advised to use [Component<sup>9+</sup>](#component9) instead.
......@@ -3231,7 +3355,7 @@ click(): Promise\<void>
Clicks this component.
This API is deprecated since API version 9. You are advised to use [click<sup>9+</sup>](#click9).
This API is deprecated since API version 9. You are advised to use [click<sup>9+</sup>](#click9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3251,7 +3375,7 @@ doubleClick(): Promise\<void>
Double-clicks this component.
This API is deprecated since API version 9. You are advised to use [doubleClick<sup>9+</sup>](#doubleclick9).
This API is deprecated since API version 9. You are advised to use [doubleClick<sup>9+</sup>](#doubleclick9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3271,7 +3395,7 @@ longClick(): Promise\<void>
Long-clicks this component.
This API is deprecated since API version 9. You are advised to use [longClick<sup>9+</sup>](#longclick9).
This API is deprecated since API version 9. You are advised to use [longClick<sup>9+</sup>](#longclick9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3317,7 +3441,7 @@ getKey(): Promise\<string>
Obtains the key of this component.
This API is deprecated since API version 9. You are advised to use [getId<sup>9+</sup>](#getid9).
This API is deprecated since API version 9. You are advised to use [getId<sup>9+</sup>](#getid9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3343,7 +3467,7 @@ getText(): Promise\<string>
Obtains the text information of this component.
This API is deprecated since API version 9. You are advised to use [getText<sup>9+</sup>](#gettext9).
This API is deprecated since API version 9. You are advised to use [getText<sup>9+</sup>](#gettext9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3369,7 +3493,7 @@ getType(): Promise\<string>
Obtains the type of this component.
This API is deprecated since API version 9. You are advised to use [getType<sup>9+</sup>](#gettype9).
This API is deprecated since API version 9. You are advised to use [getType<sup>9+</sup>](#gettype9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3395,7 +3519,7 @@ isClickable(): Promise\<boolean>
Obtains the clickable status of this component.
This API is deprecated since API version 9. You are advised to use [isClickable<sup>9+</sup>](#isclickable9).
This API is deprecated since API version 9. You are advised to use [isClickable<sup>9+</sup>](#isclickable9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3425,7 +3549,7 @@ isScrollable(): Promise\<boolean>
Obtains the scrollable status of this component.
This API is deprecated since API version 9. You are advised to use [isScrollable<sup>9+</sup>](#isscrollable9).
This API is deprecated since API version 9. You are advised to use [isScrollable<sup>9+</sup>](#isscrollable9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3456,7 +3580,7 @@ isEnabled(): Promise\<boolean>
Obtains the enabled status of this component.
This API is deprecated since API version 9. You are advised to use [isEnabled<sup>9+</sup>](#isenabled9).
This API is deprecated since API version 9. You are advised to use [isEnabled<sup>9+</sup>](#isenabled9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3487,7 +3611,7 @@ isFocused(): Promise\<boolean>
Obtains the focused status of this component.
This API is deprecated since API version 9. You are advised to use [isFocused<sup>9+</sup>](#isfocused9).
This API is deprecated since API version 9. You are advised to use [isFocused<sup>9+</sup>](#isfocused9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3517,7 +3641,7 @@ isSelected(): Promise\<boolean>
Obtains the selected status of this component.
This API is deprecated since API version 9. You are advised to use [isSelected<sup>9+</sup>](#isselected9).
This API is deprecated since API version 9. You are advised to use [isSelected<sup>9+</sup>](#isselected9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3547,7 +3671,7 @@ inputText(text: string): Promise\<void>
Enters text into this component (available for text boxes).
This API is deprecated since API version 9. You are advised to use [inputText<sup>9+</sup>](#inputtext9).
This API is deprecated since API version 9. You are advised to use [inputText<sup>9+</sup>](#inputtext9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3573,7 +3697,7 @@ scrollSearch(by: By): Promise\<UiComponent>
Scrolls on this component to search for the target component (applicable to components that support scrolling, such as **\<List>**).
This API is deprecated since API version 9. You are advised to use [scrollSearch<sup>9+</sup>](#scrollsearch9).
This API is deprecated since API version 9. You are advised to use [scrollSearch<sup>9+</sup>](#scrollsearch9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3602,6 +3726,7 @@ async function demo() {
## UiDriver<sup>(deprecated)</sup>
The **UiDriver** class is the main entry to the UiTest framework. It provides APIs for features such as component matching/search, key injection, coordinate clicking/sliding, and screenshot.
All APIs provided by this class, except for **UiDriver.create()**, use a promise to return the result and must be invoked using **await**.
This API is deprecated since API version 9. You are advised to use [Driver<sup>9+</sup>](#driver9) instead.
......@@ -3612,7 +3737,7 @@ static create(): UiDriver
Creates a **UiDriver** object and returns the object created. This API is a static API.
This API is deprecated since API version 9. You are advised to use [create<sup>9+</sup>](#create9).
This API is deprecated since API version 9. You are advised to use [create<sup>9+</sup>](#create9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3636,7 +3761,7 @@ delayMs(duration: number): Promise\<void>
Delays this **UiDriver** object within the specified duration.
This API is deprecated since API version 9. You are advised to use [delayMs<sup>9+</sup>](#delayms9).
This API is deprecated since API version 9. You are advised to use [delayMs<sup>9+</sup>](#delayms9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3661,7 +3786,7 @@ findComponent(by: By): Promise\<UiComponent>
Searches this **UiDriver** object for the target component that matches the given attributes.
This API is deprecated since API version 9. You are advised to use [findComponent<sup>9+</sup>](#findcomponent9).
This API is deprecated since API version 9. You are advised to use [findComponent<sup>9+</sup>](#findcomponent9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3692,7 +3817,7 @@ findComponents(by: By): Promise\<Array\<UiComponent>>
Searches this **UiDriver** object for all components that match the given attributes.
This API is deprecated since API version 9. You are advised to use [findComponents<sup>9+</sup>](#findcomponents9).
This API is deprecated since API version 9. You are advised to use [findComponents<sup>9+</sup>](#findcomponents9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3723,7 +3848,7 @@ assertComponentExist(by: By): Promise\<void>
Asserts that a component that matches the given attributes exists on the current page. If the component does not exist, the API throws a JS exception, causing the current test case to fail.
This API is deprecated since API version 9. You are advised to use [assertComponentExist<sup>9+</sup>](#assertcomponentexist9).
This API is deprecated since API version 9. You are advised to use [assertComponentExist<sup>9+</sup>](#assertcomponentexist9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3748,7 +3873,7 @@ pressBack(): Promise\<void>
Presses the Back button on this **UiDriver** object.
This API is deprecated since API version 9. You are advised to use [pressBack<sup>9+</sup>](#pressback9).
This API is deprecated since API version 9. You are advised to use [pressBack<sup>9+</sup>](#pressback9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3767,7 +3892,7 @@ triggerKey(keyCode: number): Promise\<void>
Triggers the key of this **UiDriver** object that matches the given key code.
This API is deprecated since API version 9. You are advised to use [triggerKey<sup>9+</sup>](#triggerkey9).
This API is deprecated since API version 9. You are advised to use [triggerKey<sup>9+</sup>](#triggerkey9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3793,7 +3918,7 @@ click(x: number, y: number): Promise\<void>
Clicks a specific point of this **UiDriver** object based on the given coordinates.
This API is deprecated since API version 9. You are advised to use [click<sup>9+</sup>](#click9).
This API is deprecated since API version 9. You are advised to use [click<sup>9+</sup>](#click9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3819,7 +3944,7 @@ doubleClick(x: number, y: number): Promise\<void>
Double-clicks a specific point of this **UiDriver** object based on the given coordinates.
This API is deprecated since API version 9. You are advised to use [doubleClick<sup>9+</sup>](#doubleclick9).
This API is deprecated since API version 9. You are advised to use [doubleClick<sup>9+</sup>](#doubleclick9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3845,7 +3970,7 @@ longClick(x: number, y: number): Promise\<void>
Long-clicks a specific point of this **UiDriver** object based on the given coordinates.
This API is deprecated since API version 9. You are advised to use [longClick<sup>9+</sup>](#longclick9).
This API is deprecated since API version 9. You are advised to use [longClick<sup>9+</sup>](#longclick9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3871,7 +3996,7 @@ swipe(startx: number, starty: number, endx: number, endy: number): Promise\<void
Swipes on this **UiDriver** object from the start point to the end point based on the given coordinates.
This API is deprecated since API version 9. You are advised to use [swipe<sup>9+</sup>](#swipe9).
This API is deprecated since API version 9. You are advised to use [swipe<sup>9+</sup>](#swipe9) instead.
**System capability**: SystemCapability.Test.UiTest
......@@ -3899,7 +4024,7 @@ screenCap(savePath: string): Promise\<boolean>
Captures the current screen of this **UiDriver** object and saves it as a PNG image to the given save path.
This API is deprecated since API version 9. You are advised to use [screenCap<sup>9+</sup>](#screencap9).
This API is deprecated since API version 9. You are advised to use [screenCap<sup>9+</sup>](#screencap9) instead.
**System capability**: SystemCapability.Test.UiTest
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册