How can I handle my selenium unexpected alert
We need to deal with these unexpected notifications separately, and we can do so with the try-catch block. Note: If we write straight code (without try-catch) to accept or reject the alert and the alert does not appear, our test case will fail to throw any Selenium exception, such as a timeout Exception.