Class AccessibilitySnapshot
java.lang.Object
net.serenitybdd.screenplay.playwright.questions.AccessibilitySnapshot
- All Implemented Interfaces:
net.serenitybdd.screenplay.Question<String>
public class AccessibilitySnapshot
extends Object
implements net.serenitybdd.screenplay.Question<String>
Retrieve accessibility information from the page or a specific element.
This question provides accessibility details using Playwright's ARIA snapshot functionality, which is useful for testing accessibility compliance.
Sample usage:
// Get accessibility info for the entire page
String snapshot = actor.asksFor(AccessibilitySnapshot.ofThePage());
// Get accessibility info for a specific element
String snapshot = actor.asksFor(AccessibilitySnapshot.of("#main-nav"));
String snapshot = actor.asksFor(AccessibilitySnapshot.of(NAVIGATION));
// Get all elements with a specific ARIA role
List<String> buttons = actor.asksFor(AccessibilitySnapshot.allWithRole(AriaRole.BUTTON));
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionallWithRole(com.microsoft.playwright.options.AriaRole role) Get all elements with the specified ARIA role.answeredBy(net.serenitybdd.screenplay.Actor actor) static AccessibilitySnapshotGet the accessibility snapshot of a specific element.static AccessibilitySnapshotGet the accessibility snapshot of a specific Target element.static AccessibilitySnapshotGet the accessibility snapshot of the entire page.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.serenitybdd.screenplay.Question
as, asADate, asADate, asBigDecimal, asBoolean, asCollectionOf, asDouble, asEnum, asFloat, asInteger, asListOf, asLong, asString, describedAs, getSubject, map, mapEach
-
Method Details
-
ofThePage
Get the accessibility snapshot of the entire page. Returns a YAML-like representation of the accessibility tree. -
of
Get the accessibility snapshot of a specific element.- Parameters:
selector- The CSS or XPath selector for the element
-
of
Get the accessibility snapshot of a specific Target element.- Parameters:
target- The Target element
-
allWithRole
public static net.serenitybdd.screenplay.Question<List<String>> allWithRole(com.microsoft.playwright.options.AriaRole role) Get all elements with the specified ARIA role.- Parameters:
role- The ARIA role to search for- Returns:
- A Question that returns a list of accessible names for elements with the role
-
answeredBy
- Specified by:
answeredByin interfacenet.serenitybdd.screenplay.Question<String>
-
toString
-