AccessibilityNode Class

A node of a snapshot of the accessibility tree, created by Element.CaptureAccessibilityTree: an element with a role, or a run of text. The snapshot does not follow the later changes of the document.

public sealed class AccessibilityNode

Properties

NameDescription
ChildrenThe children of the node, in the order of the accessibility tree: the flat tree (the shadow trees and their slotted nodes), with the relocations of aria-owns. The elements without a role, the presentational elements and the generic elements (e.g. div, span) are not nodes: their children are children of their parent.
NodeThe DOM node of the accessibility node: the Element, or, for a run of text, its first Text node (the element whose ::before or ::after content is the text when there is no text node).
ParentThe parent node, or null for the root of the snapshot.
PropertiesThe role, the name, the description and the states of the node.

The children of the node, in the order of the accessibility tree: the flat tree (the shadow trees and their slotted nodes), with the relocations of aria-owns. The elements without a role, the presentational elements and the generic elements (e.g. div, span) are not nodes: their children are children of their parent.

public IReadOnlyList<AccessibilityNode> Children { get; }

The DOM node of the accessibility node: the Element, or, for a run of text, its first Text node (the element whose ::before or ::after content is the text when there is no text node).

public Node Node { get; }

Property value

Node

The parent node, or null for the root of the snapshot.

public AccessibilityNode? Parent { get; }

Property value

AccessibilityNode?

The role, the name, the description and the states of the node.

public AccessibilityProperties Properties { get; }

Methods

NameDescription
ToAriaSnapshot()Returns the subtree in the YAML format of the aria snapshots of Playwright (https://playwright.dev/docs/aria-snapshots), e.g. - heading "Title" [level=1]. The children of a root without a role, presentational or generic, are written at the first level.
ToString()Returns the role, the name and the states of the node, as the key of a line of AccessibilityNode.ToAriaSnapshot.

ToAriaSnapshot()

AccessibilityNode.cs

Returns the subtree in the YAML format of the aria snapshots of Playwright (https://playwright.dev/docs/aria-snapshots), e.g. - heading "Title" [level=1]. The children of a root without a role, presentational or generic, are written at the first level.

public string ToAriaSnapshot()

Returns

string

Returns the role, the name and the states of the node, as the key of a line of AccessibilityNode.ToAriaSnapshot.

public override string ToString()

Returns

string