Class AriaSnapshotHelper
java.lang.Object
com.shaft.gui.internal.aria.AriaSnapshotHelper
Captures and compares accessible-name-tree ("aria") snapshots: a pragmatic, DOM-walk-based subset of
ARIA role/name resolution (not full ARIA AAM spec compliance), serialized as a strict subset of
Playwright's aria snapshot YAML DSL (no
[level=n] attributes, no regex names).
Both backends run the same ariaSnapshot.js DOM walk so web output is directly comparable.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordResult of a partial-subset aria snapshot comparison. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcaptureAriaSnapshot(com.microsoft.playwright.Locator locator) Captures an aria snapshot of the element matched bylocator, using Playwright JavaScript evaluation.static StringcaptureAriaSnapshot(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By locator) Captures an aria snapshot of the element matched bylocator, using Selenium JavaScript execution.Performs a partial-subset structural match: every baseline node must match an actual node at the same depth, in order (role equal; name equal after trim, or the baseline name may be blank to match any actual name); extra actual siblings/children are allowed.Parses SHAFT's aria snapshot YAML format back into an accessible-name-tree forest.static StringSerializes an accessible-name-tree forest to SHAFT's aria snapshot YAML format.
-
Method Details
-
captureAriaSnapshot
public static String captureAriaSnapshot(org.openqa.selenium.WebDriver driver, org.openqa.selenium.By locator) Captures an aria snapshot of the element matched bylocator, using Selenium JavaScript execution.- Parameters:
driver- active WebDriver instance (must supportJavascriptExecutor)locator- locator of the element to snapshot- Returns:
- the captured snapshot serialized as YAML
-
captureAriaSnapshot
Captures an aria snapshot of the element matched bylocator, using Playwright JavaScript evaluation.- Parameters:
locator- Playwright locator of the element to snapshot- Returns:
- the captured snapshot serialized as YAML
-
serialize
-
parse
-
match
Performs a partial-subset structural match: every baseline node must match an actual node at the same depth, in order (role equal; name equal after trim, or the baseline name may be blank to match any actual name); extra actual siblings/children are allowed. This is a pragmatic (greedy, not fully backtracking) subsequence match, sufficient for visual/structural regression baselining.- Parameters:
baselineYaml- the stored baseline snapshotactualYaml- the freshly captured snapshot- Returns:
- the match result, with a readable diff message on mismatch
-