@@ -16,13 +16,13 @@ import {UiDriver,BY,MatchPattern} from '@ohos.uitest'
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:
1.Allows one or more attributes as the match conditions. For example, you can specify both the **text** and **id** attributes to find the target component.
-Allows one or more attributes as the match conditions. For example, you can specify both the **text** and **id** attributes to find the target component.
2.Provides multiple match patterns for component attributes.
-Provides multiple match patterns for component attributes.
3.Supports absolute positioning and relative positioning for components. APIs such as **isBefore** and **isAfter** can be used to specify the features of adjacent components to assist positioning.
-Supports absolute positioning and relative positioning for components. APIs such as **isBefore** and **isAfter** 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, for example, **BY.text('123').type('button')**.
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, for example, **BY.text('123').type('button')**.
### enum MatchPattern
...
...
@@ -92,7 +92,8 @@ Specifies the key attribute of the target component.
**Example**
```
let by = BY.key('123') // Use the static constructor BY to create a By object and specify the key attribute of the target component.
let by = BY.key('123') // Use the static constructor BY to create a By object and specify the key attribute
of the target component.
```
...
...
@@ -121,7 +122,8 @@ Specifies the ID property of the target component.
**Example**
```
let by = BY.id(123) // Use the static constructor BY to create a By object and specify the ID attribute of the target component.
let by = BY.id(123) // Use the static constructor BY to create a By object and specify the ID attribute
of the target component.
```
...
...
@@ -208,7 +210,8 @@ Specifies the scrollable attribute of the target component.
**Example**
```
let by = BY.scrollable(true) // Use the static constructor BY to create a By object and specify the scrollable attribute of the target component.
let by = BY.scrollable(true) // Use the static constructor BY to create a By object and specify the scrollable attribute
of the target component.
```
### By.enabled
...
...
@@ -236,7 +239,8 @@ Specifies the enable attribute of the target component.
**Example**
```
let by = BY.enabled(true) // Use the static constructor BY to create a By object and specify the enable attribute of the target component.
let by = BY.enabled(true) // Use the static constructor BY to create a By object and specify the enable attribute
of the target component.
```
### By.focused
...
...
@@ -264,7 +268,8 @@ Specifies the focused attribute of the target component.
**Example**
```
let by = BY.enabled(true) // Use the static constructor BY to create a By object and specify the focused attribute of the target component.
let by = BY.enabled(true) // Use the static constructor BY to create a By object and specify the focused attribute
of the target component.
```
### By.selected
...
...
@@ -292,7 +297,8 @@ Specifies the selected attribute of the target component.
**Example**
```
let by = BY.selected(true) // Use the static constructor BY to create a By object and specify the selected attribute of the target component.
let by = BY.selected(true) // Use the static constructor BY to create a By object and specify the selected attribute
of the target component.
```
### By.isBefore
...
...
@@ -320,7 +326,8 @@ Specifies the attributes of the component before which the target component is l
**Example**
```
let by = BY.isBefore(by.text('123')) // Use the static constructor BY to create a By object and specify the attributes of the component before which the target component is located.
let by = BY.isBefore(BY.text('123')) // Use the static constructor BY to create a By object and specify the attributes
of the component before which the target component is located.
```
### By.isAfter
...
...
@@ -337,7 +344,7 @@ Specifies the attributes of the component after which the target component is lo
| Name| Type| Mandatory| Description |
| ------ | ---- | ---- | -------------- |
| by | By | Yes | Attributes of the component after which the target component is located.|
| by | By | Yes | Attributes of the component before which the target component is located.|
**Return value**
...
...
@@ -348,7 +355,8 @@ Specifies the attributes of the component after which the target component is lo
**Example**
```
let by = BY.isAfter(by.text('123')) // Use the static constructor BY to create a By object and specify the attributes of the component after which the target component is located.
let by = BY.isAfter(BY.text('123')) // Use the static constructor BY to create a By object and specify the attributes
of the component after which the target component is located.