Skip to content

Commit

Permalink
[java] Add null check before returning isDisplayed value (#9299)
Browse files Browse the repository at this point in the history
* [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]>
  • Loading branch information
pujagani and diemol authored Mar 18, 2021
1 parent b0ff8df commit f1cb54f
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,10 @@ public boolean isDisplayed() {
Object value = execute(DriverCommand.IS_ELEMENT_DISPLAYED(id))
.getValue();
try {
// See https://github.com/SeleniumHQ/selenium/issues/9266
if (value == null) {
return false;
}
return (Boolean) value;
} catch (ClassCastException ex) {
throw new WebDriverException("Returned value cannot be converted to Boolean: " + value, ex);
Expand Down

0 comments on commit f1cb54f

Please sign in to comment.