Implementing Java 8 streaming API for-next loop

This commit is contained in:
Sandeep Kumar 2016-10-09 08:15:55 +05:30
parent 4639d46705
commit 0d2e13392b
1 changed files with 1 additions and 5 deletions

View File

@ -37,11 +37,7 @@ public class SeleniumExample {
private void closeOverlay() {
List<WebElement> webElementList = webDriver.findElements(By.tagName("a"));
if (webElementList != null && !webElementList.isEmpty()) {
for (WebElement webElement : webElementList) {
if (webElement.getAttribute("title").equalsIgnoreCase("Close")) {
webElement.click();
}
}
webElementList.stream().filter(webElement -> "Close".equalsIgnoreCase(webElement.getAttribute("title"))).findAny().get().click();
}
}