For example, TjMaxx
When the user navigates for the first time pop up window shows up, sometimes 2, and it's hard to catch and move on. I tried try catch, but it does not work, because it opens some windows that I cannot see. How to catch all windows and dismiss them all for the guest user?
try {
WebElement closeWindowPromo = driver.findElement(By.xpath
("//div[@class =\"bx-row bx-row-submit bx-row-submit-no bx-row-2uaILGf bx-element-1360650-2uaILGf\"]//button[@data-click = 'close']"));
WebDriverWait w = new WebDriverWait(driver, 5);
w.until(ExpectedConditions.visibilityOfElementLocated((By) closeWindowPromo));
System.out.println("Element is visible");
} catch (NoSuchElementException n) {
System.out.println("Element is invisible");
}
wait = new WebDriverWait(driver, 10);