# Enabling Self Healing Plugin in Appium

Last updated on : 09 Jan 2026

Overview
Pcloudy provides a Self-Healing Plugin that automatically repairs automation scripts when application UI elements or locators change between builds.

During automation testing, scripts often fail because:
- UI elements are modified
- Object locators change between releases

With the Self-Healing Plugin, Pcloudy uses an AI-based mechanism to detect these changes and auto-update locators, ensuring smoother execution and reduced script failures.
This feature is compatible with Appium automation scripts and improves overall script reliability and execution success.

## Key Advantages of Self-Healing

### 1. Improved Script Stability
- Automatically heals scripts when element locators change
- Reduces failures caused by updated builds or UI changes

### 2.Reduced Maintenance Effort

- Minimizes manual script updates
- Saves hours of debugging and locator fixes for automation engineers

### 3.Efficient CI/CD Pipelines
- Stable automation scripts ensure consistent test results
- Faster and smoother CI pipeline execution

## Limitations
- Supported only for Android native applications
- Supported locator attribute: id

## Prerequisites
Before enabling Self-Healing, ensure:
- You are registered on the Pcloudy platform
- You have:
  - One stable build
  - One recent (updated) build for comparison

## Steps to Enable Self-Healing

### Step 1: Run Automation on the Stable Build
Execute your automation suite on the stable build with the following capabilities enabled.

#### Required Capabilities (Stable Build)

// Application Name

```java title="Java"
capabilities.setCapability("appium:pcloudy_ApplicationName", "Version1.apk");
```

// Enable locator extraction

```java title="Java"
**capabilities.setCapability("appium:extract", true);**
```

// Set project name

```java title="Java"
**capabilities.setCapability("appium:project", "healing7");**
```

// Set build name

```java title="Java"
**capabilities.setCapability("appium:build", "test7");**
```

Purpose:  
This step extracts and stores element locators from the stable build.

### Step 2: Train the Self-Healing Engine Using the Recent Build
Run the automation on the recent build 4–5 times to allow the AI engine to learn and map locator changes.

#### Required Capabilities (Recent Build)

```java title="Java"
// Recent application name
capabilities.setCapability("appium:pcloudy_ApplicationName", "build-2.apk");
```

// Enable self-healing

```java
capabilities.setCapability("appium:healing", true);
```

// Set project name

```java
capabilities.setCapability("appium:project", "healing7");
```

// Set build name

```java
capabilities.setCapability("appium:build", "test7");
```

### Purpose:
This step enables the AI-based healing engine to detect and adapt to locator chang

### Step 3: Execution Behavior
During execution:

- The test may initially fail due to locator changes
- The Self-Healing engine automatically handles the failure
- The script re-executes with updated locators
- Test execution completes successfully

### Summary

Self-Healing Plugin: Auto-updates element locators when UI changes
AI-Based Learning: Becomes smarter with repeated executions
Reduced Failures: Delivers consistent and reliable test results
Lower Maintenance: Saves time by reducing manual script fixes
