A practical approach to stabilizing automation test selectors using Retrieval Augmented Generation (RAG) with Large Language Models. The method involves storing selector data, capturing screenshots and DOM scans, creating robust prompts for LLMs to generate stable selectors, and implementing retry logic. The solution addresses common test automation challenges like flaky selectors that break due to UI changes, using AI to dynamically find elements based on natural language descriptions rather than brittle XPath or ID selectors.
Table of contents
Step 1: Storage systemStep 2: Screenshots and content scanningStep 3: Robust prompt(s)Step 4: Plug everything together and call an LLMGet Adrian Pothuaud’s stories in your inboxFinal: try and improveSort: