# Self-Healing For Selenium

Last updated on : 09 Jan 2026

## Overview
The Self-Healing capability in Pcloudy helps automation engineers maintain stable and reliable automation scripts by automatically handling changes in application elements and locators. When application updates cause locator changes, the self-healing engine intelligently identifies and updates them during execution, reducing script failures and manual maintenance.

## Prerequisites
- Registered Pcloudy account
- Existing Appium or Selenium automation scripts
- One stable build and one updated build of the application
- Pcloudy user credentials and access key—to get access key
- Click on Quick Actions from the bottom-left corner
- Copy the API Access Key
- (Optional) To generate a new key:Go to Profile → API Keys

## Advantages of Self-Healing
- Reduced Script Failures – Automatically heals locator changes
- Lower Maintenance Effort – Minimizes manual script updates
- Improved Execution Stability – Consistent execution across builds
- AI-Based Learning – Improves accuracy over multiple runs
- CI/CD Friendly – Supports stable automation pipelines

## Step 3: Update Selenium Capabilities
Replace your local Selenium driver with the Pcloudy RemoteWebDriver and add Pcloudy-specific capabilities.

### Key Capabilities Explained
| Capability      | Description                    |
|---------------------|------------------------------------|
| userName            | Registered Pcloudy email ID        |
| accessKey           | API key from Pcloudy               |
| os                  | Operating system (Windows / Mac)   |
| osVersion           | OS version                         |
| browserName         | Browser to execute tests           |
| browserVersion      | Browser version                    |
| seleniumVersion     | Selenium framework version         |
| build               | Build name for grouping executions |
| local               | Enable if testing with local setup |
| Pcloudy_EnableVideo | Enable/disable execution video     |

Below is a clean, user-friendly step-by-step section that you can directly add to your existing help documentation. It’s written in a documentation style, easy to follow, and suitable for Word/Confluence.

  [Video: Self-Healing For Selenium](https://www.youtube.com/watch?v=QVfXxQ2hsLk)

## Execution Steps (Self-Healing Flow)
Follow the steps below to execute the automation script and observe the self-healing behavior:

### Step 1: Update Pcloudy Credentials
Add your email ID and access key in the PcloudyDriver file.

### Step 2: Set Initial Build Name
Set the build name as Build1 in your capabilities.

### Step 3: Execute the Test
Run the test by clicking Run in the Runner file.

### Step 4: Verify Active Session
Navigate to My Active Sessions in the Pcloudy dashboard to confirm that the session has started.

### Step 5: View Live Execution
Open Live View to watch the script execution in real time on the device.

### Step 6: Modify Application or Locators
After the first execution completes, make required changes in your Git repository (for example, locator or UI changes).

### Step 7: Update Build Name
Change the build name to Build2 in your capabilities.

### Step 8: Re-run the Test
Click Run again from the Runner file and verify the new active session.

### Step 9: Observe Self-Healing Logs
During execution, monitor the console logs.

You will see logs indicating that auto-healed elements were detected and updated automatically.

### Step 10: Review Session Report
After execution:

- Navigate to Report->Automation Reports->open the particular report
- Review execution status, logs, healed elements, and other test details

## Outcome
- Script executes successfully despite locator changes
- Healed elements are captured and logged
- Reduced manual intervention and maintenance effort
