From 4153c4356d3a7247ece49e0d40c96132f5d06cf6 Mon Sep 17 00:00:00 2001 From: Rahul Shah Date: Thu, 27 Feb 2020 17:51:21 +0530 Subject: [PATCH] 'isInvisible()' returns true on 'NoSuchElementException' The 'isInvisible()' method, when encountered with 'NoSuchElementException' causes 'TimeoutException', whereas, it should return true. Because if the element id not in DOM, it should be treated as invisible Fixes #7518 --- .../src/org/openqa/selenium/support/ui/ExpectedConditions.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java b/java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java index 75c6171b8a519..5f2cb495eb338 100644 --- a/java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java +++ b/java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java @@ -1346,7 +1346,7 @@ public String toString() { private static boolean isInvisible(final WebElement element) { try { return !element.isDisplayed(); - } catch (StaleElementReferenceException ignored) { + } catch (StaleElementReferenceException | NoSuchElementException ignored) { // We can assume a stale element isn't displayed. return true; }