According to you, you are able to accept the alert but test step is showing exception in console :
You can catch the exception and proceed further with your next steps:
Below is the code :
try {
Alert myAlert = driver.switchTo().alert();
myAlert.accept();
} catch (Exception e) {
System.out.println("######### Successfully Accepted Alert ################");
}
// here proceed with your next steps.
Hope it will help you out.
0
solved When I run test in selenium using java, the alert gets closed but in code it shows failure