Hi I want to handle window popup using selenium but am not able to handle it I tried driver.switch().toAlert().accept but this not working code say no alert found and when I don't use it error is unexpected popup caught `if(communicateCheck.contains("Enter a past job that shows relevant experience")) {
String optionalCheck = driver.findElement(By.xpath("//span[@class='ia-LabelWrapper-optional css-1d4obwt e1wnkr790']")).getText();
Thread.sleep(3000);
if(optionalCheck.contains("optional")) {
driver.findElement(By.xpath("//span[normalize-space()='Continue']")).click();
Thread.sleep(4000);
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("window.scrollBy(0,350)", "");
driver.findElement(By.xpath("//span[normalize-space()='Submit your application']")).click();
}
else {
String notexecutedurl = driver.getCurrentUrl();
System.out.println("1:user not able to submit application on this url"+notexecutedurl);
}
}
else {
System.out.println("Sorry we are not acceptiing this because this if not in our format ");
Robot robot = new Robot();
Thread.sleep(20000);
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_SPACE);
Thread.sleep(20000);
}
[enter image description here][1]`