signup / cookie Pop-ups - how to accept in automated testing and continue with test [closed]

2 weeks ago 19
ARTICLE AD BOX

Using www.whitestuff.com I want to find Web element on the main page (Womens url) and click on it as per below as part of my test

private static void findWhiteStuffElements(WebDriver driver2) { //WebDriver driver2 = new ChromeDriver(); driver2.get("https://www.whitestuff.com/"); WebElement womensUrlX2 = driver2.findElement(By.xpath("//*[contains(text(),'WOMEN')][@class='sf-link uppercase py-2 px-2.5 no-underline desktop-app-header no-underline']")); womensUrlX2.isDisplayed(); womensUrlX2.click();

however, I have my first pop ups to deal with - which don't always appear

Queries

How to write method using Java where SE Webdriver finds the pop ups and accept them to continue with test?

What if these popups do not appear again - how to write this into the method to detect and process or to search and if no results, continue with test?

thanks

Read Entire Article