> For the complete documentation index, see [llms.txt](https://docs.precisiontestautomation.in/scriptlessautomation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.precisiontestautomation.in/scriptlessautomation/automation-features/keyinitializers/types-of-keyinitializers.md).

# Types of KeyInitializers

In the **Open Code** version of our Scriptless Automation framework, the `KeyInitializers` are categorized into three distinct classes, each designed to cater to specific areas of automation:

1. **CoreKeyInitializers** - Core framework utilities.
2. **ApiKeyInitializers** - API automation utilities.
3. **WebKeyInitializers** - Web automation utilities.

Each initializer provides thread-local variables to ensure data consistency across parallel test executions.

### **CoreKeyInitializers**

* **Purpose**: Used for core framework operations.
* **Variables Available**:
  * `customSoftAssert`: To perform custom assertions.
  * `testManagementRunUrl`: To retrieve the test management run URL.

**Usage**:

* Retrieve the current instance of custom soft assertions for validation.
* Access the test management run URL during the execution of your tests.

### **ApiKeyInitializers**

* **Purpose**: Provides utilities for API automation.
* **Variables Available**:
  * `mailingServices`: To access mailing services.
  * `globalVariables`: A map to store and retrieve global variables.
  * `response`: To get the latest API response.

**Usage**:

* Use mailing services for sending emails during API tests.
* Store and retrieve global variables required for API testing.
* Access and validate the latest API response received.

### **WebKeyInitializers**

* **Purpose**: Used specifically for web automation.
* **Variables Available**:
  * `browserName`: To retrieve the name of the browser being used.
  * `getMainWindow`: To get the main window handle of the browser.
  * `devToolsListener`: A map to manage DevTools listeners.
  * `firstName`, `lastName`, `phoneNumber`: To store and retrieve user details.
  * `driver`: To access the WebDriver instance.

**Usage**:

* Access the browser name and main window handle for managing browser sessions.
* Use the DevTools listener map to handle browser events.
* Retrieve user details like first name, last name, and phone number for form submissions.
* Interact with web elements using the WebDriver instance.

### Integration with Automation Templates

* **Custom Actions**: Integrate custom actions using these initializers in your automation templates. Define actions in your templates that invoke methods from your custom classes.
* **Custom Assertions**: Use `CoreKeyInitializers` to integrate custom assertions into your tests. This allows you to perform complex validation checks.
* **API Execution**: Utilize `ApiKeyInitializers` for handling API responses and mailing services within your API automation templates. This enables dynamic test flows based on API interactions.
