From 75a0274fe8c9949c325fc7572986b581d3a174fe Mon Sep 17 00:00:00 2001 From: Grzegorz Piwowarek Date: Thu, 17 Nov 2016 07:46:38 +0200 Subject: [PATCH] Refactor SeleniumExample --- .../src/main/java/com/baeldung/selenium/SeleniumExample.java | 1 + 1 file changed, 1 insertion(+) diff --git a/selenium-junit-testng/src/main/java/com/baeldung/selenium/SeleniumExample.java b/selenium-junit-testng/src/main/java/com/baeldung/selenium/SeleniumExample.java index a9e0ccfb4a..b97f66e9dd 100644 --- a/selenium-junit-testng/src/main/java/com/baeldung/selenium/SeleniumExample.java +++ b/selenium-junit-testng/src/main/java/com/baeldung/selenium/SeleniumExample.java @@ -40,6 +40,7 @@ public class SeleniumExample { if (webElementList != null) { webElementList.stream() .filter(webElement -> "Close".equalsIgnoreCase(webElement.getAttribute("title"))) + .filter(WebElement::isDisplayed) .findAny() .ifPresent(WebElement::click); }