• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Test Subsystem ChangeLog
2
3## cl.testfwk_arkxtest.1 On, Driver, and Component APIs Support Exception Handling
4
5The APIs of API version 8 are deprecated and replaced by new APIs in API version 9 to capture exceptions using **try catch**.
6
7## Change Impact
8
9The api9-JS APIs provided by @ohos.uitest are affected. If you have used the APIs of **@ohos.uitest-api9** during test case development, adaptation is required so that the compilation can be successful in the SDK environment of the new version.
10
11## Key API/Component Changes
12
13- Deprecated the **By** class of API version 8 and replaced it with the **On** class in API version 9. The APIs of the **On** class support exception handling. The API names in the class remain unchanged, except that **By#key** is replaced with **On.id**.
14- Deprecated the **BY** object of API version 8 and replaced it with the **ON** object in API version 9.
15- Deprecated the **UiDriver** class of API version 8 and replaced it with the **Driver** class in API version 9. The APIs of the **Driver** class support exception handling, and the API names in the class remain unchanged.
16- Deprecated the **UiComponent** class of API version 8 and replaced it with the **Component** class in API version 9. The APIs of the **Component** class support exception handling, and the API names in the class remain unchanged.
17
18## Adaptation Guide
19
201. Replace the class names as follows:
21
22   - `By-->On`
23   - `BY-->ON`
24   - `UiDriver-->Driver`
25   - `UiComponent-->Component`
26
272. Capture the exception thrown.
28
29   Use **try-catch** to capture exceptions thrown.<br>Example:
30
31```typescript
32import {Driver,ON,Component} from '@ohos.uitest'
33
34try {
35    let driver = Driver.create();
36} catch (error) {
37    // error handle; error.code indicates the error code.
38}
39```
40