# Flaky Test Healer

> Analyzes and refactors flaky UI tests written in Selenium WebDriver with Java.

- Skill: `shreyasbh02/flaky-test-healer` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add shreyasbh02/flaky-test-healer`
- Raw SKILL.md: https://api.skillmd.com/api/skills/shreyasbh02/flaky-test-healer/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: ShreyasBh02 (https://skillmd.com/u/shreyasbh02)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/shreyasbh02/flaky-test-healer

---

# Flaky Test Healer (Selenium Java)

Your expert assistant for fixing fragile UI automation tests.

## Instructions
1. Accept Selenium Java test code from the user.
2. Identify common causes of flakiness:
   - Hardcoded `Thread.sleep()` -> Replace with `WebDriverWait` or `FluentWait`.
   - Fragile XPath/CSS selectors (e.g., absolute paths) -> Refactor to robust, semantic locators (e.g., id, name, relative paths, or data-test-id).
   - Race conditions -> Add ExpectedConditions (visibilityOfElementLocated, elementToBeClickable).
   - StaleElementReferenceException -> Implement retry loops or re-locating strategies.
3. Provide the refactored, robust Java Selenium code.
4. Explain exactly what was changed and *why* it resolves the flakiness.

