/** * semantic-locator.ts * * Generates the best possible Playwright locator expression for a DOM element * by choosing the most stable, human-readable strategy available. * * Priority order (most stable to least stable): * 1. role + label → getByRole() * 2. role + text → getByRole() * 3. label alone → getByLabel() * 4. placeholder → getByPlaceholder() * 5. visible text → getByText() (skipped for form inputs to avoid false matches) * 6. testId → getByTestId() * 7. CSS selector → locator() (last resort fallback) * * This class is used at test-generation time (not at runtime healing) to decide * which locator to embed in the Page Object Model for each discovered element. * * Role in the overall flow: * PlaywrightGenerationSkill → SemanticLocator.best(element) → locator string in POM * SemanticLocatorSkill → SemanticLocator.best(element) → SkillResult.selectors[] */ import { DOMElement } from '../types'; /** * Converts a DOMElement (from DOM analysis) into the most appropriate * Playwright locator expression string. */ export declare class SemanticLocator { /** * Return the best Playwright locator expression for the given element. * * The returned string is a valid Playwright API call that can be embedded * directly into generated Page Object code, e.g.: * "page.getByRole('button', { name: /Login/i })" * * @param el - A DOM element extracted by DOMAnalyzer. * @returns A Playwright locator expression string. */ best(el: DOMElement): string; /** * Escape special regex characters in a string so it can be safely embedded * inside a regex literal without unintended matches. * * @param s - The raw string to escape. * @returns The escaped string safe for use inside /.../ regex patterns. */ private esc; } //# sourceMappingURL=semantic-locator.d.ts.map