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() {
|
private void closeOverlay() {
|
||||||
List<WebElement> webElementList = webDriver.findElements(By.tagName("a"));
|
List<WebElement> webElementList = webDriver.findElements(By.tagName("a"));
|
||||||
if (webElementList != null && !webElementList.isEmpty()) {
|
if (webElementList != null && !webElementList.isEmpty()) {
|
||||||
for (WebElement webElement : webElementList) {
|
webElementList.stream().filter(webElement -> "Close".equalsIgnoreCase(webElement.getAttribute("title"))).findAny().get().click();
|
||||||
if (webElement.getAttribute("title").equalsIgnoreCase("Close")) {
|
|
||||||
webElement.click();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue