18
18
package org .openqa .selenium ;
19
19
20
20
import java .util .List ;
21
+ import org .jspecify .annotations .NullMarked ;
22
+ import org .jspecify .annotations .Nullable ;
21
23
22
24
/**
23
25
* Represents an HTML element. Generally, all interesting operations to do with interacting with a
28
30
* fails, then an {@link org.openqa.selenium.StaleElementReferenceException} is thrown, and all
29
31
* future calls to this instance will fail.
30
32
*/
33
+ @ NullMarked
31
34
public interface WebElement extends SearchContext , TakesScreenshot {
32
35
/**
33
36
* Click this element. If this causes a new page to load, you should discard all references to
@@ -98,7 +101,7 @@ public interface WebElement extends SearchContext, TakesScreenshot {
98
101
* @param name The name of the property.
99
102
* @return The property's current value or null if the value is not set.
100
103
*/
101
- default String getDomProperty (String name ) {
104
+ default @ Nullable String getDomProperty (String name ) {
102
105
throw new UnsupportedOperationException ("getDomProperty" );
103
106
}
104
107
@@ -122,7 +125,7 @@ default String getDomProperty(String name) {
122
125
* @param name The name of the attribute.
123
126
* @return The attribute's value or null if the value is not set.
124
127
*/
125
- default String getDomAttribute (String name ) {
128
+ default @ Nullable String getDomAttribute (String name ) {
126
129
throw new UnsupportedOperationException ("getDomAttribute" );
127
130
}
128
131
@@ -163,7 +166,7 @@ default String getDomAttribute(String name) {
163
166
* @param name The name of the attribute.
164
167
* @return The attribute/property's current value or null if the value is not set.
165
168
*/
166
- String getAttribute (String name );
169
+ @ Nullable String getAttribute (String name );
167
170
168
171
/**
169
172
* Gets result of computing the WAI-ARIA role of element.
@@ -173,7 +176,7 @@ default String getDomAttribute(String name) {
173
176
*
174
177
* @return the WAI-ARIA role of the element.
175
178
*/
176
- default String getAriaRole () {
179
+ default @ Nullable String getAriaRole () {
177
180
throw new UnsupportedOperationException ("getAriaRole" );
178
181
}
179
182
@@ -186,7 +189,7 @@ default String getAriaRole() {
186
189
*
187
190
* @return the accessible name of the element.
188
191
*/
189
- default String getAccessibleName () {
192
+ default @ Nullable String getAccessibleName () {
190
193
throw new UnsupportedOperationException ("getAccessibleName" );
191
194
}
192
195
0 commit comments