1# Test Subsystem ChangeLog 2 3## cl.testfwk_arkxtest.1 Exception Handling Support of On, Driver, and Component APIs 4 5The original APIs in API version 8 are deprecated, and substitute APIs that support exception handling are introduced in API version 9. You must use **try catch** to capture exceptions thrown by the APIs. 6 7## Change Impacts 8 9This change affects the JS APIs in API version 9 provided by **@ohos.uitest**. If you have used the API 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- The **By** class in API version 8 is deprecated and replaced by the **On** class in API version 9. The APIs of the **On** class support exception handling and retain their original name, with the exception of **By#key**, which is renamed **On.id**. 14- The **BY** object in API version 8 is deprecated and replaced by the **ON** object in API version 9. 15- The **UiDriver** class in API version 8 is deprecated and replaced by the **Driver** class in API version 9. The APIs of the **Driver** class support exception handling and retain their original name. 16- The **UiComponent** class in API version 8 is deprecated and replaced by the **Component** class in API version 9. The APIs of the **Component** class support exception handling and retain their original name. 17 18## Adaptation Guide 19 201. Adapt to the API name changes. 21 22 You can replace the class name according to the following rules: 23 24 - `By-->On` 25 - `BY-->ON` 26 - `UiDriver-->Driver` 27 - `UiComponent-->Component` 28 292. Catch and handle exceptions. 30 31 Use **try-catch** to catch and handle exceptions thrown by the APIs. Below is the sample code: 32 33 ```typescript 34 import {Driver,ON,Component} from '@ohos.uitest' 35 36 try { 37 let driver = Driver.create(); 38 } catch (error) { 39 // error handle; error.code indicates the error code. 40 } 41 ```