Skip to content

Commit

Permalink
[java] Add null check before returning isDisplayed() value
Browse files Browse the repository at this point in the history
  • Loading branch information
pujagani committed Mar 18, 2021
1 parent 50a1a91 commit 874c34d
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,9 @@ public boolean isDisplayed() {
Object value = execute(DriverCommand.IS_ELEMENT_DISPLAYED(id))
.getValue();
try {
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 874c34d

Please sign in to comment.