1818package org .openqa .selenium ;
1919
2020import java .util .List ;
21+ import org .jspecify .annotations .NullMarked ;
22+ import org .jspecify .annotations .Nullable ;
2123
2224/**
2325 * Represents an HTML element. Generally, all interesting operations to do with interacting with a
2830 * fails, then an {@link org.openqa.selenium.StaleElementReferenceException} is thrown, and all
2931 * future calls to this instance will fail.
3032 */
33+ @ NullMarked
3134public interface WebElement extends SearchContext , TakesScreenshot {
3235 /**
3336 * 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 {
98101 * @param name The name of the property.
99102 * @return The property's current value or null if the value is not set.
100103 */
101- default String getDomProperty (String name ) {
104+ default @ Nullable String getDomProperty (String name ) {
102105 throw new UnsupportedOperationException ("getDomProperty" );
103106 }
104107
@@ -122,7 +125,7 @@ default String getDomProperty(String name) {
122125 * @param name The name of the attribute.
123126 * @return The attribute's value or null if the value is not set.
124127 */
125- default String getDomAttribute (String name ) {
128+ default @ Nullable String getDomAttribute (String name ) {
126129 throw new UnsupportedOperationException ("getDomAttribute" );
127130 }
128131
@@ -163,7 +166,7 @@ default String getDomAttribute(String name) {
163166 * @param name The name of the attribute.
164167 * @return The attribute/property's current value or null if the value is not set.
165168 */
166- String getAttribute (String name );
169+ @ Nullable String getAttribute (String name );
167170
168171 /**
169172 * Gets result of computing the WAI-ARIA role of element.
@@ -173,7 +176,7 @@ default String getDomAttribute(String name) {
173176 *
174177 * @return the WAI-ARIA role of the element.
175178 */
176- default String getAriaRole () {
179+ default @ Nullable String getAriaRole () {
177180 throw new UnsupportedOperationException ("getAriaRole" );
178181 }
179182
@@ -186,7 +189,7 @@ default String getAriaRole() {
186189 *
187190 * @return the accessible name of the element.
188191 */
189- default String getAccessibleName () {
192+ default @ Nullable String getAccessibleName () {
190193 throw new UnsupportedOperationException ("getAccessibleName" );
191194 }
192195
0 commit comments