How to use GetHashCode method of PuppeteerSharp.PageAccessibility.SerializedAXNode class

Best Puppeteer-sharp code snippet using PuppeteerSharp.PageAccessibility.SerializedAXNode.GetHashCode

Run Puppeteer-sharp automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

SerializedAXNode.cs

Source: SerializedAXNode.cs Github

copy
1using System;
2using System.Linq;
3
4namespace PuppeteerSharp.PageAccessibility
5{
6    /// <summary>
7    /// AXNode.
8    /// </summary>
9    public class SerializedAXNode : IEquatable<SerializedAXNode>
10    {
11        /// <summary>
12        /// Creates a new serialized node
13        /// </summary>
14        public SerializedAXNode() => Children = Array.Empty<SerializedAXNode>();
15
16        /// <summary>
17        /// The <see fref="https://www.w3.org/TR/wai-aria/#usage_intro">role</see>.
18        /// </summary>
19        public string Role { get; set; }
20        /// <summary>
21        /// A human readable name for the node.
22        /// </summary>
23        public string Name { get; set; }
24        /// <summary>
25        /// The current value of the node.
26        /// </summary>
27        public string Value { get; set; }
28        /// <summary>
29        /// An additional human readable description of the node.
30        /// </summary>
31        public string Description { get; set; }
32        /// <summary>
33        /// Keyboard shortcuts associated with this node.
34        /// </summary>
35        public string KeyShortcuts { get; set; }
36        /// <summary>
37        /// A human readable alternative to the role.
38        /// </summary>
39        public string RoleDescription { get; set; }
40        /// <summary>
41        /// A description of the current value.
42        /// </summary>
43        public string ValueText { get; set; }
44        /// <summary>
45        /// Whether the node is disabled.
46        /// </summary>
47        public bool Disabled { get; set; }
48        /// <summary>
49        /// Whether the node is expanded or collapsed.
50        /// </summary>
51        public bool Expanded { get; set; }
52        /// <summary>
53        /// Whether the node is focused.
54        /// </summary>
55        public bool Focused { get; set; }
56        /// <summary>
57        /// Whether the node is <see href="https://en.wikipedia.org/wiki/Modal_window">modal</see>.
58        /// </summary>
59        public bool Modal { get; set; }
60        /// <summary>
61        /// Whether the node text input supports multiline.
62        /// </summary>
63        public bool Multiline { get; set; }
64        /// <summary>
65        /// Whether more than one child can be selected.
66        /// </summary>
67        public bool Multiselectable { get; set; }
68        /// <summary>
69        /// Whether the node is read only.
70        /// </summary>
71        public bool Readonly { get; set; }
72        /// <summary>
73        /// Whether the node is required.
74        /// </summary>
75        public bool Required { get; set; }
76        /// <summary>
77        /// Whether the node is selected in its parent node.
78        /// </summary>
79        public bool Selected { get; set; }
80        /// <summary>
81        /// Whether the checkbox is checked, or "mixed".
82        /// </summary>
83        public CheckedState Checked { get; set; }
84        /// <summary>
85        /// Whether the toggle button is checked, or "mixed".
86        /// </summary>
87        public CheckedState Pressed { get; set; }
88        /// <summary>
89        /// The level of a heading.
90        /// </summary>
91        public int Level { get; set; }
92        /// <summary>
93        /// The minimum value in a node.
94        /// </summary>
95        public int ValueMin { get; set; }
96        /// <summary>
97        /// The maximum value in a node.
98        /// </summary>
99        public int ValueMax { get; set; }
100        /// <summary>
101        /// What kind of autocomplete is supported by a control.
102        /// </summary>
103        public string AutoComplete { get; set; }
104        /// <summary>
105        /// What kind of popup is currently being shown for a node.
106        /// </summary>
107        public string HasPopup { get; set; }
108        /// <summary>
109        /// Whether and in what way this node's value is invalid.
110        /// </summary>
111        public string Invalid { get; set; }
112        /// <summary>
113        /// Whether the node is oriented horizontally or vertically.
114        /// </summary>
115        public string Orientation { get; set; }
116        /// <summary>
117        /// Child nodes of this node, if any.
118        /// </summary>
119        public SerializedAXNode[] Children { get; set; }
120
121        /// <inheritdoc/>
122        public bool Equals(SerializedAXNode other)
123            => ReferenceEquals(this, other) ||
124                (
125                    Role == other.Role &&
126                    Name == other.Name &&
127                    Value == other.Value &&
128                    Description == other.Description &&
129                    KeyShortcuts == other.KeyShortcuts &&
130                    RoleDescription == other.RoleDescription &&
131                    ValueText == other.ValueText &&
132                    AutoComplete == other.AutoComplete &&
133                    HasPopup == other.HasPopup &&
134                    Orientation == other.Orientation &&
135                    Disabled == other.Disabled &&
136                    Expanded == other.Expanded &&
137                    Focused == other.Focused &&
138                    Modal == other.Modal &&
139                    Multiline == other.Multiline &&
140                    Multiselectable == other.Multiselectable &&
141                    Readonly == other.Readonly &&
142                    Required == other.Required &&
143                    Selected == other.Selected &&
144                    Checked == other.Checked &&
145                    Pressed == other.Pressed &&
146                    Level == other.Level &&
147                    ValueMin == other.ValueMin &&
148                    ValueMax == other.ValueMax &&
149                    (Children == other.Children || Children.SequenceEqual(other.Children))
150                );
151
152        /// <inheritdoc/>
153        public override bool Equals(object obj) => obj is SerializedAXNode s && Equals(s);
154        /// <inheritdoc/>
155        public override int GetHashCode()
156            => Role.GetHashCode() ^
157                Name.GetHashCode() ^
158                Value.GetHashCode() ^
159                Description.GetHashCode() ^
160                KeyShortcuts.GetHashCode() ^
161                RoleDescription.GetHashCode() ^
162                ValueText.GetHashCode() ^
163                AutoComplete.GetHashCode() ^
164                HasPopup.GetHashCode() ^
165                Orientation.GetHashCode() ^
166                Disabled.GetHashCode() ^
167                Expanded.GetHashCode() ^
168                Focused.GetHashCode() ^
169                Modal.GetHashCode() ^
170                Multiline.GetHashCode() ^
171                Multiselectable.GetHashCode() ^
172                Readonly.GetHashCode() ^
173                Required.GetHashCode() ^
174                Selected.GetHashCode() ^
175                Pressed.GetHashCode() ^
176                Checked.GetHashCode() ^
177                Level.GetHashCode() ^
178                ValueMin.GetHashCode() ^
179                ValueMax.GetHashCode() ^
180                Children.GetHashCode();
181    }
182}
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Trigger GetHashCode code on LambdaTest Cloud Grid

Execute automation tests with GetHashCode on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)