Papio Framework Generator
Source: Dev.to
If you’ve spent time in test automation, you know the selector problem. You open DevTools, inspect an element, and then manually craft something like:
@class='container']//button[contains(text(),'Submit')]Two sprints later, the UI changes. The class is gone. The test breaks. You fix it. The cycle repeats indefinitely.
After 20+ years in QA automation — working across Toyota Connected, Caesars Digital, and enterprise Fortune 500 environments — I decided to build the tool I always wished existed: Papio Selector.
The Core Problem: Framework Fragmentation
Each framework has its own selector API. Maintaining consistency across all of them manually is error‑prone and time‑consuming. Papio generates idiomatic code for all of them from a single inspection.
Shadow DOM — The Elephant in the Room
Papio handles Shadow DOM elements automatically, ensuring selectors work even when components are encapsulated.
Selector Priority Algorithm
Papio follows a prioritized approach to generate the most stable selectors:
data-testid/data-cyattributes (most stable)- ARIA roles and labels
- ID attributes
- Unique CSS class combinations
- Structural/positional selectors (last resort)
This means Papio‑generated selectors are inherently more resilient to UI changes than manually crafted ones.