Implementing Java 8 streaming API for-next loop
This commit is contained in:
parent
4639d46705
commit
0d2e13392b
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue