Skip to content

Commit f1cb54f

Browse files
pujaganidiemol
andauthored
[java] Add null check before returning isDisplayed value (#9299)
* [java] Add null check before returning isDisplayed value * Update java/client/src/org/openqa/selenium/remote/RemoteWebElement.java Co-authored-by: Diego Molina <[email protected]>
1 parent b0ff8df commit f1cb54f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

java/client/src/org/openqa/selenium/remote/RemoteWebElement.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,10 @@ public boolean isDisplayed() {
295295
Object value = execute(DriverCommand.IS_ELEMENT_DISPLAYED(id))
296296
.getValue();
297297
try {
298+
// See https://github.com/SeleniumHQ/selenium/issues/9266
299+
if (value == null) {
300+
return false;
301+
}
298302
return (Boolean) value;
299303
} catch (ClassCastException ex) {
300304
throw new WebDriverException("Returned value cannot be converted to Boolean: " + value, ex);

0 commit comments

Comments
 (0)