https://github.com/healenium/healenium-web
Self-healing library for Selenium Web-based tests
https://github.com/healenium/healenium-web
Last synced: about 2 months ago
JSON representation
Self-healing library for Selenium Web-based tests
- Host: GitHub
- URL: https://github.com/healenium/healenium-web
- Owner: healenium
- License: apache-2.0
- Created: 2019-10-21T08:23:28.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-07-14T14:47:32.000Z (9 months ago)
- Last Synced: 2024-07-14T16:41:01.392Z (9 months ago)
- Language: Java
- Size: 529 KB
- Stars: 162
- Watchers: 19
- Forks: 39
- Open Issues: 26
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-java - Healenium-Web
README
# healenium-web
Self-healing library for Selenium Web-based tests[](https://search.maven.org/search?q=g:%22com.epam.healenium%22%20AND%20a:%22healenium-web%22)
[](https://t.me/healenium)
⇧ Join us! ⇧
## How to start### 0. Start hlm-backend by [instruction](https://github.com/healenium/healenium-backend)
### 0.1 Add dependency
for Gradle projects:
```
dependencies {
compile group: 'com.epam.healenium', name: 'healenium-web', version: '3.5.4'
}
```for Maven projects:
```com.epam.healenium
healenium-web
3.5.4```
### 1. Init driver instance of SelfHealingDriver
```
//declare delegate
WebDriver delegate = new ChromeDriver();
//create Self-healing driver
SelfHealingDriver driver = SelfHealingDriver.create(delegate);
```
### 2. Specify custom healing config file healenium.properties under test/resources directory, ex.:
```
recovery-tries = 1
score-cap = 0.5
heal-enabled = true
hlm.server.url = http://localhost:7878
hlm.imitator.url = http://localhost:8000
```
> recovery-tries - list of proposed healed locators> heal-enabled - flag to enable or disable healing.
Also you can set this value via -D or System properties, for example to turn off healing for current test run: -Dheal-enabled=false> score-cap - score value to enable healing with predefined probability of match (0.5 means that healing will be performed for new healed locators where probability of match with target one is >=50% )
> hlm.server.url - ip:port or name where hlm-backend instance is installed
> hlm.imitator.url - ip:port or name where imitate instance is installed
### 3. Simply use standard By/@FindBy to locate your elements
```
@FindBy(xpath = "//button[@type='submit']")
private WebElement testButton;
...
public void clickTestButton() {
driver.findElement(By.cssSelector(".test-button")).click();
}
```
### 4. To disable healing for some element you can use @DisableHealing annotation over the method where element is called. Ex: If you want to verify that element is not present on the page.
```
@DisableHealing
public boolean isButtonPresent() {
try {
return driver.findElement(By.cssSelector(".test-button")).isDisplayed();
} catch (NoSuchElementException e) {
return false;
}
}
```### 5. Add [hlm-idea](https://github.com/healenium/healenium-idea) plugin to enable locator updates in your TAF code
### 6. Run tests as usual using Maven mvn clean test or Gradle ./gradlew clean test